Lovable Leaked Password Protection: Turn It On in Supabase
Lovable apps use Supabase auth. Supabase can block passwords that appear in known breach corpora - but it's off by default. Here's the 2-minute fix.
Seeing a rejected password rather than configuring protection? Read how to fix the Supabase weak-password error.
What Changes for Lovable Apps
Lovable’s default Supabase auth ships without leaked-password protection. A user can sign up with password123, qwerty, or a password reused from a breached service. Attackers replay credentials from public dumps instead of guessing.
Lovable gets auth working in the preview: the Supabase project is created, the email provider is on, and the AI wires signUp / signInWithPassword. The toggles that live only in the Supabase dashboard (leaked passwords, minimum length, confirm email) get skipped because the generated UI never mentions them. This page covers that step.
What credential stuffing looks like
Credential stuffing is a botnet running through a CSV:
- The attacker downloads or buys a “combo list” of
email:passwordpairs scraped from earlier breaches (LinkedIn 2012, Adobe 2013, Collection #1, RockYou2024). - The botnet hits your
/auth/v1/tokenendpoint from rotating IPs at low volume per IP. - Every user who reused a leaked password is compromised.
- Compromised accounts are sold or used directly for fraud.
Stronger password rules don’t help, because users still reuse. The fix is to refuse passwords that are already in the lists. HaveIBeenPwned’s k-anonymity API does that, and Supabase’s leaked-password setting wires it up for you.
Stuffing is worse when RLS is also weak. A stuffed account that can select * every row through a bad policy is a full data breach. Enable leaked-password protection and still run the Supabase RLS Checker.
The Fix
- Open the Supabase dashboard for your Lovable project
- Navigate to Authentication → Policies (or Providers → Email)
- Find “Password policy” or “Leaked password protection”
- Toggle Enable leaked password protection on
- Save
- (Optional) Set minimum password length (recommend 10+)
Every new signup and password change is now checked against HaveIBeenPwned at the API level.
If you manage Auth via config as code, also confirm the project you edited is the same project URL embedded in your Lovable app (VITE_SUPABASE_URL / NEXT_PUBLIC_SUPABASE_URL). Editing a leftover dev project leaves production unprotected.
How the check actually works (k-anonymity)
Supabase doesn’t send the password to HaveIBeenPwned:
- User submits a password at signup.
- Supabase computes the SHA-1 of the password locally.
- Supabase sends only the first 5 hex characters of the hash to HIBP’s range API:
GET https://api.pwnedpasswords.com/range/<5chars>. - HIBP returns ~500–1000 hash suffixes that share that prefix.
- Supabase checks locally whether the full hash is in the list. If yes, signup is rejected.
HIBP never sees the password or the full hash. The password goes only to your auth backend, as in any signup.
You do not need to call HIBP from your Lovable frontend. Client-side HIBP checks are optional UX. The dashboard toggle can’t be bypassed by skipping your React form.
What Happens at Signup
CLEAN PASSWORD
Accepted. User proceeds through signup normally.
LEAKED PASSWORD
Rejected with clear error: "Password found in known breach. Choose another."
WEAK BUT UNLEAKED
Accepted if it meets min length - length + leak check is the policy.
API ERROR
Signup fails safe. User sees retry prompt.
Verify the setting from the client
After enabling, confirm by attempting a signup with a known-leaked password (use password123 or qwerty):
import { createClient } from '@supabase/supabase-js';
const supabase = createClient(URL, ANON_KEY);
const { data, error } = await supabase.auth.signUp({
email: 'test+pwned@example.com',
password: 'password123',
});
console.log({ data, error });
// Expected: error.message includes "Password is known to be weak and easy to guess"
If the call succeeds, the toggle didn’t save (or you’re hitting a stale Supabase client). Re-check the dashboard and refresh.
Also test password change flows if your app has them:
const { error } = await supabase.auth.updateUser({ password: 'password123' });
// Expect failure once leaked-password protection is on
Custom error UX
Catch the default Supabase error and rewrite it for your users:
const { error } = await supabase.auth.signUp({ email, password });
if (error?.message?.toLowerCase().includes('weak')) {
showError(
'That password has appeared in known data breaches and isn\'t safe to reuse. ' +
'Try a unique password - a password manager helps.'
);
return;
}
Users who hit this are often confused because the password “worked everywhere else.” Lovable-generated UIs often show the raw API string in the error toast, so prompt the generator (or edit once) to map auth errors to friendly copy.
Pair With These Other Settings
Add these alongside the leaked-password check:
- Minimum password length: 10+ characters. Skip the “1 uppercase + 1 number + 1 symbol” rules.
- Require email verification: prevents bot signups and limits credential-stuffing damage to verified addresses.
- Rate limits on signup and password-reset: 5/minute/IP at the Edge Function or proxy layer. Supabase’s built-in limits are loose by default.
- Rate limits on
/auth/v1/token: the actual login endpoint - credential stuffing hits this, not signup. Add a Cloudflare rule or Edge Function in front. - Passkeys or OTP: offer passwordless alongside password. Passkey users can’t be credential-stuffed.
- MFA / TOTP: for higher-value accounts (admin, paid tier). Even a leaked password fails without the second factor.
- Anomaly notification: email the user on first login from a new device/IP. This doesn’t prevent compromise but shortens how long it goes unnoticed.
- Session lifetime: shorter refresh windows for apps with sensitive data; force re-auth for billing changes.
Cloudflare / edge sketch for token rate limits
# Conceptual - implement as WAF rate rule on
# POST https://<project>.supabase.co/auth/v1/token*
# e.g. 10 requests / minute / IP for grant_type=password
Without a rate limit in front, stuffing still finds common passwords (Summer2024!) that HIBP has not labeled.
What this guide does NOT cover
- Migrating existing weak passwords. Supabase only checks new passwords and password changes. Existing users keep their old passwords, and you can’t detect weak ones without re-checking on login. Send a one-time “we updated our password policy, please reset” email.
- Server-side credential stuffing detection. Attackers still try common passwords that are not in the leak list. Detect failed-login spikes and IP velocity with a log pipeline (Logflare, Datadog) and an alert rule. Supabase doesn’t ship this.
- OAuth / social-login accounts. Users who signed in with Google/GitHub never set a password in your system. Their security depends on the provider’s policies, not yours.
- Account-recovery social engineering. Abuse of “I forgot my password” flows is a separate hardening pass.
- Lovable share password. The preview gate is unrelated; see the comparison table below.
Site password vs account password (do not confuse them)
| Control | What it does | What it does not do |
|---|---|---|
| Lovable / host share password | Blocks casual visitors from a preview URL | Does not secure APIs, RLS, or production users |
| Supabase leaked password protection | Blocks breached passwords at signup/change | Does not fix missing RLS or open tables |
| Strong session + MFA | Hardens logged-in accounts | Does not stop anon key table dumps |
Attackers who only curl PostgREST ignore the Lovable share password entirely. Enable leaked-password protection for real user accounts, then run RLS and key scans.
Password reset and invite flows
Lovable apps often generate “forgot password” and invite links via Supabase. Review:
- Reset links expire (do not lengthen the Supabase default to weeks).
- Reset pages do not reflect tokens into analytics query strings.
- After reset, the new password is subject to leaked-password rules (good - confirm with a test).
- Invite flows do not pre-create accounts with a shared temporary password in the Lovable chat history or email template.
- Redirect URLs for recovery are allowlisted in Supabase Auth URL config so open redirects cannot steal tokens.
// Recovery should land on your domain only
await supabase.auth.resetPasswordForEmail(email, {
redirectTo: 'https://yourapp.com/reset-password',
});
How to verify end-to-end
- Toggle leaked password protection in Supabase Auth settings; save.
- From the Lovable app (or a minimal script),
signUpwithpassword123→ expect failure. signUpwith a long unique password → expect success (or email confirmation pending).- Confirm min length ≥ 10 in the same policy panel.
- Confirm email confirmation required for production.
- Hit
/auth/v1/tokenwith repeated failures from one IP - add rate limiting if unlimited. - Run Vibe Code Scanner - auth is only one surface.
- Run Supabase RLS Checker - password policy does not hide open tables.
Common mistakes on Lovable + Supabase auth
- Enabling the toggle in a dev Supabase project but shipping a different prod project.
- Relying on client-side password strength meters only (trivial to bypass).
- Leaving Confirm email off so stuffed accounts are immediately usable.
- Assuming OAuth users are “safe” while password users remain on
Password1!forever with no reset campaign. - Shipping admin accounts with shared passwords in the Lovable prompt history.
- Disabling leaked-password protection after one user complains. Improve the error UX instead.
- Testing only in the Lovable preview while production points at another Supabase ref.
Rollout for existing user bases
- Enable leaked-password protection + min length for all new passwords.
- Announce a password refresh; force reset on next login for accounts older than the policy change if you can flag them.
- Offer passkeys/MFA for high-value roles.
- Monitor failed logins per IP; block or CAPTCHA after threshold.
- Keep RLS and service_role hygiene on the same launch checklist - a stuffed account that can read everyone’s rows via bad RLS is far worse than one that is well scoped.
Related tools and guides
- Supabase RLS Checker - even with auth locked down, missing RLS makes the data behind it readable anyway.
- Lovable Safety Guide - the full set of Lovable defaults that need flipping.
- Lovable tech stack - where Auth sits in the architecture.
- Vibe Code Scanner - verifies the whole auth stack end to end on your live app.
- Auth flows: magic / OTP / reset - related auth failure modes.
- Is Supabase Safe? - platform-level RLS and key model.
Run a full VibeEval scan after enabling to verify auth coverage.
Common questions
What is leaked password protection?
Does enabling this break existing users?
Do I lose usability?
Is this the same as Lovable's site password gate?
Does this work with magic links and OAuth?
Can I enforce this only in production?
What error does the client see when a password is rejected?
Is leaked-password protection enough for production auth?
Password gate is not app security
A share password only blocks casual visitors. Scan RLS, keys, and auth on the real app surface behind the gate.
14-day free trial · Cancel anytime