fix(auth): signup no longer falsely says "already registered"#12
Merged
Conversation
With email confirmation enabled, Supabase returns an IDENTICAL response for a
brand-new email and an already-registered one (no error, no session, null user
via supabase-js) — by design, to prevent email enumeration. The previous
heuristic treated that null-user/no-session shape as "already registered" and
409'd EVERY signup, even though the confirmation email was actually sent.
Remove the impossible detection: when signUp succeeds with no session, just
report needsEmailConfirmation (the signup page already shows "check your email").
A returned session still signs the user in immediately.
Verified against the live project: a fresh email and an existing one both return
{ user: null, session: null, error: null } via supabase-js.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signup returned "This email is already registered" for every email, including brand-new ones.
Cause
With email confirmation on, Supabase deliberately returns an identical response for new and existing emails (no error, no session,
user: nullvia supabase-js) to prevent email enumeration. The route's heuristic treated that shape as "already registered" and 409'd every signup — while the confirmation email was actually being sent (hence users still got the email).Fix
Drop the impossible new-vs-existing detection. On a successful
signUpwith no session, returnneedsEmailConfirmation: true(the signup page already shows "Check your email to confirm"). A present session still logs the user in immediately.Verified against the live Supabase project: both a fresh email and
anthony@profullstack.comreturn{ user: null, session: null, error: null }.🤖 Generated with Claude Code