Passwords stored or looked up in plain text
The app keeps its own users table with the password people typed, and logs them in with a query that matches on it.
- Severity
- High (critical if the table is readable)
- Who can exploit it
- Anyone who can read the users table: a leaky policy, a backup, a log, a support tool
- Found by
- patchlabs-cli (static, from 18 Nov 2026)
- Lab proof
- Not lab-proven: file and line in the report
What it is
Ask an AI builder for “a login page” without saying how, and it sometimes skips the auth provider you already have. It creates a users table with a password column, saves what the person typed, and logs them in with a query such as .eq("email", email).eq("password", password). It works on the first try, so nobody looks again.
PL-039 flags three signs of this: a query that matches rows on the password value (only possible if the stored value is the typed password), an insert or update that saves a bare password field in a repo that never hashes one, and a SQL table with a text password column in a repo that never hashes passwords.
Why AI builders produce it
Supabase, Firebase and Clerk all hash passwords for you, but only through their own sign-up and sign-in calls. A prompt like “add a login with username and password” reads as a request for a table, and a table is what the model builds. On 17 Nov 2026 an engineer described the same thing on Hacker News: a colleague’s Gemini-built marketing page with its own login, which turned out to be saving every password in plain text. It was rolled back after it went live.
Example of vulnerable code
Simplified from the patterns we see in AI-built apps. Synthetic: not taken from any real app.
// src/pages/Login.tsx: the model wrote its own login
const { data: user } = await supabase
.from("users")
.select("*")
.eq("email", email)
.eq("password", password) // only matches if the typed password is stored
.single();
// src/pages/Signup.tsx
await supabase.from("users").insert({ email, name, password });
Check it yourself
# the free, open-source scanner (reads your code as text, sends nothing)
uvx --from git+https://github.com/manra399/patchlabs-cli patchlabs scan .
# or by hand
grep -rnE "eq\(['\"]password['\"]|where:\s*\{[^}]*password|WHERE[^;]*password\s*=" --exclude-dir=node_modules .
grep -rniE "^\s*,?\s*\"?password\"?\s+(text|varchar)" supabase/migrations
The fix
Best: delete the custom password column and let your auth provider handle passwords. It hashes them, rate-limits guesses and sends reset emails.
await supabase.from("users").insert({ email, name, password });
await supabase.auth.signUp({ email, password, options: { data: { name } } });
.from("users").select("*").eq("email", email).eq("password", password).single();
const { data, error } = await supabase.auth.signInWithPassword({ email, password });
If you must keep your own table (a legacy system, a separate admin login), hash with Argon2id or bcrypt before saving, load the row by email only, and compare with the library’s verify function, never in the query. Then drop the old column, and treat any password it held as leaked: force a reset for every account and tell your users, because people reuse passwords. If the table was readable by anyone (see PL-001), that is a breach to assess, not just a fix. The guide walks through the whole move.
Code findings come with the file, the line and a one-line fix in the report, for your engineer to make. PatchLabs never pushes to your repo.
Ask your AI builder to fix it
Built with Lovable, Bolt, Replit or Cursor? Paste this into the chat. It asks for this one fix and nothing else, and to see the change before it’s applied. Read the change, or have your engineer read it, before you accept.
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: use supabase.auth.signUp for sign-up and supabase.auth.signInWithPassword for login, move any extra fields (name, role) into a profiles table keyed by auth.users id, then remove the password column. Don't store or compare passwords in my own tables. List every file you changed, and tell me how to force a password reset for existing users. Show me the exact change before you apply it, and don't change anything else.
Then check again with the free open-source CLI (patchlabs scan .), or run the full free check on your repo.
How PatchLabs finds it
[SCAN] src/pages/Login.tsx:3 .eq("password", password): login matches on the password LEAK [SCAN] src/pages/Signup.tsx:6 insert({ email, name, password }): saved without hashing LEAK [FIX] supabase.auth.signUp / signInWithPassword; drop the column
patchlabs-cli reads your JS, TS, Python and SQL files. It skips calls to an auth provider (supabase.auth.signUp, Firebase’s createUserWithEmailAndPassword), values that are already hashed, form state and validation schemas, and only counts writes made through a database client directly (supabase-js, Drizzle, Prisma, Firestore, the MongoDB driver, Django, raw SQL). Frameworks that hash inside their own services, such as Payload or Directus, are not flagged. On 18 Nov 2026 it ran clean on ten real projects that handle passwords properly (cal.com, Payload, Directus, Vercel’s AI chatbot, the FastAPI full-stack template and five Supabase starters), and flagged all six public repos we sampled that use the .eq('password', …) login.
When the pattern is intended
Almost never intended. A column named password that actually holds a bcrypt or Argon2 hash is fine, which is why the column on its own is only medium and is skipped when the repo calls a hash function anywhere.
Why it’s rated high (critical if the table is readable)
High: anyone who reads the table gets working passwords, for your app and for every other site where your users reused them. Critical when the table is also readable through a leaky policy, because then it is already public.
Related findings
Anonymous visitor can read personal data
Anyone with your app's public key can read emails, phone numbers or addresses.
PL-002Any signed-in user can read every row
Signing up unlocks other people's rows. If sign-up is open, that means anyone.
PL-019Access decided by user_metadata, which users can edit
Roles stored where users can rewrite them. One call from the browser and they're an admin.
Guides
Free check
Does your app have PL-039?
Paste your public repo. PatchLabs Code reads it for this and every other code finding, and the Lab rebuilds your database to test who can read what.
Last reviewed 10 Nov 2026. Finding IDs are stable: link to them freely. Spotted a mistake? Tell us.