Summary
In apps/public-api/src/middlewares/resolvePublicAuthContext.js (Line 12), the Authorization header check uses authHeader.startsWith('Bearer '), which is case-sensitive and will silently ignore valid tokens sent with bearer <token> or BEARER <token>.
Per RFC 7235 §2.1, the auth-scheme token is case-insensitive.
Suggested Fix
- if (!authHeader || !authHeader.startsWith('Bearer ')) {
+ if (!authHeader || !/^bearer\s/i.test(authHeader)) {
And extract the token accordingly:
- const token = authHeader.split(' ')[1];
+ const token = authHeader.replace(/^bearer\s+/i, '');
Context
Identified during review of PR #51 (#51 (comment)) as a minor issue deferred for a follow-up.
Requested by @yash-pouranik.
Summary
In
apps/public-api/src/middlewares/resolvePublicAuthContext.js(Line 12), theAuthorizationheader check usesauthHeader.startsWith('Bearer '), which is case-sensitive and will silently ignore valid tokens sent withbearer <token>orBEARER <token>.Per RFC 7235 §2.1, the auth-scheme token is case-insensitive.
Suggested Fix
And extract the token accordingly:
Context
Identified during review of PR #51 (#51 (comment)) as a minor issue deferred for a follow-up.
Requested by @yash-pouranik.