Repository navigation
feat(inboundauth): verify bearer JWTs against JWKS - #110
Merged
Merged
Conversation
Add the middleware configuration and its validation, and document the library comparison that selects lestrrat-go/jwx/v3. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
…odes Verify ES256/RS256 tokens against a rate-limited JWKS cache, enforce time, issuer, audience, scope, and caller rules, strip the Authorization header, and return a stable error code for every deny reason. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
Document the package threat model, deny codes, token-stripping guarantee, and library choice, and add a compiling usage example plus a guard that the package never imports internal/. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true |
Release the key cache mutex before the network call and serialize refreshes with an in-flight flag, so a slow or blocked JWKS fetch cannot stall requests whose kid is already cached. Strip Authorization on exempt paths, compare configured exempt entries verbatim, and document that a token without kid is rejected even for a single-key JWKS. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
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.
Summary
Adds
pkg/inboundauth, a standalonenet/httpmiddleware that authenticates callers itself because OpenShell bearer passthrough also admits token-less requests.noneandHS*before key selection.kidrefresh, rate-limited byMinRefreshInterval.exp/nbf/iatwith clock skew,iss,aud, scopes (scopeorscp), andazp/client_id.Authorizationand stores verified claims in the request context.docs/dev/zero-trust/00-index.md; 401s carryWWW-Authenticate.internal/imports, so it can be reused by an A2A adapter.Library choice:
github.com/lestrrat-go/jwx/v3v3.4.0 — one dependency instead of two, 30 added dependency edges vs 40 for jwt/v5 + keyfunc, and explicit control over cache refresh for the rate-limit requirement. Rationale is inpkg/inboundauth/doc.go.Test plan
make fmt lint testgo test -race ./pkg/inboundauth/— 34 middleware rows plus JWKS refresh, rate-limit, unavailable, and error-body testsgo list -deps ./pkg/inboundauth | grep docsclaw/internalprints nothingTestNoInternalImportsenforces the isolation check in CI🤖 Generated with Claude Code