Your Supabase key is in your frontend. Here's when that's fine, and when it isn't
November 2026 · Real scan data from 99 live apps, plus Supabase's own docs
Two weeks ago we wrote about leaked OpenAI keys. Last week was the boring launch checklist: headers, link previews, sitemaps. This week is the question we get most from people building with Lovable, Bolt, Cursor and v0:
"I can see my Supabase key in View Source. Did I just leak it?"
Short answer: probably not. That's still not the question to ask. The real question is what someone can do with the key, and that comes down to one setting most vibe-coded apps never look at: Row Level Security.
How common is this?
In early November 2026 we ran the ShipSniffer scanner over 99 live apps that people had linked in Hacker News posts. 45 were on lovable.app, 34 on custom domains, 11 on replit.app, and the rest on Vercel, Netlify and Bolt.
37 of the 99 (37%) loaded a Supabase project from the browser. Their Supabase URL and public key sat in the page or the JavaScript bundle, readable by anyone. That's normal. It's how Supabase is meant to be used from a frontend.
What we didn't find in those 99 scans was a Supabase service role key. The only critical secret in that study was one OpenAI key. So the key itself wasn't the issue for those 37 apps. What matters is the part a passive scanner can't see from outside: what the database lets that key do.
Two kinds of Supabase keys
Supabase's docs split keys into two groups, and the difference matters:
| Key | Where it can go | What it can do |
|---|---|---|
Publishable key (older projects: the anon key) |
Browser, mobile app, public repo | Only what your Row Level Security policies allow |
Secret key (older projects: the service_role key) |
Server only | Everything. It bypasses Row Level Security |
Supabase's own guide puts it plainly: the publishable key "is safe to expose with RLS enabled," while secret and service role keys "are never safe to expose because they bypass RLS." (Supabase: Securing your data)
So there are two ways to get this wrong:
- The service role key ends up in the browser. Usually it's an env var named
VITE_SUPABASE_SERVICE_ROLE_KEYorNEXT_PUBLIC_SUPABASE_SERVICE_KEY, or a quick fix someone pasted to make an "insert failed" error go away. Anyone with that key has full read and write access to your database. - The anon key is in the browser (fine), but RLS is off or too loose (not fine). Then the "safe" key can read every row anyway.
The second one is much more common, and it's easy to miss because the app works perfectly.
This already happened to real apps
This isn't hypothetical. In March 2025, Matt Palmer found that many Lovable-built apps had missing or overly permissive RLS policies. That let anyone with the public key read, and sometimes write, tables they never should have touched. It was published as CVE-2025-48757. Per Palmer's write-up, a scan of 1,645 Lovable projects found 170 with inadequate RLS, exposing things like user records, payment details and API keys. (Statement on CVE-2025-48757, GitHub Advisory GHSA-773x-pxjg-gxgx)
Notice the pattern: nobody "leaked" anything in those apps. The key was public on purpose. The database just trusted it too much.
Why AI-built apps hit this so often
From what we see in scans and in the threads people post asking for help, it usually goes like this:
- The app is client-driven. Lovable, Bolt and v0 projects often talk to Supabase straight from the browser, with no backend in between. So RLS is the only thing standing between a visitor and your tables.
- "Make it work" beats "make it safe." When a query fails because of a policy, the fastest fix an AI agent can offer is to turn RLS off or add a policy that allows everything (
using (true)). The error goes away, and so does your protection. - A green checkmark isn't a review. Palmer's statement notes that a scanner that only checks whether a policy exists can give "a false sense of security." A policy that allows everyone still counts as a policy.
- Testing happens while logged in as yourself. Everything looks right because you're the owner. Nobody tests as a stranger.
A 15-minute check you can do today
You don't need to be a Postgres expert. Open your Supabase dashboard and go through this list:
1. Find every table without RLS. In the Table Editor, any table marked as having RLS disabled is open to anyone holding your public key. Turn it on. With RLS on and no policies, nobody can read the table through the public API, which is a safe place to start.
2. Read every policy that says true.
A policy like using (true) on select means "everyone can read every row." That's fine for a public blog posts table. It's a disaster on profiles, orders or messages. Most private data should be scoped to the signed-in user, for example using (auth.uid() = user_id).
3. Check writes separately from reads.
insert, update and delete each need their own thinking. A common hole: reads are scoped properly, but update is wide open, so anyone can change anyone's is_admin or credits column.
4. Search your frontend for the service role key.
Search your repo and your built files for service_role, SERVICE_ROLE and sb_secret_. If you find one anywhere that ships to the browser, rotate it in the Supabase dashboard first, then move that code to a server function or edge function. Deleting the line isn't enough. The old key still works until you rotate it, and it's probably in your git history.
5. Test as a stranger. Open your app in a private window without logging in. Open the browser dev tools, find a Supabase request, and look at what came back. Then sign up as a second test user and try to load the first user's data. If you can see it, so can everyone.
6. Turn on Supabase's own advisors. The dashboard's Security Advisor flags tables with RLS disabled and other common mistakes. It's free, and it takes a minute to read.
What about environment variables?
A quick rule that covers Vite, Next.js and most of their cousins: anything with a VITE_ or NEXT_PUBLIC_ prefix gets baked into the JavaScript your visitors download. Those prefixes mean "make this public." Your Supabase URL and publishable key can live there. Your service role key, OpenAI key and Stripe secret key can't. We covered this in the leaked-keys post: most of the live OpenAI keys we found were sitting right in index.html or a bundled JS file.
The takeaway
Seeing your Supabase key in View Source isn't a leak. It's how the platform is built. But it does mean your Row Level Security policies are now your whole security model. If they're missing, or they say true where they should say auth.uid() = user_id, then the "safe" key unlocks everything.
Take 15 minutes before your next launch to read your policies like a stranger would.
Want a quick outside check first? ShipSniffer runs a free, passive scan of your live URL. It looks for secret keys exposed in your page or bundle, missing security headers, link previews, sitemaps and more, and tells you what to fix in plain English. Try it at shipsniffer.com. A passive scan can't log into your database, so it won't replace the RLS check above, but it will catch the keys that should never have shipped.
About the author
- Launch checks for vibe-coded apps. Free scan at shipsniffer.com