Skip to content

HTTP 500 Error on GET /api/v2/firewall/aliases - Undefined constant #829

@rpaal10

Description

@rpaal10

Issue: After updating to the latest API package version (v2.7.0), the /api/v2/firewall/aliases endpoint is broken

pfsense version CE 2.8.1

error:

{
"code": 500,
"status": "internal server error",
"response_id": "ENDPOINT_RECEIVED_UNEXPECTED_ERROR",
"message": "Undefined constant ``\n#0 /usr/local/pkg/RESTAPI/Core/BaseTraits.inc(56): constant()\n#1 /usr/local/pkg/RESTAPI/Core/Auth.inc(297): RESTAPI\Core\Auth::log()\n#2 /usr/local/pkg/RESTAPI/Core/Endpoint.inc(615): RESTAPI\Core\Auth::attempt_multi_auth()\n#3 /usr/local/pkg/RESTAPI/Core/Endpoint.inc(1048): RESTAPI\Core\Endpoint->check_auth()\n#4 /usr/local/www/api/v2/firewall/aliases/index.php(9): RESTAPI\Core\Endpoint->process_request()\n#5 {main}",
"data": []
}

Steps to Reproduce
Update pfSense REST API package to latest version
Execute: curl -k -X GET -H "X-API-Key: [VALID_KEY]" "https://[PFSENSE_IP]/api/v2/firewall/aliases"
Receive HTTP 500 error
Expected Behavior
Should return a list of firewall aliases in JSON format (as it did in the previous version)

Actual Behavior
Returns HTTP 500 with "Undefined constant" error

Root Cause
Based on the stack trace, the error originates in:

File: /usr/local/pkg/RESTAPI/Core/BaseTraits.inc
Line: 56
Function: constant()
The function constant() is being called with an empty or undefined constant name, likely during the authentication/logging process.

Impact
Critical: Cannot list firewall aliases via API
Breaks existing automation scripts that worked with previous API version
No workaround available - endpoint is completely non-functional
Additional Information
This worked correctly in the previous version of the API package
Only the API package was updated, not pfSense itself
Other API endpoints may be affected by the same issue
The error occurs during authentication phase before reaching the actual endpoint logic
Request
Please fix the undefined constant issue in BaseTraits.inc line 56 and release a patch as soon as possible, as this breaks critical functionality for users relying on API automation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions