Supabase leaked password protection: where to enable it
#supabase#auth#passwords#security
Supabase's leaked password protection is in the Dashboard under Authentication → Sign In / Providers → Email: open the Email provider, switch on "Prevent use of leaked passwords" and click Save. It needs the Pro plan or above, and once it's on, Supabase Auth rejects any new password found in HaveIBeenPwned's breach data, which clears the Security Advisor's "Leaked Password Protection Disabled" warning.
Shortcut: in the Security Advisor, open the "Leaked Password Protection Disabled" warning and click View settings. It takes you straight to that Email panel.
The warning doesn't mean anything has leaked from your project. It means Supabase isn't yet refusing passwords that are already circulating in breach dumps, so a user can sign up with password123 and it gets accepted. If the Security Advisor, Lovable, Bolt or another AI builder flagged it, the fix takes a couple of minutes.
Where is leaked password protection in Supabase?
There is no "Passwords" page in the Authentication menu, which is why it's easy to miss. The switch lives inside the Email provider's settings:
- Open your project in the Supabase Dashboard and click Authentication in the sidebar.
- Under Configuration, click Sign In / Providers.
- In the Auth Providers list, click Email. A settings panel opens.
- Turn on Prevent use of leaked passwords. It sits just above Minimum password length.
- Click Save.
You can also go straight there: supabase.com/dashboard/project/_/auth/providers?provider=Email opens the same panel once you pick your project. It's the link Supabase's password security docs use for these settings.
You may also see the setting listed under Authentication → Attack Protection. That page only shows its status (Enabled or Disabled) next to a Configure in email provider button. The actual switch is the one in the Email panel.
To confirm the fix, open the Security Advisor and click Rerun linter. The warning should be gone. If other warnings are still listed, every Supabase Security Advisor warning is explained here, each with its lint number, level and fix.
Why is "Prevent use of leaked passwords" greyed out?
Two reasons, most likely first:
- Your project is on the Free plan. Supabase lists leaked password protection as available on the Pro plan and above. On Free the switch is disabled and its description adds "Only available on Pro plan and above." There's no dashboard workaround, so the advisor warning stays until you upgrade. In the meantime, set the minimum length and required characters below; those aren't plan-gated.
- Your role can't change auth settings. Supabase's Developer and Read-Only organization roles can view auth settings but not update them, so every field in the panel is locked. Ask an Owner or Administrator.
What it checks, and how (HaveIBeenPwned k-anonymity)
With the setting on, Supabase Auth checks a password against HaveIBeenPwned's Pwned Passwords API whenever one is set: at sign-up, on a password change through updateUser(), and when you create or update a user's password through the admin API. A match is rejected.
The password itself never goes to HaveIBeenPwned. Supabase's open-source client, supabase/hibp, uses HaveIBeenPwned's k-anonymity range API:
- Supabase Auth hashes the password with SHA-1.
- It sends only the first 5 characters of that hash to
api.pwnedpasswords.com/range/<prefix>. - HaveIBeenPwned returns every breached hash that starts with that prefix, and Auth looks for a match on its own side.
HaveIBeenPwned learns a 5-character prefix shared by a large number of unrelated passwords, nothing more. The full password and the full hash stay with Supabase Auth.
Why it's worth having: there are hundreds of millions of known leaked passwords, and attackers replay them against new sites (credential stuffing), betting that people reuse passwords. Refusing them at sign-up closes that door early. It pairs with not telling attackers which addresses have accounts, which is why Supabase stays quiet when you sign up with an existing email.
"Password is known to be weak and easy to guess": what it means
Turning the setting on changes what signUp() and updateUser() can return, so update your form's error handling at the same time. Auth responds with HTTP 422, error code weak_password, the message "Password is known to be weak and easy to guess, please choose a different one." and pwned in the reasons list. In supabase-js that arrives as an AuthWeakPasswordError:
import { isAuthWeakPasswordError } from '@supabase/supabase-js'
const { error } = await supabase.auth.signUp({ email, password })
if (isAuthWeakPasswordError(error) && error.reasons.includes('pwned')) {
// Show a specific message instead of a generic "sign-up failed"
setError('This password has appeared in a data breach. Please choose a different one.')
}
The same reasons array reports length or characters when a password fails your minimum length or required-character rules, so one check covers all three. If your users are hitting this error, here's what it means and how to word it in your form.
Does it check existing users' passwords?
It can't scan stored passwords, because Supabase only keeps bcrypt hashes of them, and it never locks anyone out. Existing users keep signing in as before. But when someone signs in with signInWithPassword(), Auth runs the same check, and if their password turns up in a breach the sign-in still succeeds with a weakPassword object in the response:
const { data, error } = await supabase.auth.signInWithPassword({ email, password })
if (data.weakPassword?.reasons.includes('pwned')) {
// Signed in, but this password is in a breach list: prompt a password change
}
That's your hook for nudging affected users to pick a new password. If those accounts have MFA enrolled, check that your reset page handles the AAL2 requirement that blocks the password change.
Other password settings in the same panel
While the Email panel is open:
- Minimum password length. Supabase accepts 6 as the lowest value, and its docs say anything under 8 isn't recommended. 10 to 12 is a sensible target.
- Password requirements. The default is "No required characters". The other options are "Letters and digits", "Lowercase, uppercase letters and digits", and "Lowercase, uppercase letters, digits and symbols (recommended)".
- Secure password change asks for reauthentication before a password change unless the user's session was created in the last 24 hours, and Require current password when updating makes users enter their old password. Both make a stolen session harder to turn into a stolen account.
Length plus the breach check does more than complexity rules alone.
Turning it on from code
If you manage project settings in scripts, the Supabase Management API exposes the same switch as password_hibp_enabled:
curl -X PATCH "https://api.supabase.com/v1/projects/$PROJECT_REF/config/auth" \
-H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"password_hibp_enabled": true, "password_min_length": 10}'
$SUPABASE_ACCESS_TOKEN is a personal access token from your Supabase account settings, and $PROJECT_REF is the ID in your project's dashboard URL.
What this does and doesn't cover
Enabling this closes one specific hole: users choosing already-breached passwords. It won't add MFA, it won't rate-limit login attempts, and it won't protect an account whose password leaks after sign-up. Treat it as one line item on a broader Next.js + Supabase security checklist, alongside RLS on every table, keeping the service_role key server-side, and MFA for sensitive accounts. It's also the easiest item on that list to check off.
The other Security Advisor warnings
Leaked password protection is an Auth setting. Most of the other Security Advisor warnings check your database, and these five are the ones that let callers reach data or code they shouldn't:
- Security Definer View. A view runs as its owner and skips the RLS of the tables under it. The 1-line SQL fix.
- Function Search Path Mutable. A function has no pinned
search_path. What it means and how to fix it. - Public Can Execute SECURITY DEFINER Function. Anyone with your publishable key can call the function over RPC. Which grants to revoke.
- RLS Disabled in Public. Anyone with your publishable key can read the table. What it exposes and how to fix it.
- Anonymous sign-ins enabled. Anonymous users get the
authenticatedrole, so check your policies. How anonymous sign-ins work.
Every lint, with its number, level and fix, is in the Security Advisor guide. For the bigger picture, see what's actually safe and what's on you in Supabase, and the checklist for vibe-coded SaaS apps if an AI builder generated your project.
Where GuardLayer fits (and where it doesn't)
Leaked password protection is a setting in your Supabase dashboard, so GuardLayer's repo scanner can't see it: it reads your code, not your project settings. The Live check can. Connect your project read-only and it tells you whether the switch is off, next to the tables anyone with your publishable key can read. Supabase's own Security Advisor raises the same warning.
What GuardLayer does check is the code side of the same pre-launch pass: a service-role key reaching the browser, tables shipped without Row Level Security, policies that aren't scoped to the current user, and API routes that pass request input to a dangerous sink. The Live check is free and never reads your rows. To try the database rules without connecting anything, paste a migration into the free Supabase security checker. Your SQL is never stored. To check a whole repo, run a free scan.
FAQ
Where is leaked password protection in Supabase? In the Dashboard under Authentication → Sign In / Providers → Email. Open the Email provider and the "Prevent use of leaked passwords" switch is just above "Minimum password length." There is no separate Passwords page.
How do I enable leaked password protection in Supabase? Go to Authentication → Sign In / Providers, click Email, turn on "Prevent use of leaked passwords" and click Save. Then click Rerun linter in the Security Advisor to clear the warning.
What does "Leaked Password Protection Disabled" mean? It's a Supabase Security Advisor warning that your project accepts passwords found in known data breaches. Nothing has leaked from your project; the breach check just isn't switched on.
Is leaked password protection free in Supabase? No. Supabase lists it as available on the Pro plan and above, and on Free the switch is greyed out. Minimum password length and required characters work on every plan.
Does Supabase send my users' passwords to HaveIBeenPwned? No. Supabase Auth sends only the first 5 characters of the password's SHA-1 hash to HaveIBeenPwned's range API and checks the returned list itself. The password and its full hash are never sent.
What error does signUp() return for a leaked password?
A weak_password error (HTTP 422) with the message "Password is known to be weak and easy to guess, please choose a different one." and pwned in its reasons. In supabase-js, check for it with isAuthWeakPasswordError(error).
Does it check my existing users' passwords?
It doesn't lock anyone out. Existing users can still sign in, but signInWithPassword() returns a weakPassword object with the reason pwned when their password is in a breach, so you can prompt them to change it.
Check your Supabase Auth settings and tables, free
Connect your Supabase project read-only. GuardLayer checks your Auth settings (leaked passwords, email confirmation, secure email change, token rotation, CAPTCHA, MFA) and your RLS, policies and grants, and says how to fix each problem. It never reads your rows and can't change anything.
Check my Supabase projectPrefer to check code instead? Scan your repo, no signup.