Conversation
A UserInfo profile is used only when its sub matches the ID token's; a supplied ID token that does not decode or carries no sub is declined instead of being treated as absent; sub and email count only as non-empty strings; and emailVerified is a boolean on both paths, true only for a literal true claim. The rejection test builds a fresh discovery response per case and creates its rejections only when fetch is called, and asserts the number of requests each case makes.
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.
Summary
A thin OIDC ID token can omit
email_verified, which the self-hosted SSO callback needs.ssoProviderConfignow suppliesgetUserInfo, so the claim is read from the provider's UserInfo endpoint when the token lacks it.The resolver treats the IdP as an external boundary throughout:
submatches the ID token'ssub; a profile for another subject returnsnull.sub, is declined. Only an absent ID token is resolved through UserInfo alone.subandemailcount only as non-empty strings, on both paths.emailVerifiedis always a boolean:trueonly for a literaltrueclaim. An explicitfalseornullin the ID token is honoured without a UserInfo lookup, as an unverified email.nullthe same way a non-OK response already did, instead of rejecting the callback.Linked issue
Fixes #1972
Verification
apps/host-selfhost/src/auth/sso-userinfo.test.ts: 22 cases, run withbun run testinapps/host-selfhost(22 passed). They cover the thin-token UserInfo path, the subject mismatch, declined malformed and subject-less tokens, wrongly typed claims, empty subject / email / access token /userinfo_endpoint, the four rejection points (each with a fresh response and an asserted request count), and admission at the gate.oxlint --deny-warningsandoxfmt --checkare clean on the touched files.