Repository navigation
fix(auth): accept Authorization: Bearer <token> as well as the bare token - #6
Merged
Merged
Conversation
- v1, v2 extractors: `jwt.TokenFromAuthorization` (CasaOS-Common v0.4.31) on the header value - v1 header-or-`?token=`: still decided on the raw header (present → header) - `Internal <secret>`: still matched on the raw header (skipper) - tests: bare, `Bearer`, `bearer` → accepted; `Basic`, the scheme alone → 401; `?token=` without a header → accepted; scheme alone + `?token=` → 401 Part of ReCasaOS/CasaOS#46. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
inkly
approved these changes
Oct 24, 2026
inkly
left a comment
Collaborator
There was a problem hiding this comment.
Thanks, we reviewed all eight together. The raw header still makes every decision (empty vs ?token=, header-only, Internal <secret>); the helper only feeds the token check, and the gateway's proxying is unchanged. The v0.4.31 bumps are tidy with matching go.sum, and builds and route tests pass, also merged with CasaOS#55 and CasaOS-UserService#6. Approving. We'll squash-merge with a plain commit message.
Optional follow-ups, not blocking: a loopback Bearer Internal <secret> → 401 case in core's tests (LocalStorage and VirtManagement write a secret no case uses), a v1 case in AppManagement and a v2 case in UserService.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of ReCasaOS/CasaOS#46 (helper: ReCasaOS/CasaOS-Common#7, released in v0.4.31).
jwt.TokenFromAuthorizationon the Authorization value → bare token (unchanged) orBearer <token>(scheme case-insensitive)Internal <secret>(skipper), header vs?token=(v1); the helper's output only feeds the token checkBearer,bearer→ accepted;Basic,Beareralone → 401; v1?token=without a header → accepted,Beareralone +?token=→ 401🤖 Generated with Claude Code