
Supabase row level security explained: why AI-built apps leak data and how to check yours
By Yash Malviya·
Row level security is the setting that makes a Supabase database check who is asking for each row. Without it, a table that the app exposes can be read by anyone holding the public key. Here is how to check.
Row level security, usually shortened to RLS, is the feature that decides who can see which rows in a Supabase database. If you build an app with an AI tool and connect it to Supabase, RLS is the setting standing between your users' data and the public internet. Researchers who scanned thousands of AI-built apps in 2026 found many with the door open. This explainer covers what RLS is, what goes wrong and how to check.
What row level security is
Supabase is a hosted service built on Postgres, a widely used database. Its documentation describes Postgres row level security as giving "granular authorization rules that run inside the database." Each policy is attached to a table and runs on every access, effectively adding a WHERE clause to every query. A policy might say a signed-in user can read only the rows where the user id column matches their own id.
Because the rule runs inside the database, it holds no matter how the request arrives. A bug in the app's interface does not bypass it. That is the strength of the design, and also why leaving it off matters so much.
Why the public key is not the problem
Browser apps built on Supabase talk to the database through an API using a key that ships in the page. The docs now call it a publishable key and describe an anon role that handles requests from people who are not logged in. The key is meant to be visible. Crissy Field's research makes the same point about the Lovable apps it scanned: further read-only requests with the key the page gives every browser retrieved more content.
The security therefore comes from what the database allows that role to do. The docs spell this out: "A table in an exposed schema without RLS is readable and writable by any role with a grant on it." On existing projects, the docs say a new table in the public schema starts with every privilege granted to anon, authenticated and service_role, though not every project gets these automatic grants. Once RLS is enabled, the docs say, no data is accessible through the API using a publishable key until you create policies.
“A table in an exposed schema without RLS is readable and writable by any role with a grant on it.”

What the Lovable scan found
In November 2026 the German security firm Crissy Field published research on Lovable, an AI app builder. It used Common Crawl to identify 159,041 Lovable projects built from December 2025 to September 2026. Of these, 34,545 used Supabase. On 24,664 sites, database records were sent on page load without a login.
The authors are careful. They say the share of sites with email addresses, 30 percent, is not a confirmed leak rate, that the sample is not representative and that some emails may be public or test data. The exposed data they describe includes chat messages and records with passport numbers. We report the incident in full in our news piece on the Lovable data exposure research. The lesson for this explainer is the mechanism: an app can look finished and still have an open database.
Four mistakes the docs warn about
The Supabase guide lists several pitfalls. Each is easy to make and invisible to the app's owner.
- No RLS at all. The docs say to enable RLS on every table in an exposed schema, and to revoke
anonandauthenticatedgrants where they are not needed. - A policy that allows everyone. A policy
to anon using (true)exposes every row to any unauthenticated visitor. Use it only for data that is truly public. - Views. Views bypass RLS by default. On Postgres 15 and later, set
security_invoker = true. - A secret key in the browser. The docs say "Never use a secret key in the browser or expose it to customers." Secret keys bypass RLS.
There is a subtler trap too. The function auth.uid() returns null for unauthenticated requests, so a check like auth.uid() = user_id can silently fail. The docs recommend adding an explicit IS NOT NULL check.
A short checklist to run today
You do not need to be a database specialist to run the first pass. Open the Supabase dashboard and go through these steps for every table the app uses.
- Confirm RLS is enabled. If a table shows it off, turn it on and then create policies.
- Read each policy. If any reads
using (true)for theanonrole, ask whether that table is meant to be public. - Check views and functions that read tables, since they can sidestep policies.
- Search your app's code and your repository for a secret key. If one is in front-end code, rotate it.
- Test as a visitor. Open the app in a private window, signed out, and try to load data that should be private. Better, have a second person try.
This checklist comes from our reading of Supabase's documentation and Crissy Field's findings. It is not a substitute for a professional security assessment, which Crissy Field itself says automated checks cannot replace. If personal data was ever exposed, legal duties to notify vary by jurisdiction, so get advice.
Why AI builders make this more likely
AI tools write the connection code, the login screens and the data tables from a prompt. The owner sees a working app. The access rules are a separate layer that the prompt may never mention, and a tool optimizing for "it works" can leave it at the default. None of that is unique to one vendor. It is a general risk of shipping generated code without review.
Our take
Row level security is the single most important Supabase setting for an app with real users, and it is cheap to get right. The Lovable scan is a reminder that the default state of generated software is unreviewed. Turn RLS on, write narrow policies, test as a stranger and ask a human to look before you ship.
Frequently asked questions
What is Supabase row level security?
Row level security is a Postgres feature that Supabase exposes to control which rows each user may read or write. Supabase docs describe it as granular authorization rules that run inside the database, applied to every query through table policies.
Is the Supabase anon key a secret?
No. The key used by browser apps is meant to be visible, and requests with it run as the anon role. Safety comes from RLS and policies. Secret keys are different: the docs say never to use one in the browser, because they bypass RLS.
What happens if RLS is off on a Supabase table?
Supabase docs say a table in an exposed schema without RLS is readable and writable by any role with a grant on it. On existing projects, new public tables start with privileges granted to anon, authenticated and service_role.
Why did Lovable apps expose data?
Crissy Field found 24,664 of its sampled Lovable sites sent Supabase records on page load with no login, which points to missing or permissive access rules. The authors say the figures are not a confirmed leak rate and the sample is not representative.
How do I test whether my app leaks data?
Check that RLS is enabled on every exposed table, review any policy that allows the anon role, and sign out and try to load private data. Crissy Field says automated checks are no substitute for a professional security assessment.
Sources
What each one is, and whose it is.
- 1
Row Level Security, Supabase documentation (November 16, 2026)
Documentation - 2
Lovable research report, Crissy Field (November 3, 2026)
OtherIndependent of the vendor - 3
Thousands of Lovable apps are leaking personal data, Techzine Global (November 4, 2026)
Press reportIndependent of the vendor