Skip to content

feat(oauth2,jwks): allow callers to restrict outbound JWKS hosts - #33

Merged
ExorTek merged 1 commit into
masterfrom
fix/oauth2-jwks-host-policy
Aug 6, 2026
Merged

feat(oauth2,jwks): allow callers to restrict outbound JWKS hosts#33
ExorTek merged 1 commit into
masterfrom
fix/oauth2-jwks-host-policy

Conversation

@ExorTek

@ExorTek ExorTek commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Independent, but pairs with #32 — merge that one too.

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 whoever registered, 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, 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.

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.
Copilot AI lite review requested due to automatic review settings August 6, 2026 09:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ExorTek
ExorTek merged commit b4dab8a into master Aug 6, 2026
3 checks passed
@ExorTek
ExorTek deleted the fix/oauth2-jwks-host-policy branch August 6, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants