r/Supabase • u/Status_Ad8999 • 11h ago
tips Quick way I audit Supabase RLS leaks using only HEAD + Prefer: count=exact
When I review Supabase projects built quickly with Lovable or Bolt, the most common leak is forgetting to enable RLS on a table or leaving a broad SELECT policy for anon.
Instead of pulling actual rows from someone's database during a quick check, you can send a HEAD request to /rest/v1/<table> with the public anon key and Prefer: count=exact. PostgREST returns the exposed row count inside the Content-Range header (for example */142) with an empty response body, so you immediately know whether unauthenticated reads are open without downloading user data.
I wrapped that check together with OpenAPI table discovery, rpc/ probing, and public storage bucket checks into a small open-source CLI (npx supabase-rls-check) and a browser checker. Attached is a sample audit output showing exposed tables and generated ALTER TABLE ... ENABLE ROW LEVEL SECURITY fixes.
Source is on GitHub if you want to run it locally in CI: https://github.com/Tthanh2k6/supabase-rls-check
Curious if anyone here also checks anything else automatically on anon before shipping, like auth.users views or SECURITY DEFINER RPCs?
