Repository navigation
fix(auth): GitHub scopes, name before login, Entra verified email - #496
Merged
Merged
Conversation
- Default scopes for provider github are read:user,user:email (GitHub is not OIDC); others keep openid,email,profile. - Profile name prefers the full name, then the login. - ID token from the token endpoint fills what userinfo lacks: email_verified, hd, and Entra's xms_edov (verified email domain). Checked: audience = client ID, issuer = discovery issuer, sub = userinfo sub; otherwise ignored.
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
Found in the live SSO check (Keycloak, Dex, Authentik):
AUTH_SCOPES=openid,email,profileare not GitHub scopes./user/emailsis refused, so a user with a hidden email has no email and an allow-list refuses them.preferred_username/nickname) even when the provider sends a fullname: Keycloak showsann, not «Ann Acme».email_verified, so with an allow-list nobody gets in.Change
auth.DefaultScopes(provider):read:user,user:emailforgithub,openid,email,profilefor the others; used whenAUTH_SCOPESis not set.buggregator.yaml.exampleno longer hard-codes the OIDC default in${AUTH_SCOPES:…}.name, thenpreferred_username,nickname,login(GitHub:name, thenlogin).emailalone: the ID token returned by the token endpoint is read for what userinfo lacks:email_verified,hd, and Entra's optional claimxms_edov(the tenant verified the email's domain). Withxms_edovtrue the email counts as verified. Without it, behaviour is as before: the allow-list refuses, fail-closed. The admin addsxms_edovunder App registration → Token configuration → Optional claims → ID.aud= client ID,iss= discovery issuer andsub= userinfosub; a token that fails any of these is ignored.email_verified: falsethere is not overridden.Verification
TestExchange_IDTokenClaims: Entra with/withoutxms_edov(bool and"1"), no ID token, wrong audience/issuer/subject ignored,email_verified+hdfrom the ID token, userinfofalsekept; each case also through the allow-list.TestMapUser_NameBeforeLogin,TestDefaultScopes.go vet ./...clean;go test -count=1 ./...green.Made with harnsy