Guides · Updated Oct 15, 2026 · By Lucy at KeySnare

Is my Supabase app safe? How to check Row Level Security

If your app uses Supabase, the most important security setting is Row Level Security (RLS). Your Supabase URL and anon key ship inside your website, so anyone can call your database API. RLS policies are what decide which rows each visitor can read or change.

Why this matters

The anon (or "publishable") key is meant to be public. That's safe only when RLS is enabled on your tables and the policies are correct. If a table in the exposed public schema has RLS turned off, anyone who copies the key from your site can read, edit or delete every row through Supabase's auto-generated API.

Tables created in the Supabase Table Editor have RLS enabled by default, but tables created with raw SQL (in the SQL Editor, in migrations, or by an AI tool) don't, unless the SQL turns it on.

How to check, step by step

  1. Open the Security Advisor. In your Supabase dashboard, go to Advisors → Security Advisor. It flags tables in the public schema with RLS disabled.
  2. Check each table. In Table Editor, tables without RLS show a warning label. Or run this in the SQL Editor:
    select schemaname, tablename, rowsecurity
    from pg_tables
    where schemaname = 'public';
    Any row where rowsecurity is false needs fixing.
  3. Look at your policies. RLS turned on with no policies blocks everything (safe, but your app may break). A policy like using (true) lets everyone through, which is the same as no protection for that action.
  4. Check your migrations. Search your repo's supabase/migrations folder for create table and make sure each table has a matching alter table ... enable row level security.
  5. Make sure the service_role key is server-only. It bypasses RLS completely. It must never appear in browser code or in a NEXT_PUBLIC_/VITE_ variable.

How to fix it

alter table public.todos enable row level security;

create policy "Users can read their own todos"
on public.todos for select
to authenticated
using ( (select auth.uid()) = user_id );

create policy "Users can add their own todos"
on public.todos for insert
to authenticated
with check ( (select auth.uid()) = user_id );

Then test it: sign out and try to load the data, or call the REST API with only the anon key. You should get an empty list, not other people's rows.

Getting error 42501 on a new table? Since Oct 30, 2026 Supabase no longer exposes new public tables to the Data API automatically, so each one needs an explicit GRANT. Don't fix it by disabling RLS or bulk-granting everything. See the safe 42501 fix.
KeySnare checks this automatically. When a scanned repo contains Supabase SQL migrations, KeySnare flags tables that are created without RLS being enabled. It also flags the service_role key in browser code. It can only see what's in your repo, so settings changed in the dashboard won't show up.

Copy-paste prompt for your AI coding tool

Paste this into Cursor, Claude, Lovable, Bolt or whichever AI built your app:

Audit my Supabase project's Row Level Security. For every table in the public schema: 1) make sure RLS is enabled, 2) list the existing policies and explain in plain English who can select, insert, update and delete, 3) write a new migration that enables RLS where missing and adds policies so users can only access their own rows (use auth.uid() and my owner column), 4) make sure the service_role key is only used in server-side code. Then tell me how to test that a logged-out user gets no rows.

Check your repo in about a minute

Paste a public GitHub repo into KeySnare for a free grade and your top 3 issues, each with a copy-paste AI fix prompt.

Run a free scan →

FAQ

Is the Supabase anon key a secret?

No. It is designed to be public and ships in your frontend. That is only safe when Row Level Security is enabled with correct policies on every exposed table.

Does Supabase turn on RLS by default?

Tables created in the dashboard Table Editor have RLS enabled by default. Tables created with SQL, including migrations written by AI tools, need an explicit "alter table ... enable row level security" statement.

What happens if RLS is on but there are no policies?

All access through the anon and authenticated roles is denied, so your data is safe but your app may stop showing data until you add policies.

Does the service_role key respect RLS?

No. The service_role key bypasses RLS, so it must only be used in trusted server code and never in the browser.

Can KeySnare check my Supabase dashboard settings?

No. KeySnare scans your GitHub repo, so it checks SQL migrations and code. Use Supabase's Security Advisor for live database settings.

More guides: Supabase RLS filters rows, not columns: stop leaking emails and private fields · Supabase "permission denied for table" (42501) after Oct 30: the safe fix · How to hide API keys in Lovable, Bolt and Cursor apps · How to check your Firebase security rules before launch · NEXT_PUBLIC_ and VITE_ variables: why your secret keys are public · Vibe-coded app security checklist: 12 checks before you launch