Short answer
If your login, sign-up or password reset form answers differently for registered and unknown email addresses, anyone can find out who uses your app, one address at a time. Supabase’s reset call already hides this, but custom pre-checks and friendly error messages often bring it back. Give the same answer for every address, keep email confirmation on, and rely on rate limits and CAPTCHA to slow down mass checks.
Ask an AI about this page:ChatGPTClaude
On this page
Email enumeration means your app tells strangers whether an address has an account. It happens when the login, sign-up or password reset form gives a different answer for a registered address than for an unknown one: “No account with this email”, “This email is already registered”, a different status code, or a noticeably slower reply. It is rated low because nobody gets into an account this way, but it hands out a list of your users, which makes phishing and password guessing far more targeted.
Why it matters
OWASP’s Authentication Cheat Sheet asks for a generic answer on login, password reset and recovery, whether the password was wrong, the account doesn’t exist or it is locked, and suggests the same for registration. The goal is to avoid what MITRE calls an observable response discrepancy (CWE-204): any difference an outsider can see. The cheat sheet lists three kinds:
- Different messages, the obvious one.
- Different status codes, even when the page looks the same.
- Different timing, when the app exits early for unknown users and does more work for real ones.
Supabase Auth gets the basics right. Its password docs say resetPasswordForEmail() doesn’t reveal whether an account exists. The leaks usually come from code around it. AI-generated sign-up forms often add a “friendly” pre-check:
// Asks the database whether the address is taken, then says so.
const { data } = await supabase.from("profiles").select("id").eq("email", email).maybeSingle();
if (data) return setError("This email is already registered. Log in instead.");That check only works if profiles is readable before sign-in, which is a bigger problem than the message itself. Other common versions: showing Supabase’s raw error text on the reset form, or a custom “does this email exist?” endpoint.
Supabase’s sign-up behaviour also depends on settings. Its client reference says that for an existing confirmed user, signUp() returns an obfuscated user object only when both Confirm email and Confirm phone are enabled; otherwise it returns the error “User already registered”.
How to find it in your app
Search your code for messages and checks that depend on whether an account exists:
grep -rniE "already (registered|exists|in use)|no account|not found|user does not exist|email.*taken" src app 2>/dev/null
grep -rnE "from\(\"(profiles|users)\"\).*eq\(\"email\"" src app 2>/dev/null
grep -rn "error.message" src app 2>/dev/null | grep -iE "reset|signup|sign-up|login|auth"Then compare answers on your own app. Use your test account’s address and an address you know isn’t registered (for example nobody@your-app.example) on the sign-up form and the reset form. Watch the visible message, the status code in the browser’s Network tab, and how long each request takes. Any difference is the defect.
Also check Authentication → Providers → Email in Supabase: if Confirm email is off, new sign-ups are signed in at once and existing addresses get an error, which can’t be made to look the same.
How to fix it
Answer the same way on the reset form. Show one message for every address and only treat real failures differently:
const SENT = "If an account exists for this address, we have sent you an email.";
export async function requestReset(email: string): Promise<string> {
const { error } = await supabase.auth.resetPasswordForEmail(email, {
redirectTo: "https://your-app.example/update-password",
});
// Same message whether or not the address is registered; only real failures differ.
if (error?.status === 429) return "Too many requests. Please try again in a few minutes.";
return SENT;
}Answer the same way on sign-up. Remove database pre-checks for existing addresses, turn on Confirm email and Confirm phone so Supabase itself answers the same way (see above), and show one message after signUp():
export async function register(email: string, password: string): Promise<string> {
const { error } = await supabase.auth.signUp({
email,
password,
options: { emailRedirectTo: "https://your-app.example/auth/confirm" },
});
if (error?.status === 429) return "Too many attempts. Please try again in a few minutes.";
if (error && error.code === "weak_password") return error.message;
// New or existing address: the same answer.
return "Check your inbox to finish signing up. Already have an account? Log in or reset your password.";
}Keep login generic. Show “Email or password is wrong” for every failed login, and never look the address up yourself first.
Slow down mass checks. Where a specific message is worth keeping, OWASP suggests protection against automated attacks instead. Supabase rate-limits auth endpoints per IP and supports CAPTCHA; see no rate limit on login and AI endpoints.
Review the sign-up, login and password reset flows. Remove any code that checks whether an email is already registered before calling Supabase Auth (for example queries on profiles or users by email, or custom endpoints that answer whether an email exists). After resetPasswordForEmail, always show “If an account exists for this address, we have sent you an email.” After signUp, show one neutral message for new and existing addresses. After a failed signInWithPassword, show “Email or password is wrong”. Only show different messages for rate limits (status 429) and password rules.
Do not display raw Supabase error messages on these forms. Do not change database policies in this task; list any table that exposes email addresses to signed-out users so I can fix it separately.
Check that the fix works
- On your own app, submit the reset form with your test account’s address and with
nobody@your-app.example. The message must be identical. - Do the same on the sign-up form. The message must match. If the response in the Network tab is still an error only for the registered address, check that both confirmation settings are on.
- Try a wrong password for the test account and for the unknown address on the login form. Both must show the same error.
- Search the code once more: no form may display
error.messagefrom Supabase Auth directly.
Frequently asked questions
Isn’t ‘this email is already registered’ just good UX?
It is friendlier, and OWASP’s Authentication Cheat Sheet acknowledges that trade-off. For most apps a neutral message plus a clear ‘log in or reset your password’ link costs little. If you keep the specific message, protect the form with rate limits and CAPTCHA so it can’t be used at scale.
Does Supabase Auth leak whether an account exists?
The reset call doesn’t: Supabase’s docs say resetPasswordForEmail doesn’t reveal whether an account exists. For sign-up it depends on your settings; the client reference says you get an obfuscated user only when both Confirm email and Confirm phone are enabled, otherwise the error ‘User already registered’.
Why is this only rated low?
Knowing that an address has an account doesn’t give access to it. It does make targeted phishing and password guessing easier, and for some apps the membership itself is sensitive, for example a health or dating app. Rate it higher in that case.
Sources
- 1.Authentication Cheat Sheet — OWASP Cheat Sheet Series
- 2.Forgot Password Cheat Sheet — OWASP Cheat Sheet Series
- 3.Password-based Auth — Supabase Docs
- 4.JavaScript: Sign up a new user — Supabase Docs
- 5.CWE-204: Observable Response Discrepancy — MITRE