Skip to content

fix(oidc): verify userinfo sub matches the ID Token sub#4828

Open
kanywst wants to merge 1 commit into
dexidp:masterfrom
kanywst:fix/oidc-userinfo-sub-verification
Open

fix(oidc): verify userinfo sub matches the ID Token sub#4828
kanywst wants to merge 1 commit into
dexidp:masterfrom
kanywst:fix/oidc-userinfo-sub-verification

Conversation

@kanywst

@kanywst kanywst commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Overview

Verify the userinfo sub against the ID Token sub in the OIDC connector, as required by OpenID Connect Core 5.3.2.

What this PR does / why we need it

With getUserInfo: true, createIdentity merged the userinfo response into the verified ID Token claims and read sub from the result, so a userinfo sub that differed from the ID Token sub silently became the subject (Identity.UserID). OpenID Connect Core 5.3.2 requires the two to match.

This keeps the ID Token sub before the userinfo merge and returns an error on mismatch. When there is no ID Token (the access-token token exchange, where userinfo is itself the verification) the check is skipped, so that path is unchanged.

Closes #4827

Special notes for your reviewer

createIdentity merged the userinfo response into the verified ID Token claims and read sub from the result, so a userinfo sub that differed from the ID Token sub became the subject. OpenID Connect Core 5.3.2 requires the two to match. Keep the ID Token sub before the merge and error on mismatch; skip the check when there is no ID Token (access-token token exchange).

Signed-off-by: kanywst <niwatakuma@icloud.com>
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.

connector(oidc): userinfo sub is not verified against the ID Token sub

1 participant