OIDC: a sign-in with an unverified email pre-creates an account a later verified sign-in links to #83

Closed
opened 2026-11-13 00:56:29 +00:00 by jfro · 0 comments
Owner

Found in the v1.6.1 audit (below high; older than v1.6.0).

In lib/rm_analyzer/accounts.ex, user_for_new_identity/2: when no user has the claim's email, the nil branch creates a confirmed user (confirmed_at: now) for that address without checking email_verified. The existing-user branch does require email_verified == true, so a later verified sign-in (different sub) with the same email is linked to the user the unverified sign-in created. Whoever made that first sign-in then shares the account.

Only matters on a multi-user install whose IdP lets people sign in with an email they haven't verified.

Fix constraints:

  • First sign-in for IdPs that omit email_verified must keep working.
  • A user created from an unverified or missing claim isn't linkable: a later different identity with that email is refused, not linked. Linking stays allowed only to users whose email was verified or who registered another way.
  • Test: unverified sign-in A creates a user; verified sign-in B (different sub, same email) must not get A's user.
Found in the v1.6.1 audit (below high; older than v1.6.0). In `lib/rm_analyzer/accounts.ex`, `user_for_new_identity/2`: when no user has the claim's email, the `nil` branch creates a confirmed user (`confirmed_at: now`) for that address without checking `email_verified`. The existing-user branch does require `email_verified == true`, so a later **verified** sign-in (different `sub`) with the same email is linked to the user the unverified sign-in created. Whoever made that first sign-in then shares the account. Only matters on a multi-user install whose IdP lets people sign in with an email they haven't verified. Fix constraints: - First sign-in for IdPs that omit `email_verified` must keep working. - A user created from an unverified or missing claim isn't linkable: a later different identity with that email is refused, not linked. Linking stays allowed only to users whose email was verified or who registered another way. - Test: unverified sign-in A creates a user; verified sign-in B (different sub, same email) must not get A's user.
jfro added this to the v1.6.1 milestone 2026-11-13 00:56:29 +00:00
jfro closed this issue 2026-11-13 11:41:20 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfro/rm-analyzer#83
No description provided.