Repository navigation
feat(client): refuse an issuer key source bound to another issuer - #994
Merged
Merged
Conversation
A JWKSIssuerKeySource built WithIssuer, and every LocalIssuerKeys, refuses lookups for any issuer but its own, but nothing outside the source could see that binding. A verifier wired by hand to a source bound to a different issuer only found out when every verification failed at runtime. Add the optional IssuerBound interface, whose BoundIssuer returns the issuer a source serves exclusively, or "" when it serves any. JWKSIssuerKeySource reports the WithIssuer issuer (or ""), and LocalIssuerKeys always reports its own, so the verifiers built on them can check the binding at construction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Dependencies.IssuerKeys source bound to an issuer other than Config.Issuer (a keys.LocalIssuerKeys, or a keys.JWKSIssuerKeySource built WithIssuer) refuses every key lookup the client makes, so the client built fine and then failed every JARM, ID token and signed UserInfo verification. New now checks a source implementing keys.IssuerBound and refuses one whose bound issuer isn't exactly Config.Issuer, naming both issuers. An unbound source, or one not implementing the interface, is accepted as before. Dependencies.IssuerKeys now also says that a source shared between clients of different issuers must be bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A JWTAccessTokens whose IssuerKeys is bound to an issuer other than its Issuer (a keys.LocalIssuerKeys, or a keys.JWKSIssuerKeySource built WithIssuer) refuses every key lookup, so the verifier built fine and then answered every request with a key-resolution failure. JWTAccessTokens' validation, run by NewJWTAccessTokens and by NewVerifier for a literal, now refuses a source implementing keys.IssuerBound whose bound issuer isn't exactly Issuer, naming both issuers. An unbound source, or one not implementing the interface, is accepted as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
client.New and resource's JWTAccessTokens validation now refuse an issuer key source bound to a different issuer. Only a configuration that already failed every verification is affected; document what the error looks like and how to fix the wiring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cover client.New's and JWTAccessTokens' refusal of an issuer key source bound to another issuer, their acceptance of an unbound one, and the BoundIssuer reports of JWKSIssuerKeySource and LocalIssuerKeys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It ships after 0.86.0, and as a feature it makes that release 0.87.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
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.



The audit's E-9 hypothesis is a key source shared between clients for different issuers. #989 refuted it as an exploit, but it left a misconfiguration open: an issuer key source bound to one issuer could be given to a client or resource server for another. This change refuses that at construction. Sources that aren't bound to an issuer are still accepted, so it isn't breaking.
feat(keys):IssuerBoundkeys.IssuerBoundis a new optional interface. Its single method,BoundIssuer() string, returns "" when the source isn't bound to one issuer.JWKSIssuerKeySource: reports the issuer given withWithIssuer, or "" without it.LocalIssuerKeys: always reports its own issuer.BoundIssuer, as withKeySourceAssurance.feat(client)andfeat(resource): refuse a source bound to another issuerClient:
client.Newnow refusesDependencies.IssuerKeysthat report a bound issuer other thancfg.Issuer. The comparison is the exact one the client uses for everyisscheck, and the error names both issuers.NewFromDiscoverygoes throughNewand binds its source to the discovered issuer, so it always matches.Resource:
resource.JWTAccessTokensgets the same check against itsIssuer, throughNewJWTAccessTokensandNewVerifier.serverresource.NewVerifierbuildsLocalIssuerKeysfrom the same issuer, so it always matches.Such a source could never have validated the configured issuer's own tokens, so this only moves the failure from every verification to construction. UPGRADING.md has a note under v0.87.0.
Not covered:
resource.AccessTokenAssurance.IssuerKeys, which a custom resolver declares, has no issuer beside it to compare against.Tests
LocalIssuerKeys, plus a trailing-slash variant. They fail when the check is replaced withreturn nil.Nothing on the wire changes.
🤖 Generated with Claude Code