When you ship a Supabase app generated with Bolt, Lovable, or Cursor, the dashboard can show a green RLS badge on every table while your public anon key can still read every row.
That usually happens for one of four reasons:
- The AI ran
ENABLE ROW LEVEL SECURITYand then addedCREATE POLICY ... FOR SELECT USING (true)to make an early prototype error go away. - A
service_roleJWT or third-party API key landed in the compiled Vite/Next.js client bundle. - A Postgres view queries an RLS-protected table without
WITH (security_invoker = true), so the view executes with the owner's privileges and skips RLS. - A
SECURITY DEFINERfunction is missing a fixedSET search_path = ''.
Checking row exposure without downloading user data
If you want to verify what an unauthenticated visitor can read from your own deployed project without pulling a single byte of user PII into your terminal or logs, PostgREST supports HEAD requests combined with Prefer: count=exact.
First, list the exposed tables from the OpenAPI spec:
curl -s "https://YOUR_REF.supabase.co/rest/v1/" \ -H "apikey: YOUR_ANON_KEY" | jq '.paths | keys' Then run a HEAD probe against each table:
curl -I -s "https://YOUR_REF.supabase.co/rest/v1/profiles?select=*" \ -H "apikey: YOUR_ANON_KEY" \ -H "Authorization: Bearer YOUR_ANON_KEY" \ -H "Prefer: count=exact" Look at the response status and Content-Range header. If it returns 200 OK with Content-Range: */1284, any visitor holding the public anon key from your frontend bundle can read all 1,284 rows. Because the method is HEAD, the response body is empty and zero rows are transferred.
Automating the check before launch
Running those curls by hand gets tedious once a project has 10+ tables and several client JS chunks. I wrapped the exact HEAD count probe, client bundle secret scan, and static schema.sql parser into a free read-only web checker so you can sanity-check your own app in ~10 seconds without signing up:
https://rlsguard-rho.vercel.app
It supports two modes:
- Live URL scan (with an ownership checkbox): reads public JS chunks for leaked keys and runs read-only
HEADcount probes against discovered PostgREST tables. - Paste
schema.sql: checks locally for missingENABLE ROW LEVEL SECURITY,USING (true)policies, views withoutsecurity_invoker = true, andSECURITY DEFINERfunctions withoutsearch_path.
Quick SQL fixes for the two quietest bugs
For views that silently bypass RLS:
ALTER VIEW public.your_view SET (security_invoker = true); For USING (true) policies on user-owned tables:
DROP POLICY IF EXISTS "allow_read_all" ON public.profiles; CREATE POLICY "profiles_select_own" ON public.profiles FOR SELECT TO authenticated USING ((select auth.uid()) = id); If you run the scanner on your own schema and hit a false positive or weird SQL syntax it misses, drop a comment and I will patch the parser.