Guides · Updated 2026-10-28
Is my Supabase table public? 4 ways to check (and how to lock it down)
Short answer: A Supabase table is "public" when anyone holding your publishable (anon) key, the one that ships in your app's JavaScript, can read or change it through the Data API. That happens when the anon role has grants on the table and Row Level Security (RLS) is off, or RLS is on but a policy lets everyone through, like using (true). To check: run Supabase's Security Advisor, look at RLS, policies and grants with three SQL queries, and test from the outside by requesting the table with only the public key. If rows come back, the table is public.
What "public" means in Supabase
Apps built with Lovable, Bolt, v0 or Cursor usually talk to Supabase straight from the browser. They use the publishable key (sb_publishable_...) or the legacy anon key, which sits in your site's JavaScript where anyone can see it. That's expected: Supabase designed it to be public. What protects your data are two Postgres layers (https://supabase.com/docs/guides/api/securing-your-api):
- Grants decide whether the anon (logged-out visitor) and authenticated (signed-in user) roles can reach a table at all.
- Row Level Security (RLS) and its policies decide which rows each role can read or write.
A table is public to any visitor if anon has grants on it and RLS is off, or if RLS is on but a policy lets everyone through. Supabase's own advisor puts it plainly: with RLS off on a public-schema table, "anyone with your project URL can read, edit, and delete all data in this table" (https://supabase.com/docs/guides/database/database-advisors). And if anyone can sign up for your app, a policy that only requires being logged in (to authenticated using (true)) is close to public too.
Why AI-built apps hit this: Supabase notes that tables created in the Dashboard get RLS on by default, but tables created in the SQL Editor or through another tool need RLS enabled explicitly. Migrations written by an AI tool fall in the second group.
1. Run the Security Advisor (2 minutes)
In the Supabase dashboard, open Advisors > Security Advisor. These are built-in, deterministic checks. The ones that answer this question:
- "Table publicly accessible" (0013_rls_disabled_in_public, ERROR): a table in public with RLS off.
- "Sensitive data publicly accessible" (0023_sensitive_columns_exposed, ERROR): the same, on a table with columns that look sensitive (password, token, api_key and so on).
- "Security policy allows unrestricted access" (0024_permissive_rls_policy, WARN): a policy with using (true) or with check (true).
- "View bypasses row-level security" (0010_security_definer_view, ERROR): a view that ignores the RLS of the tables it reads.
Fix the ERRORs first. Some findings can be intentional (a product catalog that really is public, for example), but confirm that table by table. If you use an AI agent with the Supabase MCP or CLI, it can run the same checks (get_advisors or supabase db advisors).
2. Check it with SQL (5 minutes)
The SQL Editor shows the whole picture. First, which tables in public have RLS off (rowsecurity = false):
select tablename, rowsecurity from pg_tables where schemaname = 'public' order by rowsecurity, tablename;
Next, which policies exist and what they allow. Look for qual or with_check equal to true, and for policies whose roles are {public} or {anon}:
select tablename, policyname, roles, cmd, qual, with_check from pg_policies where schemaname = 'public' order by tablename;
Then, what the anon role can do on each table. On many projects you'll see SELECT, INSERT, UPDATE and DELETE everywhere, because on existing projects Supabase grants those by default to new tables in public:
select table_name, string_agg(privilege_type, ', ') as privileges from information_schema.role_table_grants where table_schema = 'public' and grantee = 'anon' group by table_name order by table_name;
How to read it: a table with grants for anon and rowsecurity = false is public, for reads and writes. With RLS on, the policies decide: if none of them lets anon through, a logged-out visitor gets no rows even though the grant exists.
Views need their own check. By default a view runs with its creator's permissions and skips the RLS of the tables behind it. On Postgres 15 or later, a safe view has security_invoker=on. This lists the views in public and their options:
select c.relname as view_name, c.reloptions as options from pg_class c join pg_namespace n on n.oid = c.relnamespace where n.nspname = 'public' and c.relkind = 'v';
3. Test it from the outside, like a stranger would
The most direct test: ask the Data API for the table using only the publishable key, with no session. Only do this against your own project. Replace YOUR-PROJECT, the table name and the key (you'll find it under API Keys in the Supabase dashboard):
curl 'https://YOUR-PROJECT.supabase.co/rest/v1/profiles?select=*&limit=1' \ -H 'apikey: YOUR_PUBLISHABLE_KEY'
- You get a row with data: any visitor can read this table.
- You get [] (an empty list): RLS is on and no policy lets anon see rows (or the table is empty).
- You get error 42501 "permission denied for table": anon has no grant on the table. Here's what that error means and how to fix it safely: https://leakyvibe.com/guides/supabase-error-42501-permission-denied
The new publishable keys go in the apikey header, not in Authorization: Bearer (https://supabase.com/docs/guides/api/api-keys). Don't test writes or deletes against real data: if reads are open and RLS is off, assume writes are open too.
Then do the two-account test: create two users, sign in as the second one and try to open the first one's data (change an id in the URL, or use the app normally). If you can see it, your policies don't keep users apart.
If you'd rather not use a terminal, the free LeakyVibe scan at the top of this page runs a version of this check from the outside: it looks for the public key on your site and flags tables that answer to it. It only records table and column names, never the contents.
4. How to lock it down
- Turn on RLS for every table in public: alter table public.your_table enable row level security; (or use Database > Policies). With no policies, the Data API stops returning rows.
- Add policies that only show people their own rows, for example using ((select auth.uid()) = user_id), and always name the role (to authenticated). Replace any using (true) on private data.
- Take away what anon doesn't need. If your app doesn't allow writes without a session: revoke insert, update, delete, truncate on public.your_table from anon;
- Views: on Postgres 15+, alter view public.your_view set (security_invoker = on); and revoke write access on the view from anon and authenticated.
- Run the Security Advisor and the curl test again to confirm.
If your app never uses supabase-js, REST or GraphQL (for example, it only talks to the database from a server over a direct Postgres connection), you can turn the Data API off entirely in the dashboard. Then none of the auto-generated endpoints respond, whatever the grants say.
A change that helps going forward: on October 30, 2026, new tables in public stop getting those automatic grants and can't be reached from your app until you GRANT access. Existing tables don't change, so this check is still worth doing. Details: https://leakyvibe.com/guides/supabase-october-30-data-api-change
A starting prompt to paste into Lovable, Bolt or Cursor:
Review the security of my Supabase database. Assume the publishable key is public. 1) Enable RLS on every table in public. 2) Replace any using (true) or with check (true) policy on private data with policies where each user can only read and edit their own rows ((select auth.uid()) = user_id), with the role named explicitly. 3) Revoke insert, update, delete and truncate from the anon role on tables that don't need logged-out writes. 4) Set security_invoker = on for every view in public. Show me the SQL for each change before applying it.
Quick checklist
- Security Advisor shows no "Table publicly accessible" or "View bypasses row-level security" errors.
- Every table in public has rowsecurity = true.
- No using (true) policy on personal data; roles always named.
- anon has no write grants where it doesn't need them.
- The curl test returns [] or 42501 on private tables.
- The two-account test shows no one else's data.
A passive scan like LeakyVibe is a quick first check, not a full audit: it can't see your code or the data behind a login. If you handle payments or sensitive data, consider a professional review.
Official sources (checked 2026-10-28): Supabase, "Securing your API" (https://supabase.com/docs/guides/api/securing-your-api), "Advisors" (https://supabase.com/docs/guides/database/database-advisors), "Row Level Security" (https://supabase.com/docs/guides/database/postgres/row-level-security) and "API keys" (https://supabase.com/docs/guides/api/api-keys). Spanish version: https://leakyvibe.com/guides/como-saber-si-mi-tabla-de-supabase-es-publica