Supabase database
Did your AI-built login store passwords in plain text?
Ask an AI builder for “a login with username and password” and it sometimes skips the auth service you already pay for. It creates a users table with a password column, saves what people type, and logs them in with a query that matches on it. It works first time, so nobody looks. This week an engineer told Hacker News about a colleague’s Gemini-built page that did exactly this; it was rolled back after it went live. Here is how to check your own app.
TL;DR
- The tell is a login query that matches on the password, such as
.eq("password", password). That only works if the stored value is the password itself. - GitHub code search showed about 10,500 files containing
.eq('password'or.eq("password"on 18 Nov 2026. Not all are logins, but all six Supabase projects we opened were. - Fix: use
supabase.auth.signUpandsignInWithPassword(or Firebase Auth, Clerk), move names and roles into a profiles table, and drop the password column. - Then treat every stored password as leaked: force a reset and tell your users, because people reuse passwords.
- Our free, open-source CLI flags this as PL-039:
uvx --from git+https://github.com/manra399/patchlabs-cli patchlabs scan .
This guide is for founders and agencies whose app was built with Lovable, Bolt, Cursor, Claude Code, Gemini or v0 and has a sign-in page. You don’t need to read code fluently: the check is two searches, and the fix is a prompt you can give the same builder.
What the pattern looks like
Supabase, Firebase and Clerk all store passwords safely (as slow, salted hashes) but only when you sign people up and in through their own calls. The pattern below bypasses that. It is a normal table, so the password sits there exactly as typed:
// sign-up
await supabase.from("users").insert({ email, name, password });
// log-in
const { data: user } = await supabase
.from("users")
.select("*")
.eq("email", email)
.eq("password", password)
.single();The same idea shows up as prisma.user.findFirst({ where: { email, password } }), as SELECT … WHERE email = %s AND password = %s in Python, and as a migration with password text not null. Whatever the language, if the database can find a user by their password, it is storing the password.
Why AI builders write it
“Add a login with username and password” reads as a request for a table with those two columns, and a table is the shortest thing that passes a manual test. The model also tends to keep the app in one place: a custom table needs no email confirmation, no redirect URLs and no auth settings, so nothing gets in the way of the demo. Asking for usernames rather than emails makes it more likely, because Supabase Auth signs people in by email or phone.
We opened six public Supabase projects with this login on 18 Nov 2026. All six saved the password exactly as typed and logged people in by matching on it, and two of them used usernames rather than emails. We are not naming them; the point is how ordinary the pattern is.
Check your app in two minutes
From the project folder (download it from Lovable or Bolt through GitHub if you need to):
# the free scanner: reads your code as text and sends nothing anywhere
uvx --from git+https://github.com/manra399/patchlabs-cli patchlabs scan .
# or by hand: a login that matches on the password
grep -rnE "eq\(['\"]password['\"]|where:\s*\{[^}]*password|WHERE[^;]*password\s*=" --exclude-dir=node_modules .
# a password column in your own tables
grep -rniE "^\s*,?\s*\"?password\"?\s+(text|varchar)" supabase/migrationsNo results and your sign-in calls look like supabase.auth.signInWithPassword? Then the auth service handles passwords and this guide isn’t about you. If you have results, also check who can read that table. In the Supabase dashboard, open Table Editor, then the users table: a “RLS disabled” badge or a policy like using (true) means the passwords may already be readable with your public key (PL-001). Our free RLS check reads a public repo’s migrations for that.
The fix: move to Supabase Auth
Supabase Auth hashes passwords, limits guessing and sends reset emails. Your extra fields (name, username, role) move to a profiles table keyed by the auth user’s id:
// sign-up: Supabase stores a hash, never the password
const { data, error } = await supabase.auth.signUp({
email,
password,
options: { data: { name } }, // kept on the auth user; copy into profiles on first login
});
// log-in
const { data: session, error: loginError } = await supabase.auth.signInWithPassword({ email, password });create table public.profiles (
id uuid primary key references auth.users(id) on delete cascade,
name text,
username text unique
);
alter table public.profiles enable row level security;
create policy "Own profile" on public.profiles
for select to authenticated using (id = (select auth.uid()));
-- after every account has moved: remove the old copy of the passwords
alter table public.users drop column password;Keep roles out of anything users can edit: not in profiles if users can update their own row, and not in user_metadata (PL-019). A separate user_roles table with no insert or update policy for users is the simple safe choice.
If you can’t use an auth service (a legacy system, a separate kiosk login), hash on the server with Argon2id or bcrypt, look the row up by email only, and compare with the library’s verify function. Never in the query, and never in the browser.
A prompt you can give your builder
My app has its own users table that stores the password people typed, and logs
them in with a query that matches on the password. Replace this with Supabase
Auth: supabase.auth.signUp for sign-up, supabase.auth.signInWithPassword for
login, and a profiles table keyed by auth.users id for name and username. Don't
store or compare passwords in my own tables. Keep roles in a separate table users
can't write to. List every file you changed, then tell me how to make existing
users set a new password.What you owe your users
A stored password is a leaked password the moment anyone else can read that table: a teammate with dashboard access, a backup, a support export, a policy that was open for a week. People reuse passwords, so the risk is to their email and bank accounts, not only your app.
- Existing accounts. From a server script (never the browser), create each person in Supabase Auth with the admin API,
auth.admin.createUser({ email, email_confirm: true }), then send everyone a “set a new password” link withresetPasswordForEmail. Don’t carry the old passwords over: treat them as exposed. Then drop the column and delete old backups you control. - Was the table readable? If RLS was off or a policy allowed
anon, assume the passwords were exposed. In the UK and EU that can be a personal data breach you must assess and possibly report within 72 hours; our first hour after a leak guide covers what to do and in what order. - Tell people. A short, plain email (“we stored your password in a way we shouldn’t have; we’ve fixed it; if you used the same password elsewhere, change it there”) protects them and you.
How PatchLabs checks for this
PL-039 in our open-source CLI reads JS, TS, Python and SQL as text. It flags a database query that matches on a password, an insert or update through a database client that saves a bare password field in a repo that never hashes one, and (medium) a text password column in a repo with no password hashing. It skips calls to auth providers, values that are already hashed, form state and validation schemas, and frameworks that hash inside their own services. On 18 Nov 2026 it ran clean on ten real projects that handle passwords properly, including cal.com, Payload, Directus and Vercel’s AI chatbot, and flagged all six sampled repos that use the .eq('password', …) login.
Related findings
The checks behind this guide, each with example code, a self-check and the fix.
Passwords stored or looked up in plain text
PL-001Anonymous visitor can read personal data
PL-002Any signed-in user can read every row
PL-019Access decided by user_metadata, which users can edit
Free check
Check your app for this, free.
Paste your public repo. PatchLabs rebuilds your database from its migrations, tests it as a visitor, a stranger and the owner, reads the code for keys and risky patterns, and hands you the fix.
Written by Manraj Singh Dhillon. Last checked 18 Nov 2026. Code samples are synthetic and run against your own project; nothing here names a real app. Spotted a mistake? Tell us.