View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0035286 | mantisbt | api rest | public | 2025-02-01 04:53 | 2026-09-09 19:19 |
| Reporter | dregad | Assigned To | dregad | ||
| Priority | normal | Severity | feature | Reproducibility | have not tried |
| Status | resolved | Resolution | fixed | ||
| Target Version | 2.29.0 | Fixed in Version | 2.29.0 | ||
| Summary | 0035286: REST API: follow Standards for Authorization header | ||||
| Description | Our implementation of API tokens in Authorization header is not compliant with the standard defined by RFC-9110, which requires that an authentication scheme is specified before the actual credentials, while we expect just We need to
See MDN reference on Authorization header and Authentication schemes for more practical information on the standard. | ||||
| Additional Information | Follows discussion in PR https://github.com/mantisbt/mantisbt/pull/2071
| ||||
| Tags | No tags attached. | ||||
|
And need to remember to follow the recommendations from RFC 6750. |
|
|
Using office scripting fetch() (to make REST API calls) is doing a CORS (cross origin resource share) preflight OPTIONS request. That request does not contain the Authorization header, as the server should respond what kind of authorization is allowed. Upon such preflight OPTIONS request, Mantis API will respond with a 401 Api token required. Due to the 401 response, the fetch() call will not continue to make the GET request. When the Authorization is changed to match the standard, IMHO the OPTIONS request should be changed to allow the OPTIONS request without api token. |
|
|
This issue is partially covered by the PR below Documentation in the following PR: I haven't looked at the CORS issue. |
|
|
Following merge of the 2 PRs mentioned in 0035286:0071361 and resolution of 0037333, I believe this Issue should be considered as fixed. I have submitted follow-up PR 2276 for the deprecation of the legacy usage of an Authentication header without bearer scheme:
Legacy auth without bearer scheme will be removed in a future release (see 0037367). |
|
|
MantisBT: master 9ece70d4 2026-09-03 19:11 Details Diff |
REST API auth without Bearer scheme is deprecated Update documentation to reflect that. Fixes 0035286, 0037333 |
Affected Issues 0035286, 0037333 |
|
| mod - api/rest/mantisbt_openapi.yaml | Diff File | ||
| mod - docbook/Developers_Guide/en-US/Api_Rest.xml | Diff File | ||
|
MantisBT: master 9670defb 2026-09-03 19:17 Details Diff |
Send HTTP Deprecation header if bearer scheme missing If the REST API authentication is provided without the bearer scheme, an RFC 9745 Deprecation header is sent, together with a link to the Developer's Guide REST API Authentication chapter. Adapt PHPUnit testBareTokenIsAccepted() to check for presence of Deprecation header. Fixes 0035286 |
Affected Issues 0035286 |
|
| mod - api/rest/restcore/AuthMiddleware.php | Diff File | ||
| mod - core/constant_inc.php | Diff File | ||
| mod - tests/rest/RestAuthHeaderTest.php | Diff File | ||