Is your Supabase database open to anyone?
I built a demo coaching app the way Lovable and Claude build them. Using only the public key that sits in the page, I could read all 48 clients and all 39 payments.
Only check apps you own or have permission to test.
- 110K+
- views on my bank statement reel
- 507
- people sent the free check from a reel comment
- 1,395
- people follow along on Instagram
Counted from Instagram and my DM log.
What I found
The clients were made up, and I opened the app as a stranger.
Three tables. One had row level security (RLS) off. One had RLS on, with the policy AI tools love to write when they hit a permission error: using (true). That one line means "let everyone in". The third was locked properly.
87 rows
read with nothing but the public key
From outside, two of the three tables gave up their rows. I could also add rows to payments.
| Table | Result | What I got |
|---|---|---|
| payments | Open | 39 rows read |
| clients | Open | 48 rows read |
| payments | Open | Rows added |
| bookings | Locked | Nothing |
The payments showed emails, plans, amounts and the last 4 digits of each card. The clients showed names, emails and phone numbers. I could also give myself a paid Elite plan for $0. The app worked perfectly the whole time. Nothing looks wrong until someone who isn't you asks the database for everything.
This isn't rare. UpGuard looked at about 300,000 sites using Supabase this year and found 16,326 databases with tables anyone could read (their write-up).
Why AI-built apps end up like this
Most Supabase apps have no server in the middle. The page talks to the database directly with a public key, and Supabase is built to work that way. RLS is the only thing deciding who sees which rows.
Tables made with SQL start with RLS off, and SQL is how AI tools make them. When the app then breaks on a permission error, the quickest fix is using (true). The error goes away and the table is open again.
Check yours in 2 minutes
In Supabase, open the SQL Editor and run this. It only reads.
select c.relname as table,
case c.relkind when 'v' then 'view' when 'm' then 'materialized view'
when 'p' then 'partitioned table' else 'table' end as kind,
c.relrowsecurity as rls_on,
has_any_column_privilege('anon', c.oid, 'select') as anon_can_read
from pg_class c join pg_namespace n on n.oid = c.relnamespace
where n.nspname = 'public' and c.relkind in ('r', 'p', 'v', 'm')
order by rls_on, c.relname;
select tablename, policyname, permissive, roles, cmd, qual as using_rule, with_check
from pg_policies where schemaname = 'public' order by tablename;
First result: a table with rls_on = false and anon_can_read = true is open to anyone. Second result: a rule that is just true for anon or public means everyone. A view with anon_can_read = true counts as open too, because views skip RLS unless you made them with security_invoker. That's fine for a public product list. On anything with people's details, it's the hole.
Supabase also flags both under Advisors, then Security Advisor. Worth a look, but it can't know which tables you meant to be public.
Found an open table?
The fix is below and takes about 10 minutes. If you'd rather not touch SQL on a live app, send it to me. I fix one finding from $150, and you get the price in writing before I start.
Get it fixedLet your AI run it, free
For Claude Code, Cursor, Lovable or Bolt
Paste it into the chat that has your app open. It runs the check itself and asks before it changes anything.
No coding tool? Open it in a chat that walks you through each step:
Back from your AI without a result link? Tap what it found:
Make it a free account. Run every free check from inside your AI with no copying, see what an add-on can touch before you install it, and keep your results in one place. Your email is already filled in.
Want to see exactly what your AI is told? Here's the page it reads. Not you?
Your AI runs it on your side. VXSec never sees your code or data, only which check ran, when, and how many holes it found. Use a test copy for checks that change data. Nothing gets fixed until you say yes.
How to fix it
Policies add up. A strict new policy does nothing while an old using (true) one is still there, so drop the old ones first. This writes the drop lines for every rule that lets everyone in, on the tables you're about to lock. List them all:
select format('drop policy %I on %I.%I;', policyname, schemaname, tablename)
from pg_policies
where schemaname = 'public' and tablename in ('profiles', 'signups', 'payments')
and qual = 'true';
Run what it gives you. Then lock each table. Change the names to yours.
-- people see and edit only their own rows
alter table public.profiles enable row level security;
create policy "own profile: read" on public.profiles
for select to authenticated using (id = (select auth.uid()));
create policy "own profile: update" on public.profiles
for update to authenticated
using (id = (select auth.uid())) with check (id = (select auth.uid()));
-- a sign-up form: anyone can add a row, nobody can read them back
alter table public.signups enable row level security;
create policy "anyone can sign up" on public.signups
for insert to anon, authenticated with check (true);
-- payments, roles, credits: RLS on and no policy,
-- so only your server (secret key) gets in
alter table public.payments enable row level security;
Run the 2-minute check again, both parts. Every private table should say rls_on = true, and the second part should show no true read rule for anon or public on any of them. The only true left should be the sign-up insert. Then click through your app as a normal user, because a table with RLS on and no policy blocks everything, and a page that used to load can go blank.
Building in Lovable without a coding tool? Paste this into its chat:
Turn on row level security on every table in my Supabase database. Replace any policy that uses "true" on private data with one that lets each signed-in user read and change only their own rows (owner column = auth.uid()). Keep sign-up forms insert-only. Show me the SQL before you run it.
What still catches people
to authenticated using (true)feels safe because it needs a login. Anyone can sign up, so it isn't.- A column like
plan,roleorcreditsin a table users can update. They can update it too. Keep those in a table only your server writes. - A secret key in a
VITE_orNEXT_PUBLIC_variable. Those go to the browser. If aservice_rolekey was ever there, change it in Supabase, because it's already out.
Questions
Isn't the public key a secret?
No. It's meant to be in your page. It's only safe when every table it can reach has RLS on with the right policies.
Doesn't Supabase turn RLS on by itself?
Only for tables you make in the Table Editor. Tables made with SQL or migrations, which is how AI tools make them, start with it off.
Does this cover one user reading another user's data?
Not fully. This guide is about strangers with your public key. A signed-in user opening someone else's records is its own test: who can see whose data.
Can I run this on someone else's app?
Only with their written permission. Reading another company's database because their key was in the page can still break computer misuse laws.
Before you launch
This is one check. Launch Gate runs six in one go on a test copy of your app, this one included, and gives you one page of results with proof. Members get it inside their own AI.
VXSec Membership
$19a month, or $190 a year
- Workspace Setup
- AI Reach Map
- Agent Brakes
- Launch Gate
- Leaver Check
- Every new helper, the day it's out
New members first month $7, then $19 a month. Cancel anytime.
Rather have it done for you? I fix it $150 and up, 20% off for members · Launch Review $297 once, I check and fix the top 3 · Built for you $1,500 a month and up
Want to try it on an app built to be broken first? Open the practice lab.