Get a second opinionBook
Menu

Supabase warnings

Supabase security checklist: one read-only SQL audit

This script puts the check from every warning page into one query. It only reads the catalog of your own database, so it changes nothing. Paste it into the SQL Editor of your Supabase dashboard and run it.

Each row of the result names a warning and what was found: a table, a policy, a view or a function. No rows means none of these warnings applies to your database. It does not replace testing the live app with two accounts, which is the only way to see what a real user can reach. The one warning that is a setting and not a query, leaked password protection, is listed as a comment in the script.

Reviewed:

The script

Read-only SQL audit
-- Supabase security checklist by Slop Medic: https://slopmedic.com/supabase-advisor/checklist
-- Reviewed: 2026-10. Read-only: every part only reads your database catalog and changes nothing.
-- Paste it into the SQL Editor of your Supabase dashboard and run it. Each row is something to look at; not every row is a problem. No rows means nothing found.
-- What each warning means and how to fix it: https://slopmedic.com/supabase-advisor
-- Leaked password protection disabled: an Auth setting, not a query. See https://slopmedic.com/supabase-advisor/leaked-password-protection

-- 0013_rls_disabled_in_public: Table publicly accessible (ERROR). Every table this lists is open to anyone with your public key. Fixed means this returns no rows.
select '0013_rls_disabled_in_public' as warning, row_to_json(q)::text as found from (
select tablename
from pg_tables
where schemaname = 'public'
  and rowsecurity = false
) q
union all
-- 0024_permissive_rls_policy: Security policy allows unrestricted access (WARN). Each row is a policy that lets everyone it applies to through. Fine for truly public data, a leak for anything that belongs to one user.
select '0024_permissive_rls_policy' as warning, row_to_json(q)::text as found from (
select tablename, policyname, cmd, roles
from pg_policies
where schemaname = 'public'
  and (qual = 'true' or with_check = 'true')
) q
union all
-- 0007_policy_exists_rls_disabled: Security policy not enforced (INFO). Each table listed has policies that are switched off. Fixed means this returns no rows.
select '0007_policy_exists_rls_disabled' as warning, row_to_json(q)::text as found from (
select distinct p.tablename
from pg_policies p
join pg_tables t
  on t.schemaname = p.schemaname and t.tablename = p.tablename
where p.schemaname = 'public'
  and t.rowsecurity = false
) q
union all
-- 0008_rls_enabled_no_policy: No access rules defined (INFO). Each table listed is locked for the API. Fine if only your server uses it; broken if your app reads it from the browser.
select '0008_rls_enabled_no_policy' as warning, row_to_json(q)::text as found from (
select t.tablename
from pg_tables t
left join pg_policies p
  on p.schemaname = t.schemaname and p.tablename = t.tablename
where t.schemaname = 'public'
  and t.rowsecurity = true
  and p.policyname is null
) q
union all
-- 0015_rls_references_user_metadata: Security policy relies on user-editable data (ERROR). Each policy listed trusts data the user controls. Fixed means this returns no rows.
select '0015_rls_references_user_metadata' as warning, row_to_json(q)::text as found from (
select tablename, policyname
from pg_policies
where schemaname = 'public'
  and (qual ilike '%user_metadata%'
    or with_check ilike '%user_metadata%')
) q
union all
-- 0010_security_definer_view: View bypasses row-level security (ERROR). Each view listed runs with its creator’s rights and skips row level security. Fixed means this returns no rows.
select '0010_security_definer_view' as warning, row_to_json(q)::text as found from (
select c.relname as view_name
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where n.nspname = 'public'
  and c.relkind = 'v'
  and not coalesce(c.reloptions && array['security_invoker=true', 'security_invoker=on'], false)
) q
union all
-- 0002_auth_users_exposed: User data exposed through a view (ERROR). Each view listed exposes data from your user accounts. Fixed means this returns no rows.
select '0002_auth_users_exposed' as warning, row_to_json(q)::text as found from (
select distinct v.relname as view_name
from pg_depend d
join pg_rewrite r on r.oid = d.objid
join pg_class v on v.oid = r.ev_class
join pg_namespace n on n.oid = v.relnamespace
where d.refobjid = 'auth.users'::regclass
  and n.nspname = 'public'
  and v.relkind in ('v', 'm')
) q
union all
-- 0023_sensitive_columns_exposed: Sensitive data publicly accessible (ERROR). A rough match on column names: each hit sits in an open table. Check what is really stored there.
select '0023_sensitive_columns_exposed' as warning, row_to_json(q)::text as found from (
select c.table_name, c.column_name
from information_schema.columns c
join pg_tables t
  on t.schemaname = c.table_schema and t.tablename = c.table_name
where c.table_schema = 'public'
  and t.rowsecurity = false
  and c.column_name ~* '(pass|token|secret|key|ssn|iban|card)'
) q
union all
-- 0025_public_bucket_allows_listing: Public bucket allows listing (WARN). Look for policies whose condition is only bucket_id = …: they make the whole bucket listable for the roles shown.
select '0025_public_bucket_allows_listing' as warning, row_to_json(q)::text as found from (
select policyname, roles, qual
from pg_policies
where schemaname = 'storage'
  and tablename = 'objects'
  and cmd in ('SELECT', 'ALL')
) q
union all
-- 0012_auth_allow_anonymous_sign_ins: Anonymous sign-ins enabled (INFO). Each policy listed treats anonymous visitors like real users. That is only right if guests should have the same access. Only matters if anonymous sign-ins are on (Authentication settings).
select '0012_auth_allow_anonymous_sign_ins' as warning, row_to_json(q)::text as found from (
select tablename, policyname, cmd
from pg_policies
where schemaname = 'public'
  and 'authenticated' = any(roles)
  and coalesce(qual, '') not ilike '%is_anonymous%'
  and coalesce(with_check, '') not ilike '%is_anonymous%'
) q
union all
-- 0028_anon_security_definer_function_executable: Signed-out users can run a security definer function (WARN). Each function listed bypasses RLS and can be called without signing in.
select '0028_anon_security_definer_function_executable' as warning, row_to_json(q)::text as found from (
select p.proname as function_name
from pg_proc p
join pg_namespace n on n.oid = p.pronamespace
where n.nspname = 'public'
  and p.prosecdef
  and not exists (select 1 from pg_depend d where d.objid = p.oid and d.deptype = 'e')
  and has_function_privilege('anon', p.oid, 'execute')
) q
union all
-- 0029_authenticated_security_definer_function_executable: Any signed-in user can run a security definer function (WARN). Each function listed bypasses RLS and every signed-in user can call it. Fine only if it checks who is calling.
select '0029_authenticated_security_definer_function_executable' as warning, row_to_json(q)::text as found from (
select p.proname as function_name
from pg_proc p
join pg_namespace n on n.oid = p.pronamespace
where n.nspname = 'public'
  and p.prosecdef
  and not exists (select 1 from pg_depend d where d.objid = p.oid and d.deptype = 'e')
  and has_function_privilege('authenticated', p.oid, 'execute')
) q
union all
-- 0006_multiple_permissive_policies: Multiple permissive policies on a table (WARN). Each row is one table and action with several policies that combine. Read them together: the loosest one wins.
select '0006_multiple_permissive_policies' as warning, row_to_json(q)::text as found from (
select tablename, cmd, array_agg(policyname) as policies
from pg_policies
where schemaname = 'public'
  and permissive = 'PERMISSIVE'
group by tablename, cmd, roles
having count(*) > 1
) q
union all
-- 0011_function_search_path_mutable: Unsecured function search path (WARN). Each function listed looks up names wherever the caller points it. Fixed means this returns no rows.
select '0011_function_search_path_mutable' as warning, row_to_json(q)::text as found from (
select p.proname as function_name
from pg_proc p
join pg_namespace n on n.oid = p.pronamespace
where n.nspname = 'public'
  and not exists (select 1 from pg_depend d where d.objid = p.oid and d.deptype = 'e')
  and not exists (
    select 1 from unnest(coalesce(p.proconfig, '{}')) c
    where c like 'search_path=%'
  )
) q
union all
-- 0014_extension_in_public: Extension installed in public schema (WARN). Each extension listed lives in public. Fixed means this returns no rows.
select '0014_extension_in_public' as warning, row_to_json(q)::text as found from (
select e.extname
from pg_extension e
join pg_namespace n on n.oid = e.extnamespace
where n.nspname = 'public'
) q
order by warning;

What a row means

WarningLevelA row means
Table publicly accessibleERROREvery table this lists is open to anyone with your public key. Fixed means this returns no rows.
Security policy allows unrestricted accessWARNEach row is a policy that lets everyone it applies to through. Fine for truly public data, a leak for anything that belongs to one user.
Security policy not enforcedINFOEach table listed has policies that are switched off. Fixed means this returns no rows.
No access rules definedINFOEach table listed is locked for the API. Fine if only your server uses it; broken if your app reads it from the browser.
Security policy relies on user-editable dataERROREach policy listed trusts data the user controls. Fixed means this returns no rows.
View bypasses row-level securityERROREach view listed runs with its creator’s rights and skips row level security. Fixed means this returns no rows.
User data exposed through a viewERROREach view listed exposes data from your user accounts. Fixed means this returns no rows.
Sensitive data publicly accessibleERRORA rough match on column names: each hit sits in an open table. Check what is really stored there.
Public bucket allows listingWARNLook for policies whose condition is only bucket_id = …: they make the whole bucket listable for the roles shown.
Anonymous sign-ins enabledINFOEach policy listed treats anonymous visitors like real users. That is only right if guests should have the same access. Only matters if anonymous sign-ins are on (Authentication settings).
Signed-out users can run a security definer functionWARNEach function listed bypasses RLS and can be called without signing in.
Any signed-in user can run a security definer functionWARNEach function listed bypasses RLS and every signed-in user can call it. Fine only if it checks who is calling.
Multiple permissive policies on a tableWARNEach row is one table and action with several policies that combine. Read them together: the loosest one wins.
Unsecured function search pathWARNEach function listed looks up names wherever the caller points it. Fixed means this returns no rows.
Extension installed in public schemaWARNEach extension listed lives in public. Fixed means this returns no rows.
Leaked password protection disabledWARNNot a database setting: check it in your Auth settings.

Found rows? Start here

Want the whole app checked, not only the database? Run the free self-check prompt, or read Is my Lovable app secure?

Warning gone? Get it checked.

From $299. Ready within 2 business days of complete access. If I find no problem rated medium or higher that your own scan missed, I refund the full price automatically.

Replies within 2 business days.