1. API keys: which one is in the browser
A Supabase project has two kinds of keys. The publishable key, called the anon key in older projects, is meant for the browser: it can only do what row-level security allows. The secret key, or the older service_role key, bypasses every policy and must only exist on a server: in edge function secrets, in a backend's environment or in a CI pipeline.
Open the published app, view the page source and search the loaded JavaScript for service_role, sb_secret and secret. Search the GitHub repository and its history too. If the secret key has ever been in the frontend, in a commit or in a shared chat, rotate it in the project's API settings; deleting the line does not undo the copies people already have.
The database password and the direct connection string count as secrets as well. They belong in a password manager and in server-side settings, never in code.
2. Supabase row level security on every table
Row-level security (RLS) is the setting that keeps one customer's rows away from another's. Any table in an exposed schema without RLS can be read and changed with the publishable key, no sign-in required. Open the Security Advisor under Database in the dashboard: it lists tables in the public schema with RLS off, and tables where RLS is on but no policy exists.
Turn RLS on for every table in the public schema, including lookup tables you think are harmless, and keep it on. A table with RLS and no policies returns nothing through the API, which is safe; a table without RLS returns everything.
- RLS is enabled on every table in public and in any other schema exposed to the API.
- No table was switched to the secret key "temporarily" to get a feature working.
- Views are created with security_invoker = true on Postgres 15 and later, so the caller's policies apply instead of the creator's.
- Functions marked security definer live outside exposed schemas or have execute revoked from anon and authenticated, and set an explicit search_path.
3. Supabase RLS policies that say the right thing
A policy that exists is not the same as a policy that is right. For each table, write down who may select, insert, update and delete, then compare that with the policies. List them in one go in the SQL editor:
- select tablename, policyname, cmd, roles, qual, with_check from pg_policies where schemaname = 'public';
- A select policy with USING (true) makes every row public. That suits a price list, not orders.
- A policy scoped to the authenticated role but not to the owner lets anyone who signs up read everyone's data.
- Insert and update policies need WITH CHECK, or a user can create or move rows into another account.
- Roles come from a table users cannot write to, or from app_metadata. user_metadata is editable by the user, so a policy that trusts it can be bypassed by anyone.
- Team or organisation membership is looked up in the database, not taken from an org_id the browser sends.
4. What the API exposes
The Data API publishes every table and view in the schemas listed under exposed schemas in the API settings, through REST and GraphQL alike. Keep that list to what the app uses. If a view or table joins to auth.users, the Security Advisor warns about it: email addresses of every account should not be reachable from the public schema.
Check the maximum rows setting, which caps how many rows one request returns, and lower it if a list endpoint should never return thousands of records. If the app only talks to the database through your own server, the Data API can be turned off entirely.
5. Auth settings for the real domain
Most sign-in problems after launch are settings that still point at the preview. In Authentication settings, set the Site URL to the production domain and put every page that receives a login or password-reset redirect in the redirect allow list. A missing entry sends users to localhost or to the preview.
Then go through the protections one by one. Each is a switch in the dashboard, and the defaults suit development rather than launch:
- Email confirmation is on, so an address has to be proven before it can be used.
- Leaked-password protection, which rejects passwords found in known breaches, is on if your plan includes it, and the minimum password length is set.
- A CAPTCHA (hCaptcha or Cloudflare Turnstile) protects sign-up and password reset if the app is public, and sign-ups are disabled altogether if only invited users should get in.
- Email goes through your own SMTP provider from your domain. The built-in email service is rate-limited and meant for testing, and the rate limits in Auth settings match what real traffic needs.
- Multi-factor authentication is enabled for admin and staff accounts, and the app checks the assurance level before showing admin pages.
- Unused sign-in methods are turned off, and any social provider has its production client ID and redirect address, not the ones from testing.
6. Storage buckets and files
A public bucket serves any file to anyone who has its address, and addresses leak through logs, browser history and shared screenshots. Keep uploads private unless they are meant for everyone, and write storage policies on storage.objects the same way as table policies: who may upload to which path, who may read, who may delete.
Set an allowed list of file types and a size limit on each bucket, and hand out private files through signed URLs that expire rather than through a permanent address.
7. Edge functions, webhooks and secrets
Edge functions are where the secret key and third-party API keys belong, stored as function secrets rather than in the code. By default a function requires a valid Supabase JWT, which proves the caller is signed in and nothing more. Anything an admin should do still needs a role check inside the function.
Functions that receive webhooks from Stripe or another provider have JWT verification turned off, because the provider does not have a user token. Those functions must verify the provider's signature instead, and must handle the same event arriving twice without granting access twice.
A function that calls an AI model needs a rate limit per user and a spending cap at the provider, or one script can run up the bill overnight.
8. Database access from outside the app
Dashboards, scripts and AI builders often connect straight to Postgres with the database password. Give each of them a database role of its own with only the rights it needs, rather than the postgres superuser, and rotate the password when a tool or a contractor no longer needs it.
If your plan supports it, enforce SSL on incoming connections and restrict direct database access to known IP addresses. Neither affects the Data API, which goes through Supabase's own gateway.
9. Backups and a way back
Check which backups your plan includes: free projects have none and are paused after a period without traffic, paid plans take daily backups, and point-in-time recovery is an add-on. Then restore a backup into a fresh project once, before launch, so you know how long it takes and that nothing is missing.
Keep every schema change in a migration file in the repository, run it against a development project first, and take a backup before any migration touches production data, whether a person wrote it or a builder did.
10. Recheck after every change
Settings drift. A new table from a prompt starts without policies, a quick fix opens a policy wider than intended, and a new function lands in the public schema. After each change to tables, functions or sign-in, rerun the Security Advisor and the two-account test from our Supabase RLS guide: sign in as two customers and try to open each other's records.
Turn on the logs you will need before you need them. Auth logs show failed sign-ins and password resets, API logs show which tables are being hit and by whom, and both are easier to read on a quiet day than during an incident.
A checklist like this finds the common mistakes. It does not prove an app is secure, and no review can. If the app holds personal data, takes payments or has several user roles, a review by someone who did not build it, using only the access you give, is the sensible next step before launch.
Frequently asked questions
Is Supabase secure?
The platform is widely used in production and publishes its security and compliance information. What leaks data in practice is project configuration: tables without row-level security, policies that are too wide, the secret key in a frontend or auth settings left on development defaults. Those are yours to check.
What is the most common Supabase security mistake?
A table in the public schema without RLS, or with a policy that lets any signed-in user read every row. The publishable key is in every visitor's browser, so either one exposes the whole table.
Does Supabase have an official security checklist?
Yes. The Supabase documentation has a production checklist and the dashboard has a Security Advisor that flags common problems. This guide adds the checks a scanner cannot make, such as whether a policy matches your business rules.
How much does a Supabase security review cost?
Our launch check costs $1,500 and takes three business days. It covers sign-in, RLS policies, secrets, payments, backups and deployment using only the access you give, and ends with a written report and a fixed price for the fixes, credited against fixes ordered within 30 days.
Not sure your app is ready for real users?
Our launch check reviews sign-in, data access rules, secrets, payments, backups and deployment, using only the access you give us. In 3 business days you get a written report with each issue ranked by risk and a fixed price for the fixes. $1,500, credited against fixes ordered within 30 days.
If you already know what needs fixing, book a call and get a fixed quote for the fix instead.