</>RescueMyRepoFree scan

// free tool · Supabase · RLS · runs in your browser

Free Supabase RLS policy checker

Run one read-only query, paste the result, and see which tables anyone with your public anon key can read or change, with the SQL to fix each one. It catches what the dashboard's “RLS enabled” badge doesn't: policies that are true for every row.

Step 1 · run this in the Supabase SQL editor

-- RescueMyRepo free RLS checker. Read-only: it reads the catalog, never your rows.
-- Exposing another schema through the Data API? Add it to both "in ('public')" lists.
select json_build_object(
  'v', 1,
  'tables', (
    select coalesce(json_agg(json_build_object(
      'schema', n.nspname,
      'name', c.relname,
      'kind', c.relkind::text,
      'rls', c.relrowsecurity,
      'invoker', coalesce(c.reloptions::text[] && array['security_invoker=true','security_invoker=on','security_invoker=1','security_invoker=yes'], false),
      'anon', array_remove(array[
        case when has_any_column_privilege('anon', c.oid, 'SELECT') then 'SELECT' end,
        case when has_any_column_privilege('anon', c.oid, 'INSERT') then 'INSERT' end,
        case when has_any_column_privilege('anon', c.oid, 'UPDATE') then 'UPDATE' end,
        case when has_table_privilege('anon', c.oid, 'DELETE') then 'DELETE' end], null),
      'authenticated', array_remove(array[
        case when has_any_column_privilege('authenticated', c.oid, 'SELECT') then 'SELECT' end,
        case when has_any_column_privilege('authenticated', c.oid, 'INSERT') then 'INSERT' end,
        case when has_any_column_privilege('authenticated', c.oid, 'UPDATE') then 'UPDATE' end,
        case when has_table_privilege('authenticated', c.oid, 'DELETE') then 'DELETE' end], null)
    ) order by n.nspname, c.relname), '[]'::json)
    from pg_class c
    join pg_namespace n on n.oid = c.relnamespace
    where n.nspname in ('public') and c.relkind in ('r', 'p', 'v', 'm')
  ),
  'policies', (
    select coalesce(json_agg(json_build_object(
      'schema', schemaname, 'table', tablename, 'name', policyname,
      'permissive', permissive, 'roles', roles, 'cmd', cmd,
      'qual', qual, 'with_check', with_check
    ) order by schemaname, tablename, policyname), '[]'::json)
    from pg_policies
    where schemaname in ('public')
  )
) as rls_report;

It only reads Postgres' catalog (table settings, grants and policy text). No rows from your tables, no keys.

Step 2 · paste the rls_report value

Runs in your browser. Nothing you paste is sent anywhere.

What it checks

RuleSeverityWhat it means
table-rls-offCriticalRLS is off on a table anon or authenticated has grants on. Supabase: such a table "is readable and writable by any role with a grant on it." Policies on it are ignored until RLS is enabled.
policy-always-trueCritical to infousing (true) / with check (true). UPDATE, DELETE or ALL for anon is critical; reads of private-looking tables are high; obvious public content (products, posts, prices) is info.
policy-login-onlyHigh on private tablesauth.uid() is not null or auth.role() = 'authenticated': checks that someone is logged in, not whose row it is.
policy-uid-is-nullCritical / highAn "or auth.uid() is null" branch, which every logged-out request passes.
policy-self-compareHighA column compared with itself, including the subquery mix-up Postgres stores as (m.org_id = m.org_id).
policy-user-metadataHighPolicies that read user_metadata, which users can edit for themselves.
view-bypasses-rlsHighViews without security_invoker that anon or authenticated can select: they run with the owner's rights and skip RLS.
matview-exposedHighMaterialized views readable through the API. They can't have RLS.

Policies are permissive by default, and the PostgreSQL CREATE POLICY docs say all permissive policies for a query are combined with OR, so one always-true policy opens the table no matter how strict the others are. Restrictive policies and policies only for service_role are skipped. Severity also depends on grants: a using (true) policy on a table anon has no grant on only exposes it to signed-in users. Each rule was tested on real PostgreSQL with bad and correct policies, and on the migrations of open-source Supabase apps (Basejump, Vercel's subscription starter, Supabase's own examples).

Then prove it with two users and anon

Policy text can look right and still be wrong for your data. This transaction shows what each role really gets, and rolls back:

begin;
set local role authenticated;
set local request.jwt.claim.sub = '<user A uuid>';
select count(*) from public.orders;   -- only A's rows

set local request.jwt.claim.sub = '<user B uuid>';
select count(*) from public.orders;   -- only B's rows

set local role anon;
set local request.jwt.claim.sub = '';
select count(*) from public.orders;   -- expect 0 (or a permission error)
rollback;

What the database can't show you

Your repo can leak around good policies: a service_role or sb_secret_ key in browser code or git history, Drizzle or Prisma connecting as postgres (which bypasses RLS), security definer functions anyone can call, unverified Stripe webhooks. The free repo scan checks those and your migrations in about a minute.

FAQ

Is it safe to paste my policies here?

The checker is plain JavaScript that runs in your browser tab; the page doesn't send what you paste anywhere. The query itself only reads Postgres' catalog (table names, whether RLS is on, the privileges anon and authenticated have, and policy conditions). It returns no rows from your tables and no keys.

Why do I need the grants, not just pg_policies?

Two reasons. A table with RLS off has no policies to look at, so pg_policies alone can't show the worst case. And since Supabase's grant change, a table anon has no grant on isn't reachable by anon even with using (true). The query reports grants with has_any_column_privilege and has_table_privilege, so findings reflect who can actually reach each table.

Can I paste a plain pg_policies export instead?

Yes. Paste a JSON array of pg_policies rows (policyname, roles, cmd, qual, with_check) and the policy checks run. Without the tables part it can't check RLS on/off, grants or views, and it assumes anon has grants.

It flagged a policy I meant to be public.

Public read policies are fine for public data: products, prices, published posts. The checker ranks those as info when the table name looks like public content and medium or high when it looks personal (users, profiles, orders, messages, invoices). Check which columns the table really has.

What doesn't this catch?

It reads policy text, so it can't prove a condition is right for your data model (for example an owner check on the wrong column), and it can't see your app. The service_role or sb_secret_ key in browser code or git history, Drizzle or Prisma queries that bypass RLS, security definer functions anyone can call, and webhooks without signature checks need the repo scan.

Does it work outside the public schema?

Edit both in ('public') lists in the query to include every schema you expose through the Data API, for example in ('public', 'api').

Sources

Behavior per the linked docs, read Dec 4, 2026. Query and rules tested on PostgreSQL. Not a penetration test.