V.I.B.Eby TNAADO

Supabase security check

See which tables and file rules let strangers in.

Check my database
  • Customer table is open
  • V.I.B.E reads your database rules
  • Table rule is fixed

Query

Read-only. It lists table rules, file storage rules and permissions, and changes nothing.

View the query
-- V.I.B.E database check. Read-only: it lists table rules, file storage rules and
-- permissions from the system catalogs. It does not read, change or delete any rows.
with api(role) as (values ('anon'), ('authenticated')),
listed as (
  -- Schemas the web API is set to serve, where that setting is kept in the database.
  select pg_catalog.btrim(part.name, ' "') as name
  from pg_catalog.pg_db_role_setting s
  join pg_catalog.pg_roles r on r.oid = s.setrole
  cross join lateral pg_catalog.unnest(s.setconfig) as c(item)
  cross join lateral pg_catalog.unnest(pg_catalog.string_to_array(pg_catalog.split_part(c.item, '=', 2), ',')) as part(name)
  where r.rolname = 'authenticator' and pg_catalog.starts_with(c.item, 'pgrst.db_schemas=')
    and s.setdatabase in (0, (select d.oid from pg_catalog.pg_database d where d.datname = pg_catalog.current_database()))
),
spaces as (
  select n.oid, n.nspname from pg_catalog.pg_namespace n
  where n.nspname = 'public' or (
    n.nspname::text !~ '^(pg_|_)' and n.nspname not in ('information_schema', 'auth', 'storage', 'extensions',
      'graphql', 'graphql_public', 'realtime', 'vault', 'pgsodium', 'pgsodium_masks', 'supabase_functions',
      'supabase_migrations', 'supavisor', 'net', 'cron', 'pgbouncer', 'pgmq')
    and exists (select 1 from api a join pg_catalog.pg_roles r on r.rolname = a.role
      where pg_catalog.has_schema_privilege(r.oid, n.oid, 'usage')))
),
reach as (
  select s.oid as space, a.role from api a
  join pg_catalog.pg_roles r on r.rolname = a.role
  cross join (select oid from spaces union select n.oid from pg_catalog.pg_namespace n where n.nspname = 'storage') s
  where pg_catalog.has_schema_privilege(r.oid, s.oid, 'usage')
),
rel as (
  select c.oid, c.relnamespace as space, c.relkind, c.relrowsecurity, c.reloptions, s.nspname,
    case when s.nspname = 'public' then c.relname::text else s.nspname::text || '.' || c.relname::text end as label
  from pg_catalog.pg_class c join spaces s on s.oid = c.relnamespace
  where c.relkind in ('r', 'p', 'v', 'm', 'f')
    and not exists (select 1 from pg_catalog.pg_depend d
      where d.classid = 'pg_catalog.pg_class'::pg_catalog.regclass::pg_catalog.oid and d.objid = c.oid and d.deptype = 'e')
),
files as (
  select c.oid, c.relnamespace as space, c.relkind, c.relrowsecurity
  from pg_catalog.pg_class c join pg_catalog.pg_namespace n on n.oid = c.relnamespace
  where n.nspname = 'storage' and c.relname = 'objects' and c.relkind in ('r', 'p')
),
target as (
  select oid, space, relkind from rel union all select oid, space, relkind from files
),
grants as (
  select target.oid, reach.role, pg_catalog.array_remove(array[
    case when pg_catalog.has_any_column_privilege(reach.role, target.oid, 'select') then 'read' end,
    case when pg_catalog.has_any_column_privilege(reach.role, target.oid, 'insert') and target.relkind <> 'm'
      and (target.relkind <> 'v' or pg_catalog.pg_relation_is_updatable(target.oid, true) & 8 <> 0) then 'add' end,
    case when pg_catalog.has_any_column_privilege(reach.role, target.oid, 'update') and target.relkind <> 'm'
      and (target.relkind <> 'v' or pg_catalog.pg_relation_is_updatable(target.oid, true) & 4 <> 0) then 'change' end,
    case when pg_catalog.has_table_privilege(reach.role, target.oid, 'delete') and target.relkind <> 'm'
      and (target.relkind <> 'v' or pg_catalog.pg_relation_is_updatable(target.oid, true) & 16 <> 0) then 'delete' end
  ], null) as can,
  pg_catalog.array_remove(array[
    case when target.relkind in ('r', 'p', 'f') and pg_catalog.has_table_privilege(reach.role, target.oid, 'truncate') then 'truncate' end,
    case when target.relkind in ('r', 'p', 'f') and pg_catalog.has_table_privilege(reach.role, target.oid, 'trigger') then 'trigger' end
  ], null) as extra,
  not pg_catalog.has_table_privilege(reach.role, target.oid, 'select') as some_columns
  from target join reach on reach.space = target.space
),
definer as (
  select f.oid, f.proname, f.prokind, s.nspname,
    case when s.nspname = 'public' then f.proname::text else s.nspname::text || '.' || f.proname::text end as label,
    pg_catalog.pg_get_function_identity_arguments(f.oid) as args,
    f.prorettype in ('pg_catalog.trigger'::pg_catalog.regtype::pg_catalog.oid,
      'pg_catalog.event_trigger'::pg_catalog.regtype::pg_catalog.oid) as is_trigger,
    exists (select 1 from pg_catalog.unnest(f.proconfig) as setting(item)
      where pg_catalog.starts_with(setting.item, 'search_path=')) as fixed_path,
    exists (select 1 from reach where reach.space = s.oid and role = 'anon')
      and pg_catalog.has_function_privilege('anon', f.oid, 'execute') as anon,
    exists (select 1 from reach where reach.space = s.oid and role = 'authenticated')
      and pg_catalog.has_function_privilege('authenticated', f.oid, 'execute') as signed_in
  from pg_catalog.pg_proc f join spaces s on s.oid = f.pronamespace
  where f.prosecdef
    and not exists (select 1 from pg_catalog.pg_depend d
      where d.classid = 'pg_catalog.pg_proc'::pg_catalog.regclass::pg_catalog.oid and d.objid = f.oid and d.deptype = 'e')
)
select pg_catalog.json_build_object(
  'vibe', 1,
  'schemas', (select coalesce(pg_catalog.json_agg(pg_catalog.json_build_object(
      'name', s.nspname, 'exposed', exists (select 1 from listed where listed.name = s.nspname)
    ) order by s.nspname), '[]') from spaces s where s.nspname <> 'public'),
  'tables', (select coalesce(pg_catalog.json_agg(pg_catalog.json_build_object(
      'name', rel.label, 'schema', rel.nspname,
      'kind', case rel.relkind when 'v' then 'view' when 'm' then 'materialized' when 'f' then 'foreign' else 'table' end,
      'rls', rel.relrowsecurity,
      'invoker', coalesce(pg_catalog.array_to_string(rel.reloptions, ',') ~* 'security_invoker=(t|y|on|1)', false),
      'anon', coalesce(pg_catalog.to_json(a.can), '[]'),
      'signedIn', coalesce(pg_catalog.to_json(u.can), '[]'),
      'anonExtra', coalesce(pg_catalog.to_json(a.extra), '[]'),
      'signedInExtra', coalesce(pg_catalog.to_json(u.extra), '[]'),
      'someColumns', case when 'read' = any(a.can) or 'read' = any(u.can)
        then (a.some_columns or not coalesce('read' = any(a.can), false)) and (u.some_columns or not coalesce('read' = any(u.can), false))
        else false end
    ) order by rel.label), '[]') from rel
    left join grants a on a.oid = rel.oid and a.role = 'anon'
    left join grants u on u.oid = rel.oid and u.role = 'authenticated'),
  'policies', (select coalesce(pg_catalog.json_agg(pg_catalog.json_build_object(
      'table', rel.label, 'schema', rel.nspname, 'name', p.policyname, 'permissive', p.permissive = 'PERMISSIVE',
      'command', p.cmd, 'roles', p.roles, 'using', p.qual, 'check', p.with_check
    ) order by rel.label, p.policyname), '[]')
    from pg_catalog.pg_policies p join rel on rel.nspname = p.schemaname
      and rel.label = case when p.schemaname = 'public' then p.tablename::text else p.schemaname::text || '.' || p.tablename::text end),
  'functions', (select coalesce(pg_catalog.json_agg(pg_catalog.json_build_object(
      'name', d.label, 'schema', d.nspname, 'args', d.args,
      'kind', case d.prokind when 'p' then 'procedure' else 'function' end,
      'anon', d.anon, 'signedIn', d.signed_in
    ) order by d.label, d.args), '[]') from definer d where not d.is_trigger),
  'loosePaths', (select coalesce(pg_catalog.json_agg(pg_catalog.json_build_object(
      'name', d.label, 'schema', d.nspname, 'args', d.args,
      'kind', case d.prokind when 'p' then 'procedure' else 'function' end,
      'web', not d.is_trigger and (d.anon or d.signed_in)
    ) order by d.label, d.args), '[]') from definer d where not d.fixed_path),
  'storage', (select pg_catalog.json_build_object(
      'rls', files.relrowsecurity,
      'anon', coalesce((select pg_catalog.to_json(g.can) from grants g where g.oid = files.oid and g.role = 'anon'), '[]'),
      'signedIn', coalesce((select pg_catalog.to_json(g.can) from grants g where g.oid = files.oid and g.role = 'authenticated'), '[]'),
      'policies', (select coalesce(pg_catalog.json_agg(pg_catalog.json_build_object(
          'table', 'storage.objects', 'name', p.policyname, 'permissive', p.permissive = 'PERMISSIVE',
          'command', p.cmd, 'roles', p.roles, 'using', p.qual, 'check', p.with_check
        ) order by p.policyname), '[]')
        from pg_catalog.pg_policies p where p.schemaname = 'storage' and p.tablename = 'objects')
    ) from files)
) as vibe_report;

Examples

Or skip the copy and paste.

Connect Supabase
Checks
  • Tables with row security switched off
  • Rules that say yes to everyone
  • Rules that only check someone is signed in
  • Rules that trust details users can edit
  • Saved actions that skip your rules
  • Saved views that skip your rules
  • File storage rules that let strangers in
  • Saved actions with a loose search path
  • Other schemas your website can use, beside public

A customer list anyone can read

A made-up customers table has its lock switched on. It also carries a rule called “Enable read access for all users” that always answers yes. The result says anyone can read the customer rows. In the corrected version, the rule compares the owner of each row with the signed-in person, and the finding is gone. A lock tells you little until you read the rules behind it.

  • Anyone can read every row in “customers”Policy "Enable read access for all users" (SELECT, public): using true, check none

    Replace it with a rule that checks who owns each row.

Checked again after the fix: none of these results come back.

A small app with several gaps

A second made-up project has four tables and one saved action. The orders table has its lock off, any signed-in account may read messages, a visitor can run an action that deletes users, and one table is locked with no rules at all. That last result is a note rather than a fault: the table is closed, so a screen that reads it would simply look empty.

  • Anyone can read, add, change and delete every row in “orders”RLS disabled; anon may read, add, change, delete

    In one run, turn the lock on and add a rule for each thing your app does: read, add, change or delete. Anything without a rule stops working, saving included.

  • Anyone can run “delete_user”, skipping your rulessecurity definer; execute: anon

    Block web access, unless it checks who is asking.

  • Any signed-in user can read every row in “messages”Policy "Signed in users can read" (SELECT, authenticated): using (auth.role() = 'authenticated'::text), check none

    Replace it with a rule that checks who owns each row.

  • Your website cannot read “audit_log” yetRLS enabled; zero policies

    Leave it if only your server uses this table. Otherwise add a rule for the right people.

Checked again after the fix: nothing left to fix, and 1 note to read.

Is your Supabase table public?

Row level security, shortened to RLS, is the rule system that decides which rows a visitor may touch. Supabase says a table in an exposed schema without it can be read and written by any role that has been granted access to the table. An exposed schema is a group of tables your website’s key can ask for, usually the one named public. This is why the query reads both the lock and the grants, and ranks a table by what can be done to it.

Why do you see “permission denied for table”?

Supabase announced a new default in 2026: new tables in the public schema are not opened to its Data API until you grant access. New projects received it on 30 May, and existing projects were scheduled for 30 October. Tables that already existed keep the access they had. The missing grant shows as error 42501. Grant only the action that table needs to the role that needs it, and keep row level security on. Do not grant everything to anon, the role for signed-out visitors, to make an error go away. The result also notes a rule written for people who hold no permission on that table at all. It does not find a single missing action when others are granted.

Which Supabase key is safe to show?

A publishable key, and the older anon key, are made for public code, and your row rules limit what they reach. A secret key or service_role key skips those rules and belongs only on your server. Supabase says it is retiring anon and service_role keys in early 2027. If a secret key has been public, replace it first and tidy the code second.

Should you also run the Security Advisor?

Yes. The advisor in your Supabase dashboard flags tables with row security off, rules that are always true and several problems with saved functions. V.I.B.E gives a second reading in plain words, with suggested SQL and an AI prompt. With copy and paste, you give us no key and no project address.

What does one query miss?

It reads rules and permissions, never your rows, and does not try your database from outside. It does not report whether a file bucket is marked Public. A public bucket serves a file to anyone who has its address, so open Storage and look at each one. Live channels, backups and whether your app still works are also outside it.

Fix it without breaking saving

Export your data first. Read any SQL before you run it. Turning row security on with no rules stops your app reading and writing, and a rule for reading does not let anyone save. Add a rule for each action your app needs, run the query again, then try the app signed out and as two different people.

Sources, read 30 November 2026

V.I.B.E is made by TNAADO. It is not part of, or endorsed by, Supabase.

Advanced app builds

TNAADO builds multiplatform products that take payments and protect sensitive data.

Start a project