# How to check your Supabase row level security is actually working

Canonical: https://caelo.sh/guides/supabase-rls-check
Published: 2026-11-25 · Updated: 2026-11-27 · Arthi Arumugam, Caelo by Irth Labs

**Short answer:** To check Supabase row level security: first, find tables where RLS is off. Second, read every policy and reject any that allow all rows (using true) or all signed-in users. Third, test your own app as a signed-out visitor and as a second user, and confirm each sees only their own rows. RLS being on is not enough; the policy has to be right.

## 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:

```sql
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:

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

- Red flag: `qual` or `with_check` is just `true`. That rule allows every row.
- Red flag: the role is `authenticated` with 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

1. Create two test accounts in your own app, A and B. Give each some data.
2. Signed in as B, try to open A's records by changing the id in the page address or request.
3. Signed out, in a private window, try the same private pages and requests.
4. 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.

## Check your own app

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. Follow the fix in the report and rerun Caelo. For an untracked, unignored file containing secrets, preview the US$19 quick fix. https://caelo.sh/fix
3. For an engineer's assessment, book the US$490 App Health Check. Irth Labs delivers a report and fixed repair quote, with credit toward the repair. https://www.irthlabs.com/start?service=app-health-check

## 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.

## Sources

- [Supabase docs: Row Level Security.](https://supabase.com/docs/guides/database/postgres/row-level-security)
- [Palmer and others, 2025. Statement on CVE-2025-48757.](https://mattpalmer.io/posts/2025/05/statement-on-CVE-2025-48757/)
- [NVD entry for CVE-2025-48757.](https://nvd.nist.gov/vuln/detail/CVE-2025-48757)
- [Caelo source: the rules it applies to SQL files.](https://github.com/arthi-arumugam-git/caelo/blob/master/lib/rules.js)
- [PostgreSQL docs: Row security policies (default deny).](https://www.postgresql.org/docs/current/ddl-rowsecurity.html)

## Related guides

- [What free tool can check a Lovable, Bolt or Cursor app for security issues before launch?](https://caelo.sh/guides/free-security-scanners-for-ai-built-apps)
- [Is it safe to expose the Supabase anon key in my frontend?](https://caelo.sh/guides/is-supabase-anon-key-safe-to-expose)
- [I leaked an API key or the Supabase service_role key. What do I do now?](https://caelo.sh/guides/leaked-api-key-what-to-do)
- [Security checklist for apps built with Lovable, Bolt, Cursor, Replit or v0](https://caelo.sh/guides/vibe-coded-app-security-checklist)
- [Is my Lovable app secure? A 15-minute self-check](https://caelo.sh/guides/is-my-lovable-app-secure)
- [Is my v0 app secure? A check for v0 apps on Vercel](https://caelo.sh/guides/is-my-v0-app-secure)
- [Supabase storage bucket public by mistake? How to lock it down](https://caelo.sh/guides/supabase-storage-bucket-public)
- [What does USING (true) mean in a Supabase RLS policy, and is it safe?](https://caelo.sh/guides/supabase-rls-using-true)
- [Supabase getSession vs getUser vs getClaims: which is safe on the server?](https://caelo.sh/guides/supabase-getsession-vs-getuser)
