Guide · Supabase · Updated
Supabase RLS Check: How to Test if Your Tables Are Public (Free)
Row Level Security (RLS) is what keeps strangers out of your Supabase data. But "RLS is on" does not always mean "my data is private". This guide shows you how to check your live app for free, how to read what you see, and how to fix the most common mistakes.
1. The short answer
Your public Supabase key is meant to be seen. Anyone can find it in your app. So the real question is: what can someone do with that key?
To find out, try to read your tables while logged out. Then run Supabase's free Security Advisor. Then test with two accounts. If a private table hands back real rows to a logged-out visitor, or user B can see user A's rows, fix that before you launch.
2. How RLS works, in plain words
Supabase runs two checks before anyone touches a table:
- Grants decide if a role can do something at all, like read or insert.
- Policies (the RLS rules) decide which rows that action can reach.
Every request runs as a role. Logged-out visitors are anon. Signed-in users are authenticated. A policy is like an extra filter added to every query, for example "only rows where user_id is me".
Supabase's docs warn that a table in an exposed schema with RLS off can be read and changed by any role with a grant on it. On many projects, new tables in public start with read, insert, update and delete granted to anon and authenticated. Adding policies does not take those grants back.
The secret key (and the older service_role key) skips RLS completely. That is why it must never be in your frontend. See Supabase anon key vs service_role key.
Source: Supabase: Row Level Security
3. 5-minute check on your live app
Only check apps you own or have permission to test. These steps only read. They never change your data.
Step 1: Find your project URL and public key
Open your live app. Right-click, choose Inspect, and open the Network tab. Reload the page. Click a request that goes to supabase.co. Copy the project URL (like https://abcd1234.supabase.co) and the apikey header. It starts with sb_publishable_ (newer) or eyJ (older anon key).
Step 2: List your tables
In your Supabase dashboard, open the Table Editor and write down every table name. Don't forget tables your AI builder made for you, like profiles, messages, orders or waitlist.
Step 3: Try to read each table while logged out
Run this in a terminal for each table. Swap in your project URL, the table name and your public key. It asks for one row only.
curl "https://YOUR-PROJECT.supabase.co/rest/v1/TABLE_NAME?select=*&limit=1" \ -H "apikey: YOUR_PUBLIC_KEY"
If you use an older eyJ anon key and get an auth error, add -H "Authorization: Bearer YOUR_PUBLIC_KEY" too.
Step 4: Check views and storage too
Views show up in the same API, so test them the same way. If your app uses Supabase Storage, open a file link in a private window and ask: should a stranger be able to open this?
4. How to read the results
| What you see | What it means |
|---|---|
| Real rows of data | Logged-out visitors can read this table. Fine for public content like published posts. A problem for anything private, like emails, messages or orders. Fix it first. |
[] (empty list) | No rows came back. That can mean RLS is blocking you, or the table is just empty. It is not proof. Check in the dashboard that the table has rows and a sensible policy. |
Error 42501 or "permission denied" | The anon role has no grant on this table, so it is blocked before any policy runs. Usually good for a private table. New table giving this error after Supabase's Oct 30 change? See how to fix 42501 safely. |
| "Could not find the table" | The table is not in the API, or the name is wrong. Check the spelling and the schema. |
One more thing: a logged-out read only tests the anon role. Most leaks between users happen with the authenticated role. That is what the two-account test below is for.
5. Supabase's free Security Advisor
Supabase has built-in checks called Advisors. In your dashboard, open Advisors → Security Advisor. You can also run supabase db advisors with the Supabase CLI. It is free and takes a minute.
Supabase says some findings may be on purpose, like a public blog table. So read each one and decide. But treat every "Error" level finding as a must-fix until you are sure.
Source: Supabase: Advisors
6. 9 RLS mistakes to look for
These come from the checks in Supabase's Security Advisor. The middle column is the name the Advisor uses, so you can match them up.
| Mistake | Advisor name | Why it matters |
|---|---|---|
| RLS turned off | "Table publicly accessible" | Anyone with your project URL and public key can read, change and delete every row. |
| A rule that allows everything | "Security policy allows unrestricted access" | RLS is on, but using (true) or with check (true) lets every user in that role reach every row. |
| A view that skips RLS | "View bypasses row-level security" | Views run as their creator by default, so they can show rows your table rules hide. |
| Rules based on user_metadata | "Security policy relies on user-editable data" | Users can edit their own user_metadata, so a rule like "is_admin in metadata" can be faked. |
| Private columns in an open table | "Sensitive data publicly accessible" | A table with columns like password, token or api_key is reachable with RLS off. |
| A function anyone can call | "SECURITY DEFINER function callable without signing in" | A security definer function runs as its owner and can be called at /rest/v1/rpc/, so it can skip RLS. |
| A materialized view in the API | "Materialized view exposed in API" | Materialized views cannot be protected by RLS, so every row is visible to API users. |
| A policy that is never enforced | "Security policy not enforced" | You wrote a policy, but RLS is still off on the table, so the policy does nothing. |
| A public bucket you can list | "Public bucket allows listing" | A broad select rule on storage lets anyone list every file in a public bucket. |
A few more from Supabase's RLS docs that AI builders often get wrong:
- Policies with no role. Always name the role with
to authenticatedorto anon, so a rule for signed-in users never runs for logged-out ones. auth.uid()is empty when logged out. For logged-out requests it returns null, so a rule likeauth.uid() = user_idquietly matches nothing.- One "for all" policy. Supabase suggests a separate policy for select, insert, update and delete, so you can see what each one allows.
- Updates need a select policy too. Without one, updates don't work as expected, and people "fix" it by opening the table too wide.
- Anonymous sign-ins. If you turned them on, anonymous users get the
authenticatedrole. Any "all signed-in users" rule includes them.
Sources: Supabase: Advisors · Supabase: Row Level Security
7. The two-account test
The logged-out test catches open tables. This one catches the leak where any signed-in user can see everyone's data. Remember, anyone can usually make an account.
- Sign up as user A in your live app. Make something private, like a note, a message or an order.
- In a private window, sign up as user B.
- As user B, look for user A's item. Try its page link, its ID in the URL, and any list or search.
- If you can see it, change it or delete it as user B, your policies are too open. Fix them to match rows to
auth.uid().
For a deeper check, Supabase's docs show how to write database tests for each table and run them with supabase test db. They test that each role can and cannot do each action.
Sources: Supabase: Row Level Security · Supabase: Securing your API
8. Copy-paste fix prompts
Paste one into Lovable, Bolt, v0, Cursor or your AI builder. After each fix, run the checks above again.
Go through every table in the public schema of my Supabase project. Turn on Row Level Security for each one. Write a separate policy for select, insert, update and delete. Each signed-in user can only reach rows where user_id matches auth.uid(). Name the role in every policy with "to authenticated" or "to anon". Only tables that are truly public, like published blog posts, may allow anon to select. Show me every table and every policy you added.
List every RLS policy in my Supabase project that uses using (true), with check (true), or has no condition. For each one, tell me if the table is meant to be public. If it is not, replace the policy with one that checks auth.uid() against the owner column. Do not turn off RLS. Show me the SQL.
Find every view in my public schema. Recreate each one with security_invoker = true so it follows RLS. Then list every security definer function in the public schema. For each one, tell me if a logged-out user can call it. If they should not, revoke execute from anon and public, or switch it to security invoker. Show me the SQL.
Check every RLS policy for user_metadata or raw_user_meta_data. Users can change that data themselves, so it must not decide who is an admin. Move roles to app_metadata or to a separate roles table that users cannot write to, and update the policies. Show me what changed.
For each table in my public schema, list what the anon and authenticated roles are granted. Revoke everything they do not need. For example, if logged-out visitors should not write to a table, revoke insert, update and delete from anon. Keep RLS on and keep the policies. Put the grants and policies in one migration.
Tip: never fix an error by turning RLS off. If the AI suggests that, ask it to add the right grant and policy instead.
9. Check it for me
Don't want to run curl for every table? VibeCheck checks your live app from the outside, the way a stranger would. If your app talks to Supabase from the browser, it takes the public key your app already ships and asks for one row from common table names to see if they are open. It reports table names only and never stores or shows the rows.
It also searches the JavaScript your homepage loads for secret keys (like the Supabase secret or service_role key, OpenAI and Stripe keys), and checks security headers, Google basics and broken links.
It only looks. It never logs in, fills in forms or tries to break in. It can't see your policies or test signed-in users, so still run the Security Advisor and the two-account test.
Pricing: the problems list is free (just add your email). A fix report with a copy-paste prompt for every problem is $9. Or get 10 fix reports for $29. No subscription.
10. FAQ
How do I check if Supabase RLS is working?
Test it from the outside, the way a stranger would. Take your public Supabase key from your live app, then try to read each table while logged out. If real rows come back from a private table, RLS is not protecting it. Then run the free Security Advisor in your Supabase dashboard, and test with two accounts to make sure one user cannot see another user's rows.
Does RLS enabled mean my table is private?
No. RLS on means rules decide who sees which rows. If a rule says using (true) for anon, every logged-out visitor can still read every row. Supabase's Security Advisor warns about these "always true" rules. Check what each policy actually allows.
Why does my Supabase query return an empty array []?
An empty result is not proof either way. It can mean the table is empty, or that RLS filtered out every row. Supabase docs say that once RLS is on, no data comes back through the API with the public key until you add policies. Check in the dashboard whether the table has rows, and which policies it has.
Is the Supabase anon key a problem if people can see it?
No. The anon key (or the newer sb_publishable_ key) is meant to be in your frontend. RLS and grants are what protect your data. The secret key and the older service_role key are different. Supabase docs say they bypass RLS, so they must never be in the browser.
Do Supabase views follow RLS?
Not by default. Supabase docs say views bypass RLS by default because they run as the user who created them. A view over a protected table can hand out every row. On Postgres 15 and above, create the view with security_invoker = true so it follows the table's rules.
What is the fastest free Supabase RLS check?
Open Advisors, then Security Advisor, in your Supabase dashboard. It is built in and free. Look for "Table publicly accessible", "Security policy allows unrestricted access" and "View bypasses row-level security". Then confirm from the outside with the logged-out test in this guide.
More questions? See the VibeCheck FAQ. Also useful: Is my Lovable app safe? · Is my Bolt app secure? · Is my v0 app secure? · Is my API key exposed? · Supabase 42501 after the Oct 30 change · Supabase anon vs service_role key