How to check your Supabase row level security is actually working
Step 1: find tables with RLS switched off
In the Supabase SQL editor for your own project, this lists every table in the public schema and whether row level security is on:
select tablename, rowsecurity
from pg_tables
where schemaname = 'public'
order by rowsecurity, tablename;
Step 2: read every policy
This lists each policy, the command it covers and its condition:
select tablename, policyname, cmd, roles, qual, with_check
from pg_policies
where schemaname = 'public'
order by tablename;
- Red flag:
qualorwith_checkis justtrue. That rule allows every row. - Red flag: the role is
authenticatedwith no owner condition. Anyone who signs up can read or change every row. - Red flag: the select rule is right, but the insert, update or delete rule is loose. (With RLS on, a command with no policy at all is denied.)
- Good sign: conditions like
auth.uid() = user_id, or a check that the user belongs to the row's team. - A table with RLS on and no policies does not appear in this list at all. That is safe: with no policy, the API returns no rows.
Step 3: test as two different people
- Create two test accounts in your own app, A and B. Give each some data.
- Signed in as B, try to open A's records by changing the id in the page address or request.
- Signed out, in a private window, try the same private pages and requests.
- For each table, B should see only B's rows, and a signed-out visitor should see nothing private.
Why "RLS is enabled" is not the answer
Having a database security rule is not the same as having a correct one. The CVE-2025-48757 write-up found that, at the time (May 2025), a built-in scanner only checked the first. In that write-up, researchers found 170 of 1,645 showcase apps on one AI app builder (about 10%) had database rules weak enough to expose data from homepage requests alone.
The same write-up showed how weak database rules let a signed-out visitor insert a record already marked as paid, bypassing Stripe. So check insert and update rules as carefully as read rules, especially on tables with status, role, price or plan columns.
Fixing a bad policy
Replace a loose rule with one tied to the owner, for example a select and update policy using auth.uid() = user_id, and a with check clause on insert and update so users cannot write rows for someone else. Columns like role, plan or payment status should not be writable by the user at all: change them only from the server, with a key that never reaches the browser.
If you want a second pair of eyes, the Irth Labs App Health Check ($490) reviews every table's rules and tells you, in plain language, which ones let strangers in, with a fixed price to fix them.
1. Run the free local check
npx caelo .
Caelo is a free, open source (MIT) command line tool and MCP server from Irth Labs that checks the files of an AI-built app for exposed API keys, Supabase and Firebase misconfigurations and .env files with real values. It runs on your machine, uploads nothing and uses no AI model. Each finding comes with a plain-English fix.
2. Act on a finding
Follow the fix in your report and run Caelo again. If Git could commit an untracked file containing secrets, preview a US$19 quick fix for that file.
For findings that need an engineer, Irth Labs offers a US$490 App Health Check. You receive a written report within 48 hours and a fixed repair quote. The fee counts toward the repair if you proceed.
Questions
Does the service_role key respect RLS?
No. The service_role key bypasses every row level security policy. Use it only on a server you control, never in browser code, mobile apps or a public repository.
Is enabling RLS with no policies safe?
It blocks all access through the public API, which is safe but usually breaks the app. Then someone adds a policy of true to make it work again, which is the unsafe version. Write policies tied to the owner instead.
Can I test RLS without writing SQL?
Yes. Use two test accounts in your own app and a private window, and try to open each other's records. If B can see A's data, a policy is wrong.
Is there a tool that checks Supabase RLS and leaked keys before launch?
Three checks cover different ground. Caelo (npx caelo .) is a free, open source local check that reads the SQL files in your project and flags policies written as using (true) or with check (true), files that create a table without enabling row level security, and a service_role key anywhere in your files. Supabase Security Advisor checks the live project in the dashboard. Neither can tell whether a policy matches what your app intends, so still run the two-user test above.