[auth] Harden OIDC SSO (PKCE, email_verified, userinfo fallback)#1112
Merged
Conversation
- Enable PKCE (code_challenge_method=S256); the redirect previously advertised PKCE but the client only requested scopes - Add OIDC_REQUIRE_EMAIL_VERIFIED (default true): require an explicit email_verified == true claim before linking/provisioning by email, closing an account-takeover vector; flag off restores the permissive absent-claim-trusted behaviour - Catch token-exchange failures in the callback and return 400 instead of a bare 500 - Document OIDC_REQUIRE_EMAIL_VERIFIED; extend tests for both verification modes and the token-exchange failure path Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Some providers (notably Azure AD/Entra ID) omit given_name/family_name from the ID token and only expose them on the userinfo endpoint. Fetch it as a best-effort fallback when the token carried no usable name claims. The call is skipped entirely for providers that already include the names, and a failure only logs and proceeds so an otherwise valid login is never blocked. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
email_verifiedclaim, allowing account takeover via providers that permit unverified emailsSolution
code_challenge_method=S256)OIDC_REQUIRE_EMAIL_VERIFIED(default true): require an explicit verified claim before linking/provisioning; flag off restores the permissive behaviour