AI builders are very good at getting an app to work. They are less good at noticing what a stranger can do with that app once it is live. "It works" and "it's secure" are different tests, and the model will happily tell you it passed both.

We build CapLeak, a scanner that looks at a live app from the outside, the way a stranger's browser sees it. It runs 31 checks (25 on every scan, 6 more after you prove you own the app). This post isn't a stats report. It's the six problem areas those checks are built around, why they keep showing up in apps made with Lovable, Bolt, Cursor, v0 and Replit, and how to check each one yourself in a few minutes.

Only test apps you own.

1. Secret keys shipped to the browser

What it is: an OpenAI, Stripe secret, AWS or Supabase secret key sitting in the JavaScript every visitor downloads.

Why AI builders do it: to "make it work". The quickest way to call OpenAI from a Vite app is to put the key in a VITE_ variable. The quickest way in Next.js is NEXT_PUBLIC_. Both prefixes mean "copy this value into the browser bundle". .gitignore doesn't help, because the leak happens at build time, not in Git.

Check it yourself: open your live app (not the editor preview), open DevTools, and search all sources (Ctrl+Shift+F / Cmd+Option+F) for:

sk- sk_live_ sb_secret_ service_role AKIA 

Or from a local build:

npm run build grep -rE "sk-|sk_live_|sb_secret_|service_role|AKIA" dist/ .next/static/ 2>/dev/null 

Some keys are public by design and fine to see: the Supabase anon or sb_publishable_ key, Stripe pk_ keys, and analytics keys. The Supabase one to worry about is service_role (legacy JWTs starting eyJ: decode the middle part and read role) or anything starting sb_secret_. That key bypasses Row Level Security entirely.

Fix: rotate the key at the provider first. Deleting it from the code doesn't remove the copies people already downloaded. Then move the call into a Supabase Edge Function or a server route, store the key there without a public prefix, and make that function check who is calling.

2. Supabase tables anyone can read

What it is: tables readable with the anon key your app ships, because Row Level Security (RLS) is off or a policy says using (true).

Why AI builders do it: many AI-built apps query Supabase straight from the browser. That's a valid design, but only if RLS holds up. When a query fails because of a policy, the shortest path to a working app is "turn RLS off" or "allow all".

Check it yourself: in the Supabase SQL editor:

select tablename, rowsecurity from pg_tables where schemaname = 'public' order by rowsecurity, tablename; select tablename, policyname, cmd, roles, qual, with_check from pg_policies where schemaname = 'public' order by tablename; 

Any rowsecurity = false row, or a true policy on user data, is a problem. The Security Advisor in the dashboard also flags tables with RLS disabled. Then do the stranger test with only the public key and no login:

curl "https://YOUR-PROJECT.supabase.co/rest/v1/orders?select=*&limit=1" \ -H "apikey: YOUR_ANON_OR_PUBLISHABLE_KEY" 

[] or a permission error is good. A real row means a stranger can read that table.

Fix:

alter table public.orders enable row level security; create policy "Owners read their orders" on public.orders for select to authenticated using ((select auth.uid()) = user_id); 

Add insert/update policies with the same auth.uid() condition in with check, and drop the old "Enable read access for all users" style policy.

3. Login settings that let anyone in

What it is: open sign-ups with email confirmation off, or anonymous sign-ins on, in an app that doesn't need them.

Why it matters: this is the quiet half of RLS. A policy written to authenticated using (true) looks safe, but if anyone can sign up in one click, "authenticated" means "anyone". Signed in is not the same as allowed.

Check it yourself: in Supabase, go to Authentication and look at the sign-up and email settings. Or ask the public settings endpoint (it only needs the anon key and signs nobody up):

curl "https://YOUR-PROJECT.supabase.co/auth/v1/settings" \ -H "apikey: YOUR_ANON_OR_PUBLISHABLE_KEY" 

Look at disable_signup, mailer_autoconfirm and external.anonymous_users.

Fix: if the app is just for you or a small team, turn off sign-ups. If it's public, keep email confirmation on and make sure every policy on user data checks auth.uid(), not just "is logged in".

4. .env, .git and source maps served from the live site

What it is: private files that your host serves to anyone who asks for them.

Why it happens: a .env dropped into public/, a whole project folder uploaded instead of the build output, or source maps turned on in production. An exposed .git folder can be worse than one env file, because it can let someone rebuild your source code and history.

Check it yourself:

curl -s https://your-app.com/.env | head -5 curl -s https://your-app.com/.env.local | head -5 curl -s https://your-app.com/.git/config | head -5 

Many hosts answer unknown paths with your homepage, so a 200 OK means nothing on its own. Read what comes back. KEY=value lines or a block starting [core] mean the file is public. For source maps, open DevTools > Sources and see whether your original src/ files show up. Also check Git history: git log --all --oneline -- .env .env.local returns something if the file was ever committed.

Fix: rotate every secret that was in the file, not just the one you're worried about. Make sure /.env* and /.git/ return 404, deploy only the build output, keep .env* in .gitignore, and leave Vite's build.sourcemap / Next's productionBrowserSourceMaps off.

5. Public storage buckets holding private files

What it is: a Supabase Storage bucket marked public that holds invoices, ID photos or user uploads.

Why it happens: "public" is the easy setting when an image won't load. That's fine for logos and product photos. It's wrong for anything personal, because anyone with a file's URL can open it.

Check it yourself: in the Supabase dashboard, open Storage and look at which buckets are marked Public and what's inside them.

Fix: make private-content buckets private and serve files with signed URLs. Add storage policies that tie access to auth.uid().

6. HTTPS, security headers and CORS

What it is: no HTTP-to-HTTPS redirect, missing HSTS, no Content-Security-Policy, no clickjacking protection, no X-Content-Type-Options: nosniff, no Referrer-Policy or Permissions-Policy. A related problem is an API that reflects any Origin back with credentials allowed.

Why it happens: builders focus on features. Headers are set at the host or framework level, and nobody prompts for them.

Check it yourself:

curl -sI https://your-app.com | grep -iE "strict-transport|content-security|x-frame|frame-ancestors|nosniff|referrer-policy|permissions-policy" curl -sI http://your-app.com | grep -i location curl -sI -H "Origin: https://example.invalid" https://your-app.com/api/your-endpoint | grep -i "access-control" 

If the last command echoes https://example.invalid back together with access-control-allow-credentials: true, any site can make logged-in requests to that endpoint.

Fix: add the headers in your host's config (or headers() in next.config), and use an explicit allow-list for CORS. Headers won't fix an open database, but they limit the damage from other bugs. If you use a custom domain, check that domain too.

A prompt to start the cleanup

Paste this into your builder, then check its work with the commands above:

Do a security pass on this app. List every VITE_ or NEXT_PUBLIC_ variable and tell me if any holds a secret; move secret calls to a server route or Supabase Edge Function that checks the signed-in user. List every table in the public schema with its RLS status and policies, enable RLS on all of them, and replace any true policy on user data with auth.uid() checks. Make sure .env files are not in the public folder. Show the SQL and the files you changed before applying them.

Don't trust the model's own "all fixed". Run the stranger test again, logged out, from outside.

If you'd rather have these checks run from the outside in one go, CapLeak gives a free score for any URL: https://capleak.vercel.app/?utm_source=devto