feat(oauth2,jwks): allow callers to restrict outbound JWKS hosts - #33
Merged
Conversation
A client's `jwks_uri` is supplied by the client, and the authorization server fetches it while verifying `private_key_jwt` assertions and JAR request objects. Where dynamic client registration is enabled the value is chosen by the registrant, so a deployment should be able to say which hosts the server is willing to reach. `createRemoteJWKS` gains an `allowHost(hostname, url)` predicate, checked once at construction — the URI is fixed for the resolver's lifetime, so that covers every fetch it will make. `createServer` exposes it as `security.allowJwksHost` and threads it through both call sites. A refused URI surfaces as `invalid_client` rather than a transport error. Optional and unset by default; existing behaviour is unchanged. The oauth2 README recommends it alongside the registration config, which is where it matters most.
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.
Independent, but pairs with #32 — merge that one too.
A client's
jwks_uriis supplied by the client, and the authorization server fetches it while verifyingprivate_key_jwtassertions and JAR request objects. Where dynamic client registration is enabled, the value is chosen by whoever registered, so a deployment should be able to say which hosts the server is willing to reach.createRemoteJWKSgains anallowHost(hostname, url)predicate, checked once at construction — the URI is fixed for the resolver's lifetime, so that covers every fetch it will make.createServerexposes it assecurity.allowJwksHostand threads it through both call sites.invalid_client, not a transport error.Optional and unset by default, so existing behaviour is unchanged. The oauth2 README recommends it alongside the registration config, which is where it matters most.
Minor rather than patch, since it adds config surface to two packages.