How to check your Supabase row level security in ten minutes
A five-step check for Lovable, Bolt and Cursor apps on Supabase. Find public tables without RLS, spot policies that let everyone in, test with the publishable key, and make sure no secret key reaches the browser.
Lovable, Bolt and many Cursor projects put their data in Supabase, and one of the most serious problems such an app can have isn't a crash. It's a table anyone can read. The app works, the demo looks fine, and the profiles or orders table answers every request that carries the publishable key that ships in your JavaScript bundle.
There's no news hook today, so here is the check we'd run on any Lovable, Bolt, Replit or Cursor project before it takes real users. It takes about ten minutes.
Why this goes wrong so often
Supabase exposes your public schema over its Data API. The rule that matters is one line in its docs: "A table in an exposed schema without RLS is readable and writable by any role with a grant on it." New tables in public start with privileges granted to anon, authenticated and service_role. So a table created without row level security is open to anyone who has your project URL and publishable key, and both are in your front end by design.
The publishable key (sb_publishable_..., or the legacy anon key) is meant to be public. Supabase calls it "safe to expose online" because RLS still applies to it. That is the whole deal: the key is public, and RLS is the lock. A table without RLS is a door without a lock.
Even when a builder sets up RLS for the tables it creates, gaps can open later: a table added by a pasted SQL snippet, a migration the agent wrote in a hurry, or a policy written as using (true) to make an error go away.
The check
- Run the Security Advisor. In the Supabase dashboard, open Advisors, then Security Advisor. Look for "RLS disabled in public" (lint 0013) and "Security policy not enforced" (lint 0007, a policy exists but RLS is off, so it does nothing). Every hit is worth reading. The same checks run from the CLI with
supabase db advisors.
- List your public tables in SQL. In the SQL editor, run
select tablename, rowsecurity from pg_tables where schemaname = 'public';. Any row withrowsecurity = falseis open to the publishable key unless you revoked its grants. Turn it on withalter table public.your_table enable row level security;.
- Read the policies, not just the switch. RLS on with a bad policy is as open as RLS off. Run
select tablename, policyname, cmd, roles, qual from pg_policies where schemaname = 'public';and look atqual. Aselectpolicy oftrueforanonorpublicmeans every visitor can read every row. For user data you want something like Supabase's own example:using ((select auth.uid()) = user_id), so each signed-in user sees only their rows.
- Test it the way an attacker would. Take the project URL and publishable key from your built front end, and request a table with nobody signed in:
curl "https://YOUR-PROJECT-REF.supabase.co/rest/v1/profiles?select=*" -H "apikey: YOUR_PUBLISHABLE_KEY". For a table that holds anything private, the answer should be an empty array or an error, never real rows. Then sign in as one test user and check you can't fetch another user's rows by changing an id in the request. That second test catches the policies that are on but scoped wrong, which is what we cover in users reading each other's data.
- Make sure no secret key is in the browser. Search the built bundle and the repo for
sb_secret_andservice_role. Supabase is blunt about these: "A secret key bypasses every Row Level Security policy you have." It belongs in an Edge Function or server code, read from an environment variable, never in aVITE_orNEXT_PUBLIC_variable. If one was ever committed, rotate it in the dashboard; deleting the line doesn't un-leak it.
When turning RLS on breaks the app
The first time you enable RLS on a table the app was reading freely, the app will probably show nothing. That's expected: "Once RLS is enabled, no data is accessible through the API when using a publishable key, until you create policies." The fix is to add one policy per operation the app actually needs (select, insert, update, delete), scoped to auth.uid(), not to switch RLS off again.
Be careful asking the AI agent to "fix the permission error". The quickest way to make that error go away is using (true), and agents know it. Read the policy it writes before you accept it.
One date to keep in mind while you're in there: Supabase says it is deprecating the legacy anon and service_role keys in early 2027. If your app still uses them, moving to publishable and secret keys is a good follow-up job, and a natural moment to check where each key lives.
If the advisor comes back clean, the curl test returns nothing, and no secret key is in the bundle, you've covered the most damaging version of this problem. If not, our page on databases open to anyone goes through what to do next.
Quick answers
Can anyone read my Supabase table if row level security is off?
Yes, if the table is in an exposed schema such as public. Supabase's docs say a table there without RLS "is readable and writable by any role with a grant on it", and new public tables grant access to anon by default. The publishable key that does this ships in your front end.
How do I find Supabase tables without row level security?
Open Advisors, then Security Advisor, in the Supabase dashboard and look for the lint "RLS disabled in public". You can also run a query on pg_tables in the SQL editor and list every public table where rowsecurity is false.
Is it safe to have my Supabase publishable or anon key in the browser?
Yes. Supabase says the publishable key is safe to expose, because RLS still applies to it. The secret key and the legacy service_role key are not: they bypass every RLS policy and must never reach the browser or your repository.
I enabled RLS on a Supabase table and now my app shows no data. Why?
With RLS on and no policies, Supabase returns no rows to the publishable key. That is the safe default. Add a policy for each operation your app needs, scoped to the signed-in user with auth.uid(), rather than turning RLS off again.
Is your app affected? Get a $199 audit
Not sure whether this touches your app? That is exactly what the audit answers.
- A recorded video walkthrough of your app, by the person who would fix it
- Written findings: what is broken or exposed, and why
- A fixed price for the fix, before any work starts