Why Your Supabase Table Is Public and How to Check

Short answer: because Supabase gives every project a ready-made API over its public schema, and a table you create there can be reachable through that API from the moment it exists. Whether strangers can actually read it comes down to two settings your AI tool probably never touched: grants and row level security.
This is not hypothetical. In March 2025, security researcher Matt Palmer scanned apps built with Lovable and found 303 endpoints across 170 of 1,645 projects leaking user data through exactly this door (his writeup, published that May). Security firm Wiz found an AI-built app’s whole Supabase database sitting open the same way, with millions of API keys inside (their report). Wired’s investigation found the pattern repeating across vibe-coded apps at scale.
Checking your own project takes two minutes, and the fix comes with a test that keeps it shut.
The API you did not know you had
Every Supabase project serves an auto-generated REST API, the Data API, over the schemas listed under Exposed schemas in your API settings. public is on that list by default, so every table in public gets a live endpoint: https://YOUR-PROJECT.supabase.co/rest/v1/YOUR-TABLE. Ask for that URL with your publishable key in the apikey header and the API answers.
The publishable key is public by design. It is printed in your JavaScript, and Supabase built the model around it being visible. So “is my table exposed?” is really two questions: may this role touch the table at all (grants), and which rows may it see (row level security policies).
The part that surprises people: a new table in public can start with every privilege already granted to the anon and authenticated roles. Supabase is phasing those default grants out (opt-out from April 28, 2026, default for new projects from May 30, 2026, and every existing project from October 30, 2026, with existing tables keeping their grants), but adding policies never takes grants back either way. Check your own project instead of guessing:
select grantee, table_name, privilege_typefrom information_schema.role_table_grantswhere table_schema = 'public' and grantee in ('anon', 'authenticated');Every row is a privilege a stranger or any signed-in user holds; revoke what you do not need.
And when RLS is off, the second check does not exist. Supabase’s Security Advisor flags this as lint 0013_rls_disabled_in_public, level ERROR, in blunt words: “Anyone with your project URL can read, edit, and delete all data in this table because Row-Level Security is not enabled.”
Check 1: the two-minute query
Open the SQL editor in your Supabase dashboard and run:
select tablename, rowsecurityfrom pg_tableswhere schemaname = 'public';Every f is a table with RLS off, which means it answers according to its grants alone. On a project with default grants, that is full create, read, update and delete for anyone on the internet.
Check 2: the dashboard’s own warning
Studio’s Security Advisor lists every table failing lint 0013. From the CLI, supabase db advisors prints the same list, but it inspects your local database by default; pass --remote for the linked project, or you will lint an empty local database and get a clean bill. If it comes back clean, check anyway: the advisor verifies that RLS exists, not that your policies say what you think.
Check 3: ask like a stranger
From a terminal, not logged in to anything:
curl "https://YOUR-PROJECT.supabase.co/rest/v1/YOUR-TABLE?select=*" \ -H "apikey: YOUR-PUBLISHABLE-KEY"Rows of real data coming back means the table is public. Read the other answers carefully: [] only proves the lock holds if the table has rows (an empty open table returns [] too), and an error only counts if it is 42501 (permission denied); a 401 means your request is wrong, not that the table is safe. This is the same check the 20-minute security check walks through, and the same one researchers run at scale. And nobody has to guess your table names: PostgREST error hints and GraphQL introspection give the schema away, which is how Wiz mapped Moltbook’s database, so assume the names are known.
Do not probe writes against real data. If reads come back, treat writes as open until proven otherwise.
Public does not mean read-only
The regression test below was run against a scratch setup, Postgres with the Supabase roles and default grants emulated and a notes table with two users’ rows, before applying any fix. Five of the six assertions failed: a stranger read every row, and one signed-in user saw, updated, deleted and forged another user’s notes. That last part is the one people underestimate. “Exposed” does not mean someone can peek at your data. It means they can change it.
Some tables should be public
Blog posts, pricing, a public feed: some data is meant for strangers. Do that deliberately. Enable RLS and write a policy that allows public reads, instead of leaving RLS off. Same visibility for readers, but the advisor goes quiet, writes stay closed unless you open them, and the decision is written down in your schema.
The fix, and a test that keeps it fixed
The fix itself is one statement per table plus policies that say who gets what. Row level security explained walks through a first policy line by line. If a table should be fully private, also take the grants back: revoke all on table public.notes from anon, authenticated;. One gotcha from the docs: a missing grant raises error 42501 before any policy runs, and an RLS violation raises the same 42501, so read the message. “Permission denied for table” is grants; “new row violates row-level security policy” is the policy. If a request your policy should allow suddenly fails, check the grants before you rewrite the policy.
Then lock the fix in with a regression test. Supabase runs pgTAP tests with supabase test db; drop this in supabase/tests/notes_rls.test.sql. The fixtures matter: under supabase test db the database has only what migrations and seed.sql put there, and on an empty table most of these assertions would pass even wide open, so the test inserts its own rows and asserts they exist:
begin;select plan(7);
-- Fixtures first, as the table owner, so the checks below cannot pass on an empty table.insert into public.notes (user_id, content) values ('11111111-1111-1111-1111-111111111111', 'alice private note'), ('22222222-2222-2222-2222-222222222222', 'bob private note');
select is( (select count(*)::int from public.notes), 2, 'fixtures present');
-- A stranger (the anon role, no login) must see nothing.set local role anon;select is_empty( 'select content from public.notes', 'anon cannot read notes');select throws_ok( $$ insert into public.notes (user_id, content) values ('11111111-1111-1111-1111-111111111111', 'spam') $$, '42501', null, 'anon cannot insert');
-- A signed-in user must see only their own rows.set local role authenticated;-- Supabase puts the caller's JWT in request.jwt.claims on every request.set local request.jwt.claims = '{"sub": "11111111-1111-1111-1111-111111111111"}';select results_eq( 'select content from public.notes order by id', $$ values ('alice private note') $$, 'alice sees only her own notes');
-- And cannot touch anyone else's.select is_empty( $$ update public.notes set content = 'hacked' where user_id = '22222222-2222-2222-2222-222222222222' returning 1 $$, 'alice cannot update bob''s note');select is_empty( $$ delete from public.notes where user_id = '22222222-2222-2222-2222-222222222222' returning 1 $$, 'alice cannot delete bob''s note');select throws_ok( $$ insert into public.notes (user_id, content) values ('22222222-2222-2222-2222-222222222222', 'forged') $$, '42501', null, 'alice cannot insert a note as bob');
select * from finish();rollback;The real run, psql output trimmed. Before the fix, the exposure in test form:
ok 1 - fixtures presentnot ok 2 - anon cannot read notesnot ok 3 - anon cannot insertnot ok 4 - alice sees only her own notesnot ok 5 - alice cannot update bob's notenot ok 6 - alice cannot delete bob's notenot ok 7 - alice cannot insert a note as bobAfter the fix:
ok 1 - fixtures presentok 2 - anon cannot read notesok 3 - anon cannot insertok 4 - alice sees only her own notesok 5 - alice cannot update bob's noteok 6 - alice cannot delete bob's noteok 7 - alice cannot insert a note as bobTo make the fix automatic, Supabase documents an event trigger that enables RLS on every new table in public, and a revoke-default-privileges step that stops new tables from picking up automatic grants. That is the anti-regression move for tables the AI creates mid-prompt.
Run it in CI after that, and the next migration that weakens a policy fails your build instead of failing your users. Test your Supabase RLS policies walks the suite line by line, and database migrations without losing data covers writing safe ones.
One design note on the test itself: those assertions describe behaviors, what the app does for a user: a stranger reads nothing, a signed-in user reaches only their own rows. They say nothing about how the fix is implemented, and that is deliberate: swap the policies for a different design and the same tests still stand; break one of these behaviors and a test fails. Tests that mirror the implementation get rewritten with every fix and end up protecting the code instead of your users’ data. And tests only protect the behavior they cover.
Two blind spots worth one line each. A view in public with the default security definer behavior bypasses RLS entirely; the advisor flags these as lints 0010 and 0016. And your RLS check is only as current as your last migration, which is why the test matters more than the dashboard.
A prompt to start with
List every table in my Supabase public schema, whether row level security is enabled on each, its policies, and the grants held by the anon and authenticated roles. For each table, say whether an unauthenticated request can read or write it, and write a pgTAP test under supabase/tests/ that fails today for every table a stranger can reach, with fixture rows inserted inside the test so it cannot pass on an empty table. Do not change anything yet.
If this check turned up open tables, the 20-minute security check covers the rest of the doors, and row level security explained is the full version of the fix.
The Get AI Native ebook goes deeper on this. It is free, and the expected launch is around Christmas. Join the waitlist on the homepage.