Supabase RLS checker: Row Level Security on every table
SniffPup, a free passive security scanner for vibe-coded apps, tests the result of your Supabase RLS from the outside: with only your public anon key, it sends read-only HEAD requests to up to 8 tables. It can't see the policies themselves, so also run the SQL checks below.
In more detail: your Supabase anon key ships to every visitor, so Row Level Security (RLS) is the only thing between a stranger and your tables. Check two things: that RLS is on for every table in the public schema, and that no policy lets everyone through (for example using (true) on user data). The SQL and tests below take about ten minutes. Only test projects you own.
Where SniffPup fits: a free SniffPup scan of your live URL checks the outside of your app: secret keys in your HTML and JavaScript (including Supabase service_role and sb_secret_ keys, which bypass RLS), public /.env and /.git files, a public source map and your security headers. It also tells you if your site talks to Supabase. The free scan can't see your RLS policies, but it does test their result from the outside: with only the public anon key your site already ships, it sends one read-only HEAD request per table, up to 8, to see whether an anonymous visitor can read rows, without downloading rows or writing anything. On the Pro plan ($29/mo), after you prove you own the site, the deep Supabase check uses your site's public anon key, read-only, to count which tables an anonymous visitor can read, which storage buckets are public or listable, and what your GraphQL API shows signed-out visitors. It never downloads rows and never writes anything.
1. Run the Supabase Security Advisor
In the Supabase dashboard, open Advisors, then Security Advisor. Look for RLS Disabled in Public (a table anyone with your project URL and key can read and change), Permissive RLS Policy (an always-true policy such as using (true)) and Security Definer View (a view that ignores the RLS of the tables beneath it). Fix every error-level finding before you launch.
2. List tables with RLS turned off
Run this in the SQL editor. Every row it returns is a table the API can serve without any row filtering:
select schemaname, tablename
from pg_tables
where schemaname = 'public'
and rowsecurity = false;Turn RLS on for each one, then add policies (with RLS on and no policies, the anon and authenticated roles get no rows at all):
alter table public.your_table enable row level security;Tables you create in the dashboard Table Editor get RLS by default. Tables created with raw SQL or migrations don't, which is how AI-generated migrations often leave one open.
3. Read your policies
select tablename, policyname, roles, cmd, qual, with_check
from pg_policies
where schemaname = 'public'
order by tablename;qual is the using condition (which rows can be read or changed) and with_check is what new or updated rows must satisfy. A value of true means everyone in roles passes. That's fine for a public product list, and a leak for profiles, orders or messages.
4. Test with your anon key, the way a stranger would
Copy your project URL and anon (or sb_publishable_) key from your own frontend or the dashboard API settings, then ask for one row of a table that should be private:
curl "https://YOUR_REF.supabase.co/rest/v1/profiles?select=*&limit=1" \
-H "apikey: YOUR_ANON_KEY" \
-H "Authorization: Bearer YOUR_ANON_KEY"If you get a row back, anonymous visitors can read that table. An empty [] means RLS hid the rows (or the table is empty). With a new sb_publishable_ key, send only the apikey header. Reads are only half of it: also check that your insert, update and delete policies don't allow the anon role, using the policy list from step 3 rather than writing test data into production.
5. Test as two different users
Sign up two test accounts. Signed in as user B, try to load user A's rows (in the app, or with the same curl using user B's access token as the Bearer value). If B can see A's data, the policy checks that someone is signed in but not that the row belongs to them. Supabase's database testing docs show how to write pgTAP tests so this stays checked.
Common RLS mistakes
using (true)on a table with user data, often a placeholder that was never replaced. Use an owner check such asusing ((select auth.uid()) = user_id).- An update policy with a real
usingclause butwith check (true), or an insert policy withwith check (true): users can write any values, including someone else'suser_id. - A policy "for authenticated" that only checks the user is signed in. With open sign-ups, that's anyone on the internet.
- Policies that trust
user_metadatafrom the JWT (for example anis_adminflag). Users can edit their own user_metadata. - Views in the
publicschema created withoutsecurity_invoker = on, which ignore the RLS on the tables beneath them. - A
service_roleorsb_secret_key in the frontend. It bypasses RLS completely, so perfect policies don't help. Rotate it and move that code server-side. - Public storage buckets holding user uploads. Public is fine for logos, not for invoices or IDs.
- Turning RLS off because all access moved to your own server. That doesn't lock out your anon key: with RLS off, any role that still has a grant on the table can read and write it, and on many projects new
publictables grant every privilege toanonandauthenticatedby default. Leave RLS on with no policies and runrevoke all on table public.your_table from anon, authenticated;for tables only your server uses. See Supabase's RLS docs on grants and policies.
Need a correct policy to replace a broken one? Supabase RLS policy examples has copy-paste policies for private rows, public read with owner-only writes, teams, admin roles, insert-only forms and storage folders. Row security never applies to TRUNCATE, and GRANT ALL includes that privilege: see GRANT ALL and TRUNCATE under RLS.
What SniffPup checks
The free scan of your published URL looks for leaked secrets (masked in the report), public .env/.git/.npmrc/.DS_Store files, credential files, SQL dumps and backups, the source map your JavaScript points to, security headers, cookie flags, HTTPS redirects and what AI crawlers can read. It lists every issue by title and severity and shows every critical issue in full with its fix, free (with no critical, one other fix is free). A one-time $9 Full Fix Report unlocks the explanation, evidence and copy-paste fix prompt for every finding plus 30 days of re-scans; plans start at $7/mo. The deep Supabase check described above is part of Pro. See exactly what the scanner does, pricing and the short post Is your Supabase table open to everyone?
FAQ
Can SniffPup's free scan check my Supabase RLS policies?
Not the policies themselves. The free scan works from your live website, so it can't see your RLS policies. When it finds your Supabase project URL in your HTML or JavaScript, it tells you your site talks to Supabase and notes whether the public anon or publishable key is there too (that one is meant to be public). With only that public key, it sends one read-only HEAD request per table, up to 8, to see whether an anonymous visitor can read rows. It never downloads rows and never writes. It also flags a service_role or sb_secret key as critical, because those bypass Row Level Security. A clean result isn't proof your RLS is correct.
What does the Pro deep Supabase check do?
After you prove you own the site (a DNS TXT record or a /.well-known file), the Pro deep check uses your site's public anon key, read-only. It lists the tables your API exposes (up to 30, or tries common names like users, profiles and orders if that list isn't available), asks for a row count on each without downloading any rows, and reports tables an anonymous visitor can read. It also lists storage buckets it can see that are marked public, counts the files a stranger can list in up to 10 of them (never file names), and checks whether your GraphQL API answers signed-out visitors, shows its schema or lists write operations (never run). It never inserts, updates or deletes anything and never stores row data.
Does a clean deep check mean my RLS is correct?
No. It only tests anonymous reads. It doesn't test writes, signed-in users reading each other's rows, or tables outside the ones it can find. Run the SQL checks and the two-user test in this guide as well.
Is it safe that my Supabase anon key is in my frontend?
Yes, the anon or sb_publishable_ key is designed to be public. It is only safe if every table in an exposed schema has RLS turned on with policies that match who should see what.
I moved all database access to my own server. Can I just turn RLS off?
No. Turning RLS off doesn't lock out your anon key. A table in an exposed schema with RLS off is readable and writable by any role that still has a grant on it, and on many Supabase projects new tables in public grant every privilege to anon and authenticated by default. Leave RLS on with no policies (anon and authenticated then get no rows, and your server's service role key still works), revoke the anon and authenticated grants on the tables only your server uses, and keep the service role key on the server.
Can SniffPup check my mobile app's Supabase backend?
SniffPup scans live web URLs, and its Mobile app scan checks app builds you export yourself. The website URL scan can check a Supabase backend only through a live website.
Can SniffPup check my Supabase project's settings from the inside?
Yes, if you connect it. Sign in to SniffPup, open Sniff & Fix and connect your Supabase project with read-only access on Supabase's own page. SniffPup then reads your Security Advisor results, which tables have row level security, your policy rules, risky functions, storage bucket settings and sign-in settings. It never reads the rows in your tables and never changes your project. The check is free with any SniffPup account: you get a score out of 100 (worked out the same way as the site Sniff score) and see every finding, and each critical one comes with its fix steps, SQL and an AI prompt. Fixes for the other findings, your last result and re-checks are part of Solo and up.
A clean report is not a guarantee of security.