Repository navigation
fix(auth): accept Authorization: Bearer <token> as well as the bare token - #6
Merged
Merged
Conversation
- was: the whole Authorization value taken as the JWT → `Bearer <token>` (RFC 6750; OpenAPI `bearer`, curl `--oauth2-bearer`) → 401 - now: header token lookup through CasaOS-Common `jwt.TokenFromAuthorization`: bare unchanged, `Bearer` stripped (case-insensitive), `Internal <secret>` untouched; `?token=` on subscription routes unchanged - needs: CasaOS-Common `feat/bearer-authorization` released → bump go.mod - test: Bearer and bearer pass, another scheme → 401 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ests - Common v0.4.31: `jwt.TokenFromAuthorization` (released, ReCasaOS/CasaOS-Common#7) - tests: bare, `Bearer`, `bearer` → accepted; `Basic`, the scheme alone → 401 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=(subscription routes); the helper's output only feeds the token checkBearer,bearer→ accepted;Basic,Beareralone → 401 (table inTestAPIRouterAuth)🤖 Generated with Claude Code