Supabase RLS checker: see what your public key can reach
This checker reads your Supabase project's security settings and tells you, table by table, who can read or change your data through the public API: anyone with your app's public key, any signed-in user, or only the right people. You run one read-only query in the Supabase SQL editor and paste the result here. The check runs in your browser, and what you paste is not sent to DevoraX or stored.
01Run this query in your Supabase SQL editor
In your Supabase dashboard open SQL Editor, start a new query, paste this and press Run. It reads only the database's own description of itself (table settings, policies, grants, function settings and bucket flags), never the rows in your tables, and it changes nothing.
-- DevoraX Supabase RLS check (v2). Reads catalog metadata only: table names,
-- RLS flags, policies, grants, function settings and bucket flags. It reads no
-- rows from your tables and changes nothing. Add any other schema you expose
-- through the Data API to the list on the next line.
with exposed(schema_name) as (values ('public')),
rels as (
select n.nspname as schema, c.relname as name, c.oid, c.relkind,
c.relrowsecurity as rls_enabled, c.relforcerowsecurity as rls_forced,
coalesce(array_to_string(c.reloptions, ','), '') as options
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where n.nspname in (select schema_name from exposed)
and c.relkind in ('r', 'p', 'v', 'm', 'f')
and not exists (select 1 from pg_depend d where d.objid = c.oid and d.deptype = 'e')
)
select json_build_object(
'tool', 'devorax-supabase-rls-check',
'version', 2,
'relations', (
select coalesce(json_agg(json_build_object(
'schema', r.schema, 'name', r.name,
'kind', case r.relkind when 'v' then 'view' when 'm' then 'materialized_view' when 'f' then 'foreign_table' else 'table' end,
'rls_enabled', r.rls_enabled, 'rls_forced', r.rls_forced,
'security_invoker', r.options ~* 'security_invoker=(true|on|yes|1)',
'anon', json_build_object(
'select', (has_table_privilege('anon', r.oid, 'SELECT') or has_any_column_privilege('anon', r.oid, 'SELECT')),
'insert', (has_table_privilege('anon', r.oid, 'INSERT') or has_any_column_privilege('anon', r.oid, 'INSERT')),
'update', (has_table_privilege('anon', r.oid, 'UPDATE') or has_any_column_privilege('anon', r.oid, 'UPDATE')),
'delete', has_table_privilege('anon', r.oid, 'DELETE')),
'authenticated', json_build_object(
'select', (has_table_privilege('authenticated', r.oid, 'SELECT') or has_any_column_privilege('authenticated', r.oid, 'SELECT')),
'insert', (has_table_privilege('authenticated', r.oid, 'INSERT') or has_any_column_privilege('authenticated', r.oid, 'INSERT')),
'update', (has_table_privilege('authenticated', r.oid, 'UPDATE') or has_any_column_privilege('authenticated', r.oid, 'UPDATE')),
'delete', has_table_privilege('authenticated', r.oid, 'DELETE'))
) order by r.schema, r.name), '[]'::json)
from rels r
),
'policies', (
select coalesce(json_agg(json_build_object(
'schema', p.schemaname, 'table', p.tablename, 'name', p.policyname,
'permissive', p.permissive, 'roles', p.roles, 'command', p.cmd,
'using', p.qual, 'check', p.with_check
) order by p.schemaname, p.tablename, p.policyname), '[]'::json)
from pg_policies p
where p.schemaname in (select schema_name from exposed)
or (p.schemaname = 'storage' and p.tablename = 'objects')
),
'functions', (
select coalesce(json_agg(json_build_object(
'schema', n.nspname, 'name', f.proname,
'args', pg_get_function_identity_arguments(f.oid),
'security_definer', f.prosecdef,
'search_path_set', coalesce(array_to_string(f.proconfig, ',') ~ 'search_path=', false),
'anon_execute', has_function_privilege('anon', f.oid, 'EXECUTE'),
'authenticated_execute', has_function_privilege('authenticated', f.oid, 'EXECUTE')
) order by n.nspname, f.proname), '[]'::json)
from pg_proc f
join pg_namespace n on n.oid = f.pronamespace
where n.nspname in (select schema_name from exposed)
and f.prokind = 'f'
-- Trigger functions can't be called through /rest/v1/rpc, so they are left out.
and f.prorettype not in ('trigger'::regtype, 'event_trigger'::regtype)
and not exists (select 1 from pg_depend d where d.objid = f.oid and d.deptype = 'e')
),
'buckets', (
select coalesce(json_agg(json_build_object('id', b.id, 'public', b.public) order by b.id), '[]'::json)
from storage.buckets b
)
) as report;
It checks the public schema. If your API exposes other schemas (Settings, then Data API), add them to the list on the query's fifth line.
02Paste the result here
The query returns one row with one value, in a column called report. Click that value, copy all of it, and paste it below. It is checked in this browser tab and is not sent to DevoraX or saved.
Every rule this tool applies (22)
- CriticalA table has Row Level Security turned off and the anon role holds a privilege on it, so anyone with your public (anon or publishable) key can read or change every row through the Data API.Supabase linter: 0013_rls_disabled_in_public
- HighA table has Row Level Security turned off and only signed-in users hold privileges on it, so every signed-in user can read or change every row.Supabase linter: 0013_rls_disabled_in_public
- CriticalA policy lets anonymous visitors update or delete any row (its condition is simply true).Supabase linter: 0024_permissive_rls_policy
- CriticalA policy lets any signed-in user update or delete any row: its condition is true, or only checks that someone is signed in.Supabase linter: 0024_permissive_rls_policy
- HighA policy lets any signed-in user read every row: its condition is true, or only checks that someone is signed in (auth.role() = 'authenticated', auth.uid() IS NOT NULL). If anyone can sign up, that is everyone. Rated above a public table, because a sign-in check usually means the rows were meant to be private.Supabase linter: 0024_permissive_rls_policy
- CriticalA policy accepts auth.uid() IS NULL (usually as "... or auth.uid() is null"), which is true for every request made with only the public key, so signed-out visitors get through.
- HighA policy trusts user_metadata, which signed-in users can change themselves, so they can grant themselves the access the policy controls.Supabase linter: 0015_rls_references_user_metadata
- HighA view without security_invoker is readable through the API. It runs with its owner's rights, so it can return rows that the RLS on its tables would hide.Supabase linter: 0010_security_definer_view
- HighA SECURITY DEFINER function in an exposed schema can be called by anonymous visitors (POST /rest/v1/rpc/<name>), and it runs with its owner's rights, past RLS.Supabase linter: 0028_anon_security_definer_function_executable
- HighA policy on storage.objects lets anonymous visitors upload, replace or delete files with no condition at all, in every bucket.
- ReviewA policy lets anyone read every row. Right for a public catalogue or blog; a leak for anything personal.Supabase linter: 0024_permissive_rls_policy
- ReviewA policy lets anonymous visitors insert any row (a public form, say). Check the table cannot be filled with junk or with values your app trusts.Supabase linter: 0024_permissive_rls_policy
- ReviewA policy lets any signed-in user insert any row, including rows that name another user as their owner.Supabase linter: 0024_permissive_rls_policy
- ReviewA materialized view is readable through the API. RLS cannot apply to materialized views, so whoever holds the grant reads all of it.
- ReviewA SECURITY DEFINER function can be called by any signed-in user and runs with its owner's rights.Supabase linter: 0029_authenticated_security_definer_function_executable
- ReviewA SECURITY DEFINER function has no fixed search_path, so objects it calls could be swapped for others by name.Supabase linter: 0011_function_search_path_mutable
- ReviewA storage bucket is public: anyone with a file's URL can download it, and no policy is checked for those downloads.
- ReviewA policy on storage.objects lets any signed-in user upload, replace or delete any file.
- InfoA table has RLS turned on but no policy for the API roles, so requests return no rows and writes fail. Safe, and the usual reason a list in the app comes back empty.Supabase linter: 0008_rls_enabled_no_policy
- InfoA table has RLS turned on but the API roles hold no privileges on it, so requests fail with "permission denied" (error 42501) before any policy is checked. Since 30 October 2026, new Supabase tables start without these grants.
- InfoA table has RLS turned off but the API roles hold no privileges on it, so the Data API cannot reach it. Turn RLS on anyway, in case a grant is added later.Supabase linter: 0013_rls_disabled_in_public
- InfoA policy calls auth.uid() or auth.jwt() directly. Wrapping it as (select auth.uid()) lets Postgres evaluate it once per query instead of once per row.Supabase linter: 0003_auth_rls_initplan
Why apps built with Lovable, Bolt or Replit need this check
A Supabase app's project address and public key (the anon or publishable key) ship in the JavaScript every visitor downloads. That is by design: the key only identifies the project, and Row Level Security (RLS) decides what each request may see. When RLS is off, or a policy lets everyone through, anyone can copy the key from the browser and query your tables directly, without opening your app at all.
AI builders create tables and policies quickly, and a prompt that fixes one screen can loosen a policy that protected another. Lovable's own documentation says missing RLS policies are the most common way app data gets exposed, and CVE-2025-48757, a vulnerability record that Lovable disputes, describes unauthenticated reads and writes to the databases of Lovable-generated sites through insufficient RLS policies. The usual results are a table with RLS turned off, a policy whose condition is simply true, or a policy that only checks that someone is signed in, which on an app with open sign-up means everyone. This tool looks for exactly those patterns, plus the ways around RLS that are easy to miss: views, SECURITY DEFINER functions and public storage buckets.
How the check works
The query reads the database's own catalog: which tables have RLS turned on, every policy with its roles, command and condition, which privileges the anon and authenticated roles hold, which functions run with their owner's rights, and which storage buckets are public. It returns that as one JSON value. It does not read a single row of your data and it changes nothing, which you can confirm by reading it: it only selects from Postgres system catalogs and storage.buckets.
The rules are applied in this page's JavaScript, the same way every time, and each one is listed under the tool with the matching check in Supabase's own linter, where there is one.
Supabase's Security Advisor, in your project dashboard, runs similar checks and you should read it too. This tool adds three things: it explains each finding in plain words for whoever owns the app, it flags policies that only check that someone is signed in (which a check for conditions set to true misses, and which still let every user read every row), and it gives SQL to start each fix from. The fixes use placeholders such as <owner_column> where only you know the right column.
- Critical: data that people who should not see it can read or change today.
- High: a gap someone can use once they know where to look.
- Review: right in some apps, a leak in others, such as a public catalogue table.
- Info: not a hole, but worth knowing, such as a table that returns no rows because it has no policy.
What to do with the results
Fix the critical findings first, and test each fix the way an outsider would: the signed-out request test and the second-user test in our checklist show how to call your API with only the public key, and as one user asking for another user's rows. Turning RLS on without adding policies blocks your own app too, so add the policies your screens need in the same change.
If your project runs on Lovable's built-in backend rather than your own Supabase account, its SQL editor is under More, then Database, then Manage. The query uses only standard Postgres catalogs and Supabase's storage table. We tested it on a Postgres database set up with Supabase's roles, grants and storage tables; we have not run it on Lovable's backend. Two guides on Sameem Amjad's site go deeper on the errors you may meet next: what "RLS disabled in public" means and how to fix it, and why a table says "permission denied" (42501) and the grants that fix it.
Found more than you want to fix alone?
Our $400 vibe code audit starts where this tool stops: we test your app with real accounts for each type of user, signed out and as a second user, read the code behind the policies, and give each part a keep, harden or rebuild verdict. The $400 is credited to the paid step that follows if you go ahead.
What this tool cannot tell you
- It reads settings, not meaning. A policy such as (auth.uid() = user_id) passes here even if user_id is the wrong column; only testing with real accounts shows that.
- It covers the schemas you list in the query (public by default), policies on storage.objects and the public flag on buckets. It does not check edge functions, server code, API keys in your frontend, or your auth settings.
- A result with no findings is not a security certification. It means none of the patterns on this page were found.
Start with a free 30-minute call
Tell us where the app is stuck and what has to happen by when. We tell you whether an audit makes sense.
Book your free call