Skip to content

fix: update OIDC hooks and clear traits for registration flow - #910

Open
giriparus wants to merge 1 commit into
canonical:mainfrom
giriparus:fix-squatting
Open

fix: update OIDC hooks and clear traits for registration flow#910
giriparus wants to merge 1 commit into
canonical:mainfrom
giriparus:fix-squatting

Conversation

@giriparus

Copy link
Copy Markdown

Description

  • Removes any traits directly passed in the POST call for registration flow.
  • Adds kratos native oidc hooks to prevent squatting as used in the password flow.

Resolutions

@giriparus
giriparus requested a review from a team as a code owner June 22, 2026 16:55
Copilot AI review requested due to automatic review settings June 22, 2026 16:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Mitigates OIDC registration “squatting” in the Identity Platform Login UI by ensuring email/traits used during OIDC registration come from IdP-verified claims and by aligning Kratos OIDC post-registration hooks with the password flow.

Changes:

  • Drops any client-supplied traits when updating a Kratos registration flow using the oidc method.
  • Adds the show_verification_ui hook to Kratos’ registration.after.oidc.hooks (matching the password flow’s hooks).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/kratos/service.go Clears UpdateRegistrationFlowWithOidcMethod.Traits during parsing to prevent client-provided traits from overriding IdP claims.
docker/kratos/kratos.yml Adds show_verification_ui to OIDC registration “after” hooks to mirror password registration behavior.

Comment thread pkg/kratos/service.go
Comment on lines 999 to 1009
case "oidc":
var body kClient.UpdateRegistrationFlowWithOidcMethod
if err := parseBody(r.Body, &body); err != nil {
return nil, err
}
// Traits for OIDC registration must come from IdP-verified claims
// (docker/kratos/schema.jsonnet), never from client input. Without this,
// the identifier-first email (xxx@email.com) overrides the provider email
// (yyy@gmail.com) and the account registers under an unproven address.
body.Traits = nil
ret = kClient.UpdateRegistrationFlowWithOidcMethodAsUpdateRegistrationFlowBody(&body)
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.

Squatting is possible with OIDC sign in registration

2 participants