Supabase row level security, explained for founders
Row level security decides who can read and change each row of your data. Here is what it is, why AI tools get it wrong and how to check yours in ten minutes.
Row level security (RLS) is the rule set that decides which rows of your database each user can see and change. In a Supabase app the browser talks to the database directly, so RLS is often the only thing standing between a stranger and your users' data. If it is off, anyone with your public key may be able to read the table.
Why does Supabase need RLS more than other setups?
In a traditional app, the browser asks your server, and your server decides what to return. Supabase skips that server for speed: the app calls the database through an API, using a public key that ships in your site's code. That design is safe only when every table has rules attached.
Supabase's own documentation is direct about it: "A table in an exposed schema without RLS is readable and writable by any role with a grant on it." It tells you to enable RLS on every table in an exposed schema.
What does a policy actually say?
A policy is a short rule in SQL. The most common one lets people see only their own rows:
create policy "Users read their own profile"
on profiles for select
using ( (select auth.uid()) = user_id );
Read it as: when someone asks for rows from profiles, return only the rows whose user_id matches the signed-in user. You write separate policies for reading, adding, changing and deleting, because each carries a different risk.
Why do AI-built apps get RLS wrong?
- Tables created on the fly. When an AI tool adds a table to get a feature working, the rules can lag behind.
- Policies that allow everything. A policy of
using (true)turns RLS on and lets everyone in. It silences warnings without protecting anything. - Forgotten write rules. Read access gets attention. Insert and update rules often do not, which lets anyone change data.
This has happened at scale. In 2025 a researcher found 170 AI-built projects whose missing or weak RLS left emails, phone numbers and payment data readable, recorded as CVE-2025-48757. About 70% of the affected apps had RLS switched off entirely, according to The Next Web.
SIGSHIP flags tables with no row level security and policies that let anyone write. Free, open source, runs on your computer.
How do you check your RLS in ten minutes?
- List your tables. In the Supabase dashboard, open the Table Editor. Tables without RLS are marked as unrestricted.
- Read each policy. Open the Policies page. For every table, ask who should read it, and whether the rule says exactly that.
- Look for
true. Any policy whose rule is simplytrueneeds a reason. A public product list may be fine. User data never is. - Check writes separately. Make sure insert, update and delete each have a policy or are blocked.
- Test as a stranger. Sign in as a second test user and try to load the first user's data. If it appears, the policy is wrong.
SIGSHIP, our free, open-source launch check, flags two of these automatically: tables with no RLS and policies that let anyone write. Run npx sigship in your project folder. It works on your computer and uploads nothing.
What about the service role key?
Supabase gives you two kinds of key. The anon or publishable key is meant to be public, and RLS limits it. The service role key bypasses RLS completely. It belongs only on a server or in an edge function, never in browser code or a mobile app. If it has ever shipped to the browser, rotate it today.
When should you get help?
If your app stores payments, health details or anything about children, have an engineer review the policies before launch. RLS rules are short, but one wrong comparison can expose everything. Our 8 launch checks for AI-built apps cover keys and payments too.
Questions
What is row level security in Supabase?
A Postgres feature that attaches rules to each table, deciding which rows a user can read, add, change or delete. Supabase relies on it because the browser queries the database directly.
Is my data public if RLS is off?
If the table is in an exposed schema such as public and RLS is off, Supabase says it is readable and writable by any role with a grant on it. That usually includes anyone with your public key.
Is the Supabase anon key a secret?
No. It is designed to be public, and row level security limits what it can do. The service role key is the secret one and must stay on the server.
Will turning RLS on break my app?
It can, until you add policies. With RLS on and no policies, the public key sees no rows. Add policies table by table and test each flow.
How do I limit users to their own data?
Write a policy that compares the signed-in user with the row's owner, such as (select auth.uid()) = user_id, with separate policies for select, insert, update and delete.
The Idea Lab turns a two-sentence idea into a build plan: why it could work, what to get right first, the first version worth building and its price. Two minutes, from our published rates.
Next: How to switch software development agencies without losing your code