Skip to content

Verify-or-error decode without JWKS, discovery issuer pinning - #96

Merged
kilork merged 3 commits into
masterfrom
fix-92-jwks-verification-issuer-pinning
Oct 4, 2026
Merged

kilork merged 3 commits into
masterfrom
fix-92-jwks-verification-issuer-pinning

Conversation

@kilork

@kilork kilork commented Aug 30, 2026 •

Copy link
Copy Markdown
Owner

Implements the first two findings of #92:

  1. Client::decode_token returns Ok for unverified tokens when client.jwks == None — replaced with a new Decode::MissingJwks error. Non-breaking in practice: validate_token/authenticate already failed afterwards at payload().
  2. discovered::discover now pins config.issuer to the requested issuer (OIDC Discovery 3.1.2.2) — exact match. Same check in UMA2 discovery.

Provider-specific non-compliance stays in provider features, like Microsoft's issuer-skipping microsoft::authenticate today: the {tenantid} template issuer is deliberately not special-cased in generic discovery. Multi-tenant Microsoft apps:

  • keep working through the microsoft feature (its validate_token skips the issuer check),
  • or assemble the client manually (fetch config yourself → Discovered::from) — the same path used for other non-compliant providers in Please move discovered::jwks to be a public API #88.

Follow-up for a proper Microsoft multi-tenant solution (issuer template vs tid claim instead of skipping the check entirely) is tracked in #70/#7.

Remaining item of #92: https enforcement for token/userinfo/introspection + per-client opt-out design — will follow in a stacked PR.

@kilork
kilork force-pushed the fix-92-jwks-verification-issuer-pinning branch from 91c719a to 435de63 Compare October 4, 2026 19:36
@kilork kilork self-assigned this Oct 4, 2026
kilork added 2 commits October 4, 2026 22:04
- Client::decode_token now returns a new Decode::MissingJwks error instead of
  silently returning Ok on an unverified token when no JWK set is configured
- discovered::discover validates that the issuer of the discovered provider
  configuration matches the requested issuer, per OIDC Discovery 3.1.2.2,
  with the Microsoft {tenantid} template accepted as a wildcard segment
- the same check is applied to UMA2 discovery

Contributes to #92
The generic discovery no longer accepts the Microsoft {tenantid} issuer
template: provider-specific non-compliance belongs in the provider
feature, like microsoft skipping issuer validation today. Generic
pinning is an exact match per OIDC Discovery 3.1.2.2.

Contributes to #92
@kilork
kilork force-pushed the fix-92-jwks-verification-issuer-pinning branch from 435de63 to 59847ee Compare October 4, 2026 20:04
@kilork
kilork merged commit a5cc6c0 into master Oct 4, 2026
2 checks passed
@kilork
kilork deleted the fix-92-jwks-verification-issuer-pinning branch October 4, 2026 20:43
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.

1 participant