Skip to content

fix: make auth Bearer scheme match case-insensitive (RFC 9110) - #69

Merged
jonbaldie merged 1 commit into
mainfrom
fix/66-case-insensitive-bearer-scheme
Aug 31, 2026
Merged

fix: make auth Bearer scheme match case-insensitive (RFC 9110)#69
jonbaldie merged 1 commit into
mainfrom
fix/66-case-insensitive-bearer-scheme

Conversation

@jonbaldie

Copy link
Copy Markdown
Owner

Closes #66

Auth middleware compared the entire Authorization header against a fixed-case Bearer ${token} literal, rejecting standards-compliant clients that send bearer/BEARER/etc. (RFC 9110 §11.5 requires the scheme name be case-insensitive; this service's own openapi.yaml declares scheme: bearer, lowercase).

Now splits the header into scheme + token and compares the scheme case-insensitively; token comparison is unchanged (case-sensitive, exact match).

Verified: reproduced 401 on bearer/BEARER/BeArEr against the old code, wrote a regression test asserting 200 for all three, confirmed it failed before the fix and passes after. Full test suite (217 tests) green.

🤖 Generated with Claude Code

Parses the Authorization header into scheme and token instead of
comparing the whole header against a fixed-case literal, so bearer,
BEARER, etc. authenticate the same as Bearer.

Fixes #66

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q25veeccRvgA5zjp6Fhijq
@jonbaldie
jonbaldie merged commit bd2d29d into main Aug 31, 2026
4 checks passed
@jonbaldie
jonbaldie deleted the fix/66-case-insensitive-bearer-scheme branch August 31, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auth rejects case-variants of the Bearer scheme (RFC 9110 requires case-insensitive scheme name)

1 participant