Before you start: your project only
This checklist is for founders who own a Supabase-backed app — often one built with Lovable, Bolt, Cursor or v0 — and want to know whether customer data is protected. You need owner or admin access to your project in the Supabase dashboard. Most steps only read settings; the ones that change something are marked.
One more caution before changing anything: enabling RLS on a live table immediately blocks every request that has no matching policy. That is the point, but it can also break screens your users rely on. On a production app with paying customers, make the change together with an engineer, ideally on a copy first.
What RLS is, in plain terms
Many Supabase apps, especially those built with AI tools, have no server of their own between the user and the database. The browser or mobile app sends requests straight to Supabase’s Data API, carrying a public key that anyone can read in your site’s code. What stops a visitor from simply asking for every row of every table is Postgres Row Level Security: rules that run inside the database and decide, row by row, what each request may see and change.
Supabase’s documentation is blunt about it: a table in an exposed schema without RLS is readable and writable by any role with a grant on it, so RLS should be enabled on every table in an exposed schema (usually public). Once RLS is on, nothing is accessible through the API with the publishable key until you create policies. So “RLS enabled” is half the job; the policies are the other half.
Defaults vary by how a table was made. Supabase says tables created in the dashboard get RLS by default, but UpGuard’s fall 2026 research notes that tables created programmatically through the API — the way coding agents usually work — do not. That is why apps built by an AI agent deserve this check even if you never switched anything off yourself.
Two kinds of keys: which one may be public
sb_publishable_…), legacy name anonsb_secret_…), legacy name service_roleAccording to its documentation, Supabase is deprecating the legacy anon and service_role keys by the end of 2026 in favor of publishable and secret keys. The newer secret keys add a safety net: Supabase recognizes browser requests by their User-Agent header and rejects a secret key sent from one with HTTP 401. That does not make a leak harmless — the key still works from other tools — but it catches the most common mistake early. Legacy keys are long strings starting with eyJ, and the anon and service_role keys look alike at the start; if an AI assistant or tutorial tells you to paste such a key into frontend code, compare it with the keys in your dashboard to see which one it is.
- 01
List the keys in your project
In the dashboard, open Settings → API Keys and note which keys exist and whether legacy keys are still enabled.
- 02
Search your live site
Open your site in Chrome, press F12, go to Sources and search across all files (Ctrl+Shift+F, or Cmd+Option+F on a Mac) for
sb_secret_. If legacy keys are still enabled, also search for the last 12 characters of your service_role key copied from the dashboard: only the end of a legacy key tells anon and service_role apart. Finding the publishable key is expected; finding a secret key is an incident. - 03
Search your repository
In your GitHub repository, search for the same strings and for
.envfiles committed by mistake. A key that was ever committed counts as leaked, even if a later commit removed it.
Is RLS enabled? Three ways to see it
- 01
Table Editor
The Table Editor shows a clear warning label on any table that has RLS disabled. Scroll through every table in the
publicschema, not only the ones you remember creating. - 02
Security Advisor
Open the Security Advisor in the Advisors section of your project dashboard. It runs deterministic checks and lists findings by severity. Organization owners also receive a weekly security email summarizing findings — worth reading rather than filtering.
- 03
One read-only query
In the SQL Editor, run the query below. It changes nothing; it lists each table in
publicand whether RLS is on. Anyfalseon a table with real data needs attention.
-- Read-only: lists tables in the public schema and their RLS status
select tablename, rowsecurity
from pg_tables
where schemaname = 'public'
order by tablename;What the Security Advisor findings mean
The advisor uses technical names. These are the findings that matter most for customer data, with what each one means in practice. Supabase notes that some findings can be intentional, so confirm against how your app is supposed to work before changing anything.
public has no RLS. Anyone with your project URL and public key can reach its rows. Highest priority.user_metadata, which signed-in users can change themselves — for example, to call themselves an admin.Common policy mistakes
An enabled RLS with a wrong policy is as open as no RLS at all — it just looks safer. These are the mistakes worth asking your engineer, or your AI tool, about directly.
- Always-true conditions. A policy like
using (true)for theanonorauthenticatedrole is often added to “make the error go away”. It opens the table. - A loose `with check` on inserts and updates. The
usingclause decides which existing rows a user may touch;with checkdecides what a new or changed row may look like. Inserts are governed bywith checkalone, sowith check (true)lets any signed-in user create rows in someone else’s name. On updates, Postgres reuses theusingcondition whenwith checkis omitted, but a separate, looserwith checkcan still let a user hand a row over to anotheruser_id. - Authorization stored in user metadata. Supabase warns that
raw_user_meta_datacan be updated by the signed-in user and is not a place for roles or permissions. - Views that ignore RLS. Views bypass RLS by default; on Postgres 15 and later,
security_invoker = truemakes a view obey the policies of its underlying tables. - Privileged functions in an exposed schema. A
security definerfunction runs with its creator’s privileges and, in an exposed schema, can be called over the Data API. - Assuming anonymous users are strangers. If anonymous sign-ins are enabled, those users share the
authenticatedrole, so policies written for “signed-in users” apply to them too. - Forgetting that `auth.uid()` is empty for visitors. For requests without a signed-in user it returns null; Supabase recommends making that check explicit in policies.
-- Shape of a typical "users see only their own rows" setup
alter table public.orders enable row level security;
create policy "Users read their own orders"
on public.orders for select
to authenticated
using ( (select auth.uid()) = user_id );
create policy "Users create orders for themselves"
on public.orders for insert
to authenticated
with check ( (select auth.uid()) = user_id );Storage buckets
Files — avatars, invoices, contracts, ID photos — live in Storage buckets, and they follow their own rules. Buckets are private by default, and in a private bucket every operation goes through RLS policies on storage objects. A public bucket is different: retrieving and serving its files bypasses access control, so anyone who has a file’s URL can open it. Uploading, deleting, moving and copying are still controlled by policies.
- List your buckets and note which are public. Public is fine for marketing images and avatars, not for invoices, documents or anything a customer uploaded privately.
- For private buckets, confirm the policies tie files to their owner, for example by user ID in the file path.
- Check the Security Advisor for a public bucket that allows listing.
- Make sure no upload flow relies on the secret key in the browser: service keys bypass Storage policies entirely.
If a key leaked: rotate, in this order
A publishable key in your frontend is not a leak; it is designed to be public. A secret or service_role key found in the browser, a repository, a chat or a screenshot is a leak. Supabase’s guide for this case is short, and the order matters.
- 01
Fix the cause first
Remove the key from frontend code or the repository and close whatever exposed it; otherwise the new key will leak the same way. If someone is actively using the leaked key, retire it immediately, accepting that the parts of your app that use it will stop until they are updated.
- 02
Create a new secret key
In Settings → API Keys. Use a separate secret key for each backend component, so a future leak means rotating one key, not all of them.
- 03
Switch every component to the new key
Servers, Edge Functions, webhooks, scheduled jobs. If the leaked key was the legacy service_role key, also replace the legacy anon key with a publishable key in browser and mobile clients: retiring the compromised key deactivates both legacy keys.
- 04
Retire the old key
Delete the leaked secret key, or deactivate the legacy keys, and confirm it is gone. Deleting a secret key cannot be undone, so do it after everything uses the new one — unless the key is being abused right now.
- 05
Legacy service_role only: revoke the JWT secret
Legacy keys are tokens signed by your project’s JWT secret, so anything that still trusts that secret can accept the leaked key. Supabase’s guide covers moving to JWT signing keys.
With the new key format, Supabase automatically revokes secret keys detected in public GitHub repositories and notifies the project owner. Treat that as a safety net, not a plan: it covers public GitHub repositories, and a key that leaks through a private repository, a chat or a screenshot is yours to catch. After rotating, ask an engineer to review the logs for the period the key was exposed, and if customer data may have been read, talk to a lawyer about notification duties.
The checklist in one place
- Every table in
publichas RLS enabled (Table Editor labels, Security Advisor, or the read-only query). - Every table with customer data has policies that limit users to their own rows, including a
with checkcondition on inserts that ties new rows to the user. - No policy uses an always-true condition for anonymous or signed-in users.
- No roles or permissions are read from user metadata.
- Views exposed to the API use
security_invoker, or are not exposed at all. - Only the publishable key appears in the browser; no secret or service_role key in frontend code or the repository.
- Legacy keys are on your migration list before the end-of-2026 deprecation.
- Public buckets hold only files that are meant to be public.
- Someone reads the weekly Security Advisor email.
- Backups exist and someone has restored one at least once.
If the advisor shows red findings and you are not sure what touching them will break, that is a normal moment to bring in an engineer. Our project rescue starts with a 5-day diagnosis that covers RLS, keys, storage, payments and backups; in 2026 it costs $1,500–3,500, and other ranges are on the pricing page. For the wider picture of what breaks in AI-built apps, read what to check and fix first in a vibe-coded app; for choosing who fixes it, see how to hire someone to fix an AI-built app.
Frequently asked questions
Is it safe that my Supabase key is visible in the browser?
If it is the publishable (anon) key and RLS with correct policies is enabled on every exposed table, yes: that key is designed to be public. If it is a secret or service_role key, no: it bypasses RLS and has to be rotated.
How do I check whether RLS is enabled in Supabase?
Look for the warning label in the Table Editor, open the Security Advisor in the dashboard, or run a read-only query on pg_tables in the SQL Editor that shows rowsecurity for each table in the public schema.
I enabled RLS and my app stopped working. What happened?
With RLS on and no policies, the API cannot read or write the table at all. The app needs policies that allow each user what they should see, usually their own rows. That is why the change is best made with an engineer and tested on a copy first.
Does the Security Advisor find everything?
No. It finds configuration problems such as missing RLS or always-true policies. It cannot know your business rules — for example, that a manager may see orders from their branch but not others. Those need a review of the policies against how the app is meant to work.
Do I need to rotate the publishable key if it is in my code?
No; that is where it is meant to be. Fix access with RLS instead. Rotation is for secret and service_role keys that ended up somewhere public.
Can I use this checklist on a competitor’s or partner’s app?
No. Use it only on projects you own or are authorized to test. If you believe someone else’s data is exposed, contact them privately.
Sources
Every claim here can be checked: below are the primary sources, not a retelling.
- 01Supabase docs: Row Level Security — RLS on exposed schemas, no access without policies, using vs with check, user metadata, views, security definer, auth.uid() and null
- 02Supabase docs: Understanding API keys — Publishable vs secret keys, legacy deprecation by end of 2026, 401 for secret keys in browsers, handling secret keys
- 03Supabase docs: Rotate a leaked or compromised API key — Order of steps for a leaked secret or service_role key
- 04Supabase docs: Advisors — Security Advisor lints and their meaning
- 05Supabase docs: Storage buckets — fundamentals — Private by default; public buckets readable by anyone with the URL
- 06Supabase docs: Storage access control — RLS on storage objects; service keys bypass Storage policies
- 07Supabase blog: Supabase Security Retro 2025 — Table Editor warning label, RLS by default for dashboard tables, weekly security emails, automatic revocation of leaked secret keys on GitHub
- 08UpGuard: Everything, everywhere — systemic data exposure in Supabase apps — Tables created programmatically through the API do not get RLS by default
- 09Supabase docs: Database backups — Backup availability by plan
These articles are written by engineers working on the projects and published under the desk’s name. The studio and the desk’s published rules stand behind every text, not a single author; articles about our own open-source code carry the author’s name.
How we write and what we verify