Skip to content

fix: remove allowDangerousEmailAccountLinking (pre-registration account linking) - #377

Open
vedant7007 wants to merge 1 commit into
TravellersMeet:mainfrom
vedant7007:fix/remove-dangerous-email-linking
Open

fix: remove allowDangerousEmailAccountLinking (pre-registration account linking)#377
vedant7007 wants to merge 1 commit into
TravellersMeet:mainfrom
vedant7007:fix/remove-dangerous-email-linking

Conversation

@vedant7007

Copy link
Copy Markdown
Contributor

Closes #370

Problem

src/lib/auth.ts set allowDangerousEmailAccountLinking: true on the Google provider. An attacker could POST /api/auth/signup with a victims email before the victim first uses Google sign-in, creating a credentials user row with the attackers password. When the victim later signs in with Google for that email, the flag links the Google identity to the attacker-created row instead of refusing — the account then carries the attackers credentials alongside the victims OAuth login.

Fix

Remove the flag (defaults to false), so NextAuth will not auto-link a provider to an existing account by (unverified) email.

Testing

  • npx tsc --noEmit clean on the changed file.

Contributing as part of Elite Coders Summer of Code (ECSoC 2026).

The flag let a Google sign-in link to a pre-existing credentials account
with the same email, so an attacker could POST /api/auth/signup with a
victim's email first and have the victim's later Google login link to the
attacker-created (attacker-password) row. Drop the flag (defaults to false)
so NextAuth won't auto-link across providers by unverified email.

Fixes TravellersMeet#370
@github-actions

Copy link
Copy Markdown

Thanks for opening this PR, @vedant7007! 👋

Our maintainers will review it shortly. Estimate Time is 5-8 hrs .Meanwhile please:

  • Ensure CI is green (lint, typecheck, build).
  • Hit the star ⭐ button to show your support!
  • Confirm the PR template checklist is complete.
  • Add screenshots for UI changes.

If anything changes, feel free to push updates—this thread will stay open.

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.

[Security] allowDangerousEmailAccountLinking enables pre-registration account linking

1 participant