Repository navigation
feat: validate the issuer and cache signing keys in the OIDC provider - #241
Merged
Merged
Conversation
The PKCE provider never passed an expected issuer to the token decode. Microsoft Entra ID signs every tenant's tokens from a shared key set, so a tenant-scoped JWKS URL isolates nothing and the audience check only holds while an app registration stays single-tenant. It also refetched the key set on every authenticated request, and reached an unguarded b64decode, json.loads and requests.get, so a bearer token that was not a JWT returned an unauthenticated 500.
Codecov Report❌ Patch coverage is
📢 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 PKCE provider never validated
iss, and Entra ID signs every tenant's tokens from a shared key set — so a tenant-scoped JWKS URL isolated nothing andaudonly held while an app registration stayed single-tenant. It also refetched the JWKS on every authenticated request, and returned an unauthenticated 500 for any bearer token that was not a JWT.Adds issuer validation, a JWKS cache that refreshes on an unknown
kid, requiredexp/aud, clock-skew leeway, and 401s on every malformed-credential path. No new provider, no new dependency, no frontend change — Entra is configuration.Operators: set
DISPATCH_AUTHENTICATION_PROVIDER_PKCE_ISSUER(a startup warning fires if unset).DISPATCH_PKCE_DONT_VERIFY_AT_HASHnow rejects non-boolean values at startup instead of treating them as true —=falsepreviously disabled the check. Seedocs/docs/administration/settings/authentication-entra-id.mdx.