ash_authentication 4.14: store OIDC user identities instead of matching users by email #564
Labels
No labels
bug
duplicate
enhancement
help wanted
high priority
invalid
L
low priority
M
medium priority
needs refinement
optional
question
S
security
technical improvement
UX Improvement
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
local-it/mitgliederverwaltung#564
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
GHSA-777c-2fxx-qr28 (severity: critical) — AshAuthentication is vulnerable to
OAuth2/OIDC account takeover via email-based user matching. Only the provider's
iss/subclaim combination identifies an end-user uniquely and stably; matchinga local user by the email address the provider reports is unsafe.
We are genuinely affected, not merely running an outdated version: the
:oidcstrategy has no
identity_resource, so a successful OIDC login is resolved againstthe local user's email address.
The advisory is currently suppressed in
.deps_audit_ignoreso that it does notblock unrelated pull requests. That suppression is the reason this issue exists and
must be removed as part of it.
Current state
lib/accounts/user.ex—oidc :oidc doblock has noidentity_resourceand notrust_email_verified?; there is no confirmation add-on on the email field.UserIdentityresource and nouser_identitiestable exist in the project.mix.exspins{:ash_authentication, "~> 4.13.0"}. The first patched version is4.14.0, so the constraint has to move.identity_resourceand the untrusted
email_verifiedclaim. Both failmix compile --warnings-as-errors,which is why the dependency cannot simply be bumped — this is the actual work.
exactly this reason and will keep failing until this issue is done.
Scope
mix.exsconstraint to{:ash_authentication, "~> 4.14"}and updatemix.lock.mix ash_authentication.upgradecreates theresource and the migration) and wire
identity_resourceinto the:oidcstrategy.email_verifiedhandling — either a confirmation add-onmonitoring the
:emailfield, ortrust_email_verified? trueif the IdP is trustedto assert email ownership. See open questions.
no identity row. Determine what happens on their first login afterwards and add a
data migration or backfill if needed.
GHSA-777c-2fxx-qr28entry (and its comment block) from.deps_audit_ignore.Open questions
identity_resourceconfigured, what does AshAuthentication 4.14do on the first login of a user who has no
user_identitiesrow — link the existing user,create a duplicate, or reject? This determines whether step 4 is a one-line backfill or a
careful migration, and getting it wrong locks every existing member out of SSO. Verify
against the 4.14 source, not just the changelog.
email_verified? If yes,trust_email_verified? trueis the smaller change; if not, we need the confirmation add-on,which introduces an email round-trip into the SSO flow.
subvalues have to come from the IdP. Can wederive them from Rauthy, or does the first post-upgrade login have to establish them?
Acceptance criteria
just ciis green with noGHSA-777c-2fxx-qr28entry in.deps_audit_ignore.the same
Memberrecord.that user's account.
iss/subpair is already known resolves to the same local user.mix deps.audit --ignore-file .deps_audit_ignorereports no findings.see #557