Supabase security checklist: check RLS, keys and storage in your own app

In short: in a Supabase app, the browser talks to the database directly, and Row Level Security (RLS) is the only thing deciding who sees which rows. Check four things in your own project: RLS is on for every exposed table, the policies limit users to their own data, no secret key ships to the browser, and storage buckets are not public by accident. The Security Advisor in the dashboard catches most of it. If a secret key leaked, fix the cause, then rotate.

15 min read

In short

  • A table in an exposed schema without RLS is readable and writable by any role with a grant on it — on a typical project, that includes anyone holding your public key.
  • The publishable (anon) key is meant for the browser; the secret (service_role) key bypasses RLS and must never leave your server.
  • The Security Advisor flags tables without RLS, always-true policies, views that bypass RLS and policies built on user-editable metadata.
  • A public storage bucket serves every file to anyone with its URL.
  • Leaked secret key: fix the cause, create a new key, switch every component over, then delete or deactivate the old one.

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

Key
Where it belongs
Publishable key (sb_publishable_…), legacy name anon
Browser, mobile app, public code. Anyone can read it, so it can only reach what your RLS policies allow. Safe only when RLS is on and correct.
Secret key (sb_secret_…), legacy name service_role
Only your servers, Edge Functions and scheduled jobs. It bypasses every RLS policy. Never in a browser, a shipped app, a chat message or the repository.

According 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.

Check where your keys are
  1. 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.

  2. 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.

  3. 03

    Search your repository

    In your GitHub repository, search for the same strings and for .env files 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

From quickest to most precise
  1. 01

    Table Editor

    The Table Editor shows a clear warning label on any table that has RLS disabled. Scroll through every table in the public schema, not only the ones you remember creating.

  2. 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.

  3. 03

    One read-only query

    In the SQL Editor, run the query below. It changes nothing; it lists each table in public and whether RLS is on. Any false on a table with real data needs attention.

sql
-- Read-only: lists tables in the public schema and their RLS status
select tablename, rowsecurity
from pg_tables
where schemaname = 'public'
order by tablename;
rowsecurity = false means the table has no Row Level Security

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.

Finding
What it means
Table publicly accessible (rls_disabled_in_public)
A table in public has no RLS. Anyone with your project URL and public key can reach its rows. Highest priority.
Sensitive data publicly accessible (sensitive_columns_exposed)
Same problem on a table whose columns look sensitive — emails, phone numbers, tokens. Fix first.
Security policy allows unrestricted access (permissive_rls_policy)
A policy with an always-true condition. RLS is “on”, but it lets everyone through.
View bypasses row-level security (security_definer_view)
A view runs with its creator’s rights and ignores the policies of the tables behind it.
Security policy relies on user-editable data (rls_references_user_metadata)
A rule trusts user_metadata, which signed-in users can change themselves — for example, to call themselves an admin.
User data exposed through a view (auth_users_exposed)
A view exposes the internal list of your users to API callers.
SECURITY DEFINER function callable without signing in
A privileged database function can be called by anonymous visitors.
Security policy not enforced (policy_exists_rls_disabled)
Someone wrote policies, but RLS is off on the table, so they do nothing.
No access rules defined (rls_enabled_no_policy)
RLS is on with no policies: the API cannot read or write the table. Safe, but often the cause of “the app stopped working after we fixed security”.
Public bucket allows listing (public_bucket_allows_listing)
Clients can list every file in a public storage bucket, not only fetch files whose URL they know.

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 the anon or authenticated role is often added to “make the error go away”. It opens the table.
  • A loose `with check` on inserts and updates. The using clause decides which existing rows a user may touch; with check decides what a new or changed row may look like. Inserts are governed by with check alone, so with check (true) lets any signed-in user create rows in someone else’s name. On updates, Postgres reuses the using condition when with check is omitted, but a separate, looser with check can still let a user hand a row over to another user_id.
  • Authorization stored in user metadata. Supabase warns that raw_user_meta_data can 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 = true makes a view obey the policies of its underlying tables.
  • Privileged functions in an exposed schema. A security definer function 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 authenticated role, 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.
sql
-- 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 );
An illustration of the pattern from the Supabase docs, not a drop-in fix: your tables and rules will differ

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.

Storage check
  • 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.

Supabase’s procedure for a leaked secret key
  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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

For your own Supabase project
  • Every table in public has 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 check condition 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.

  1. 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
  2. 02Supabase docs: Understanding API keys — Publishable vs secret keys, legacy deprecation by end of 2026, 401 for secret keys in browsers, handling secret keys
  3. 03Supabase docs: Rotate a leaked or compromised API key — Order of steps for a leaked secret or service_role key
  4. 04Supabase docs: Advisors — Security Advisor lints and their meaning
  5. 05Supabase docs: Storage buckets — fundamentals — Private by default; public buckets readable by anyone with the URL
  6. 06Supabase docs: Storage access control — RLS on storage objects; service keys bypass Storage policies
  7. 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
  8. 08UpGuard: Everything, everywhere — systemic data exposure in Supabase apps — Tables created programmatically through the API do not get RLS by default
  9. 09Supabase docs: Database backups — Backup availability by plan
dbit.one engineering desk
The engineers who build these systems

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

Related services

Read next

Questions about your project?

Describe your task — within 24 hours we’ll come back with an estimate, timeline and plan.

hello@dbit.one