Find gaps in your Supabase RLS policies
Supabase row level security decides which database rows a caller may read or change. A policy can allow too much or block a legitimate operation.
npm install --save-dev @sitecmd/cli
npx sitecmd audit .
The CLI runs on your computer or in your CI, and your code stays there.
What it finds on a demo project
The CLI reads your Supabase migrations and schemas alongside the browser code that queries each table. It reports tables without row level security, tables or operations with no policy, policies with no per-user condition and service-role keys in browser code.
SiteCMD CLI 2.0.0
Demo project: Supabase app with row level security gaps
npx sitecmd audit .
SiteCMD Code Scan - .
Checked: November 9, 2026
Framework: Express
Issues: 6 total | critical 0 | high 2 | medium 4 | low 0
High (2)
- [Database Analysis · security] Client-facing Supabase code references a service-role credential name - src/components/AdminPanel.jsx:3
- [Database Analysis · security] Client-facing Supabase write policy has an unconditional row condition - supabase/migrations/20260101000000_init.sql:13
Medium (4)
- [Database Analysis · data] Client-facing Supabase operation has no matching local RLS policy - src/components/Dashboard.jsx:8
- [Database Analysis · data] Client-facing Supabase table has RLS enabled but no local policies - src/components/Dashboard.jsx:7
- [Database Analysis · security] No recognized local RLS enablement for a client-accessed Supabase table - src/components/Dashboard.jsx:6
- [Database Analysis · security] Client-facing Supabase write policy has no clear per-row caller boundary - supabase/migrations/20260101000000_init.sql:16
Your code passes? Now watch your site.
Understand how Supabase row level security grants access
Enabling RLS doesn't create a policy. With RLS enabled, table data stays unavailable through a publishable key until policies allow access. Allow only the operations and rows the caller needs.
For a user-owned table, a policy can link the signed-in user to the row owner. Read the Supabase RLS guide before adapting a policy to your data.
Test Supabase RLS policies with different users
- 1
Try the intended database operation
Use a local or staging project and the same role your app uses. Confirm the user can read or change the rows the policy is meant to allow.
- 2
Try another user's rows
Repeat the operation as a second user and while signed out. Include writes; permission to read a row doesn't mean permission to change it.
- 3
Write the tests down
Save these allow and deny cases as a SQL test file under supabase/tests and run them with supabase test db.
Frequently asked questions
Why is my Supabase RLS policy not working?
Start with the operation, role and policy condition. For example, auth.uid() is null without an authenticated user, so auth.uid() = user_id doesn't match that request. Check the table grant separately.
Can a Supabase secret key or service-role key go in browser code?
No. Both bypass row level security, so Supabase says never to use them in the browser. Supabase is deprecating the service_
Review app authorization alongside Supabase RLS
Website security
Catch leaked API keys and exposed files before someone uses them against you.
IDOR and tenant isolation
Look for app queries that trust an ID without checking who may use it.
Secrets in your code
Find possible credentials in source and configuration before sharing the project.