The Vibe Code
Security Check
Your app works. That doesn't mean it's safe — and you can't tell the difference by looking at it. These are the three things that actually leak user data in AI-built apps, why they keep happening, and how to check your own project in about five minutes. Researchers reviewed hundreds of thousands of vibe-coded apps last year and found more than 5,000 with virtually no security or authentication. Around 40% of that exposed set contained sensitive data. None of them looked broken either.
The fast way: don't read this — feed it to your AI
The audit file is written for Claude Code, not for you. Download it, open your project, paste it in. It checks all three of these plus storage buckets and git history, then gives you a ranked list of what's exposed. It's read-only — it won't change anything until you tell it to.
Turn the rule on
Your app talks to the database straight from the browser. That's how Supabase and Firebase are built, and it's fine. But it means the address of your database ships with your app, where anyone can read it.
That part is supposed to be public. It's an address, not a key. What stops strangers is a rule on each table that says: only show people their own rows.
That rule is off by default on any table your AI creates with raw SQL. It doesn't add it unless you ask. Off means one public address reads everyone's data — not just the logged-in user's.
Here's the trap, and it's the reason I made this file.
Your app breaks. Users can't load their data. You tell the AI to fix it. The fastest fix it knows is a rule that allows everyone:
create policy "Enable read access" on profiles for select using (true); -- ← everyone. logged out. worldwide.
Now there's a rule, so it looks handled. It just says yes to everybody. A rule that's actually working names the user:
using (auth.uid() = user_id)
If it doesn't mention who's asking, it isn't protecting anything.
Quickest way to check by hand: open your Table Editor and look for the "Unrestricted" badge. Every table wearing one is readable by anyone, right now.
Find the key that ignores your rules
There's a second key, and that one's real. It skips every rule you just wrote — that's its entire job, so your server can do admin work.
It's supposed to live on your server and never leave. Sometimes it leaves.
Three prefixes mean "ship this to the browser":
NEXT_PUBLIC_… → goes to the browser VITE_… → goes to the browser REACT_APP_… → goes to the browser
Put the admin key behind one of those and it goes out with your JavaScript. Everything from the first check stops mattering the moment that happens — the key was built to ignore it.
Rule of thumb: if the name has SECRET, PRIVATE, ADMIN, or SERVICE_ROLE in it, it belongs in server code only.
One more thing while you're in there. Check that .env.local is in your .gitignore — and that it always was. A key you committed six months ago is still sitting in your git history even if you deleted the file. If the repo is public, treat that key as gone and generate a new one. Fixing the code doesn't un-leak it.
Ask if it's actually theirs
Every route on your server should answer two questions. AI-written code is good at the first one and forgets the second constantly.
Who are you? Usually handled — there's a login check.
Is this actually yours? Often missing entirely:
// user 43 changes a number in the URL
// and reads user 42's order
const { id } = await params;
const order = await db.orders.findById(id);
return Response.json(order);They were logged in. Nobody checked whose order it was. The fix is one clause — filter by the caller's ID too — but nothing about how the app behaves tells you it's missing.
The other version of this: a route that uses the admin key from check two and never asks who's calling. Anyone who guesses that URL has your whole database, and none of your rules apply to them.
Which is the theme running through all three of these. None of them break your app. It works perfectly the entire time the data is public. That's exactly why you have to go look.
Check yours in 5 minutes.
Grab the file and let Claude Code check yours — if it turns something up you're not sure how to fix, reply to the email and I'll point you at the fix.