Tarik Al Hadethi Download CV

170 Supabase apps were leaking their whole database. Here is how to check yours.

If you built an app on Supabase with Lovable, Bolt, Cursor or v0, there is a real chance that right now anyone can read your users, your payments and your API keys, using a key that is already sitting in your own frontend. Here is how that happens, and the five-minute check that tells you whether it is you.

What happened

In early 2025 a scan of 1,645 apps built on Lovable found 170 of them, about one in ten, with their databases wide open. Anyone could read emails, payment details and API keys straight out of them. It got its own CVE, CVE-2025-48757, rated 9.3 out of 10. None of these apps were hacked in any clever sense. They shipped with the front door unlocked.

Why it happens, the one thing to understand

To talk to your database from the browser, every Supabase app carries two things in the page: your project URL and a public key. This is normal and it is meant to be there. Anyone who opens your site can read that key out of the browser network tab in about ten seconds. That is fine, on one condition.

The public key is only safe because of a feature called Row Level Security, or RLS. RLS is a set of rules on each table that decides which rows a request is allowed to see. With RLS on and written correctly, the public key can read only what your rules allow. With RLS off, the public key can read and write the entire table. There is nothing in between. The tools that generate these apps do not turn RLS on for you, and the dashboard does not force you to.

So the whole security of your app often comes down to whether someone remembered to switch on a feature, for every table, correctly. That is the gap, and it is wider than people think.

The five ways it goes wrong

I have run into several of these while hardening my own app.

1. RLS was never turned on. The most common one, and it is the CVE. The table works, the app works, and the public key can pull every row in it. Nothing looks broken, which is exactly why it survives to production.

2. RLS is on, but the policy is using (true). This is the sneaky one. The dashboard shows the table as protected, with a policy attached and a reassuring green light. But a policy of using (true) means “allow every row,” so it protects nothing. It looks the safest of all and is exactly as open as the first case.

3. Secrets are sitting in a reachable table. A table holding Stripe keys, model API keys, or webhook secrets, behind the same public key. If the table is reachable, those are readable, and then someone can spend your money or send mail as you.

4. Writes were left open. Reading your data is bad. Writing to it is worse. If the public key can update rows and nothing checks what it may write, a stranger can change other people’s records, or flip their own account to admin. That last one is not theoretical. It is often one line.

5. A fix that looks applied but does nothing. This one is quiet, and it caught me on my own database. If you try to hide a single sensitive column by revoking access to just that column, it does nothing at all while the role still has access to the table. The revoke command succeeds, you believe the column is hidden, and it is still readable. The protection has to come from RLS, not from a column revoke.

There is a sixth, and it is the worst: the secret key, the one that is supposed to stay on your backend, ends up in the frontend by mistake. That key bypasses RLS completely, so if it is in your page, none of the above matters and everything is open. It is rare but it is fatal, so rule it out first.

How to check your own app

None of this needs any tools, and you should only ever run it against your own app.

1. Confirm the key in your frontend is the public one, not the secret one. If your key is a long token in three dot-separated parts, paste it into jwt.io and read the role field: it must say anon. If it says service_role, stop and rotate it now, that key must never reach a browser. If instead your key starts with sb_publishable_ it is the safe public one; a key starting with sb_secret_ must never be in the frontend.

2. List which tables actually have RLS on. In the Supabase dashboard open the SQL editor and run:

select tablename, rowsecurity
from pg_tables
where schemaname = 'public';

Every table that holds real data should show rowsecurity = true. Any false is an open table.

3. Read the policies on the tables that do have RLS. Open each table’s policies. If a policy’s condition is just true, it is not protecting anything. A real policy names the user, something like auth.uid() = user_id.

4. Ask the plain question. Does any table hold secrets, or one user’s private data, and is there actually a rule scoping it to the right person? If you are not sure, it probably is not scoped.

If you find one

Turn RLS on for the table, then add a policy that scopes rows to their owner. Replace any using (true) with a real condition. Move secrets out of client-reachable tables, and rotate any key that was exposed, because you have to assume it leaked. Then do the part most people skip: test it. Hit the table again with the public key and confirm it is now empty or denied, and confirm your real users can still see their own data. A fix you did not re-test is a guess.

I found the column-revoke trap on my own database, which is why I re-attack every fix with the public key before I call it done.

Written while building Clarus.  ·  More writing