// guide · auth · Supabase · Lovable · Bolt · Nov 30, 2026
Does your vibe-coded app store passwords in plain text? Check your homemade login
Short answer
- If your code logs users in with
.eq("password", password)orWHERE password = $2, the passwords are stored as typed. A real hash can't be matched that way. - If that query runs in the browser, the anon key can read the table, so anyone can download every email and password. People reuse them on email and banking.
- Fix: use
supabase.auth.signUp/signInWithPassword(bcrypt, handled for you), or hash on the server with Argon2id or bcrypt and verify with the library. - Move existing users without exposing anything, drop the column, and delete exports and backups that contain it.
Why this keeps showing up
Ask an AI builder for “a login page” without saying which auth to use and it sometimes builds one from scratch: a users table, apassword column and a query that matches both fields. It works in the demo, so nobody looks again. Security accounts on X were warning about exactly this pattern in vibe-coded apps on Nov 30, 2026: one leaked backup or one open table, and every password is readable.
What it looks like
-- migration the AI wrote
create table public.users (
id uuid primary key default gen_random_uuid(),
email text unique not null,
password text not null -- stored exactly as typed
);
// Login.tsx (runs in the browser with the anon key)
const { data } = await supabase
.from("users")
.select("*")
.eq("email", email)
.eq("password", password) // only works on plain text
.single();
localStorage.setItem("user", JSON.stringify(data)); // and this is the "session"Three problems in a few lines: the password is stored as typed, the check happens in the browser (so the users table must be readable with the public anon key), and the “session” is a row in localStorage that anyone can edit. Lovable, Bolt and v0 apps usually ship the anon key in the JS bundle, which is fine for Supabase only when RLS protects every table. Here the login itself needs the table to be open.
The 2-minute check
# 1. Queries that compare passwords in the database
grep -rnE "\.eq\(['\"]password['\"]|\.match\(\{[^}]*password|password\s*=\s*(\$[0-9]|\?)" \
src app server supabase --include=*.{ts,tsx,js,jsx,py,sql}
# 2. Raw passwords written into your own tables
grep -rnE "\.(insert|upsert)\([^)]*password" src app server
# 3. Password columns in migrations / schema
grep -rniE "\bpassword\b\s+(text|varchar)|password\s+String" supabase prisma db
# 4. Is that table readable signed out? (anon key only, from your own machine)
curl "https://<project>.supabase.co/rest/v1/users?select=email,password&limit=1" \
-H "apikey: <anon key>"Hits in auth.users don't count: encrypted_password there is Supabase's own hash. Calls like supabase.auth.signInWithPassword andupdateUser({ password }) are the correct API, not a problem. If step 4 returns a row with a password in it, treat it as a breach: fix first, then reset every user's password and tell them.
Fix 1 (recommended): let Supabase Auth handle passwords
// Sign up / sign in with Supabase Auth (it stores a bcrypt hash in auth.users)
await supabase.auth.signUp({ email, password });
await supabase.auth.signInWithPassword({ email, password });
-- your own table holds profile data only, keyed by the auth user
create table public.profiles (
id uuid primary key references auth.users(id) on delete cascade,
full_name text
);
alter table public.profiles enable row level security;
create policy "own profile" on public.profiles
for select to authenticated using ((select auth.uid()) = id);Supabase's password auth docs cover sign-up, sign-in, email confirmation and reset. Supabase Auth hashes passwords with bcrypt (source), and the session is a signed JWT that RLS policies can check with auth.uid(), not a row in localStorage.
Fix 2: if you must keep your own accounts table
// Server only (API route / edge function), never in browser code
import { hash, verify } from "@node-rs/argon2"; // or bcrypt with cost >= 10
// sign up
const passwordHash = await hash(password); // salted Argon2id string
await db.from("accounts").insert({ email, password_hash: passwordHash });
// log in: find by email, then verify. Never .eq("password", ...)
const { data: acct } = await db.from("accounts").select("id, password_hash").eq("email", email).single();
const ok = acct && (await verify(acct.password_hash, password));The OWASP Password Storage Cheat Sheet says: Argon2id with at least 19 MiB of memory, 2 iterations and 1 degree of parallelism; if not available, scrypt; for legacy systems, bcrypt with a work factor of 10 or more and a 72-byte limit; PBKDF2 with 600,000+ iterations only if you need FIPS-140. Fast hashes like SHA-256 or MD5 are not suitable. Do the hashing on the server, keep the accounts table closed to anon with RLS, and never send the hash to the browser.
Moving existing users
- Safest: create each account in Supabase Auth and send a reset link with
supabase.auth.resetPasswordForEmail. Use this if the table was ever readable. - Seamless: a one-time server script with
auth.admin.createUser, which hashes each password, then drop the column:
// One-time server script (service_role key, run locally, never shipped)
for (const u of oldUsers) {
const { error } = await admin.auth.admin.createUser({
email: u.email,
password: u.password, // Supabase Auth hashes it; nothing is logged
email_confirm: true,
});
if (error) console.log("failed:", u.id); // log ids, never passwords
}
-- then, after the app uses Supabase Auth:
alter table public.users drop column password;After the switch, delete CSV exports, database dumps, seed files and logs that contain the old column. A password copied into db/seed.sql or a public repo stays in git history until you rewrite it.
Prompt to paste into Lovable, Cursor or Claude Code
Audit this app's login and sign-up code for plain-text passwords:
1. List every table with a password / passwd / pwd column, and every query that filters on it (.eq("password"), .match, WHERE password =, Firestore where).
2. List every insert/upsert that writes a password field, and say whether it is hashed first (Argon2id, bcrypt, scrypt, PBKDF2) or stored as typed.
3. Say whether each query runs in browser code (anon key) or on the server.
4. Propose the switch to supabase.auth.signUp / signInWithPassword with a profiles table keyed by auth.uid(), and a migration plan for existing users.
Do not print, log or copy any real password values. Show the diff before changing anything.Check it automatically
RescueMyRepo's free scan reads your code and migrations without running anything. Password-equality queries are flagged critical from browser code and high on the server. Raw passwords written into your own tables are flagged high when the repo has no bcrypt, Argon2, scrypt or PBKDF2. A plain password text column with no hashing anywhere is a medium, low-confidence finding. The same scan checks Supabase RLS, SECURITY DEFINER functions, secret keys in the frontend, Stripe webhooks and unauthenticated AI routes.
FAQ
How do I know if my app has a homemade login?
Search the code for a password column in your own tables and for queries that filter on it: .eq("password", ...), .match({ email, password }), WHERE password = $2, or a Firestore where("password", "==", ...). If login goes through supabase.auth.signInWithPassword, Firebase Auth, Clerk or NextAuth and your tables have no password column, you are using real auth.
Why is .eq("password", password) always a red flag?
A proper password hash is salted, so the same password produces a different value every time and can't be matched with an equality filter. If the query works, the column holds the password as typed (or an unsalted fast hash, which OWASP says is not suitable for passwords). The correct pattern is: load the user by email, then call the hashing library's verify/compare function.
The query runs in the browser. How bad is that?
For a browser query to find the row, the anon key (public in your JS bundle) must be allowed to read that table. Anyone can then call the same REST endpoint without the password filter and download every email and password. Treat it as a breach: fix it, then reset every user's password.
Is SHA-256 of the password good enough?
No. OWASP's Password Storage Cheat Sheet says fast hashes like SHA-256 "are not suitable for password storage" because attackers can try billions of guesses. Use Argon2id (minimum 19 MiB memory, 2 iterations, 1 degree of parallelism), scrypt, or bcrypt with a work factor of 10 or more and a 72-byte input limit.
How do I move existing users to Supabase Auth?
Two options. Ask every user to reset: create each account and send a reset link with supabase.auth.resetPasswordForEmail. Or run a one-time server script with the service_role key that calls supabase.auth.admin.createUser({ email, password, email_confirm: true }) for each row. Supabase Auth hashes the password with bcrypt, and then you drop the old column. Never log, export or email the plain values. If the table was ever readable, prefer the reset option.
Does RescueMyRepo check for this?
Yes, since Nov 30, 2026. The free scan flags password-equality queries (critical from browser code, high on the server), raw passwords written into your own tables when the repo has no bcrypt, Argon2, scrypt or PBKDF2, and a plain password text column with no hashing anywhere (medium, low confidence). supabase.auth.signUp / signInWithPassword / updateUser calls are not flagged.
Related
- Is your Lovable app one of the 7,403? Check that your Supabase data isn't readable without a login
- Is your OpenAI or Stripe secret key in your frontend?
- Don't store roles in Supabase user_metadata: any logged-in user can make themselves admin
Sources
- OWASP Password Storage Cheat Sheet
- Supabase docs: Password-based Auth
- Supabase Auth source: password hashing (bcrypt)
- Supabase JS reference: auth.admin.createUser
Recommendations per the linked docs, read Nov 30, 2026.