The Lovable Leak Wasn't About the Key. It Was Row-Level Security
A security firm found passport numbers and private chats in apps built with Lovable. The fix is one database setting, and you can check yours in about fifteen minutes.
Most AI-built apps that leak data were never hacked. Nobody guessed a password or stole a secret. A browser asked the database for a table, and the database handed it over, because nothing told it to say no.
That is the uncomfortable center of a report now sitting near the top of Hacker News. Crissy Field, a German security firm, looked at apps built with Lovable, the tool that turns a plain-English description into a working web app. In thousands of them, records came back to requests that never logged in. Some of those records were passport numbers.
The tempting reading is "AI writes insecure code." The more useful reading is narrower and easier to act on. These apps sit on a database that is designed to be reachable from any browser, with a key that is designed to be public. For any table the browser can reach, the thing standing between a stranger and the rows is a set of rules inside the database called row-level security. If those rules are missing or say "let everyone in," the app is open, however good the code looks. In a browser-first app, the database rules are the backend.
The result: you can audit this yourself, today, without being a security person. Here is what the report found, why the key was never the problem, and the short checklist that tells you whether your own app is one of the open ones.
What the scan actually found
Crissy Field worked with the German business paper Handelsblatt, which first reported the findings on November 2. The firm's English report has updated figures.
Using Common Crawl, a public archive of the web, the team identified 159,041 Lovable projects from December 2025 to September 2026. Of those, 34,545 used Supabase, a popular hosted database. And 24,664 of those sites sent database records the moment the page loaded, no login needed.
On its own, that is not a breach. Plenty of data is meant to be public, like a product list or a menu. The firm then made extra read-only requests using the same public key the page itself used, and found records containing email addresses in 10,560 tables across 7,403 sites.
The examples are what make it real:
- A German lifestyle forum exposed more than 80,000 profiles and more than 200,000 chat messages.
- Event organizers and restaurants exposed tens of thousands of ticket and food-sale records, including phone numbers, addresses and payment information.
- One service provider exposed more than 1,000 records with passport numbers, expiry dates and nationalities.
- One provider's 280,000 sent customer emails were readable.
The firm is careful about its own numbers, and so should we be. It says the 30% share (7,403 of 24,664) "should not be read as a confirmed data leak rate," because some email addresses are public contact details or test data, and its sample is not representative of all Lovable apps. It also could not tell whether anyone misused the data. Crissy Field report
Why the key was never the problem
Here is the part that trips people up. Every one of these apps ships a database key inside its web page. Anyone can open the browser's developer tools and see it. That sounds like the leak. It is not.
Supabase's own docs explain the design with a building analogy. The "publishable" key (older projects call it the anon key) is "taped to the front door, and it only opens the lobby." The "secret" key is "the master key, and it stays in your pocket." The publishable key is explicitly safe to expose in web pages and mobile apps, because "it only reaches what Row Level Security allows." The secret key bypasses those rules entirely and must never reach a browser.
So the whole security model rests on one question: what does the lobby contain?
Row-level security (RLS) is a Postgres feature that answers it. Supabase's docs describe a policy as adding a WHERE clause to every query. A request to "give me all profiles" becomes "give me the profiles where the owner is the person asking." With row-level security switched off, or with a policy whose condition is simply "true," the request gets every row the database role is allowed to touch. (Switch it on with no policies at all and Postgres denies everything, which is the safe failure.)
That is the insight worth keeping: the database rules are the backend. There is no server in the middle double-checking. If you skipped writing those rules, you skipped writing your security.
Three defaults that make this easy to get wrong
One more term first. Postgres has two layers of permission. A grant decides whether a role (signed-out visitor, signed-in user, server) can touch a table at all. A policy decides which rows that role sees. None of this is buried in a footnote; Supabase documents it clearly. The trouble is that three defaults line up against anyone who never opens the database settings.
Older tables arrived fully open to signed-out visitors. For most of the period the scan covers, a new Supabase table in the public schema got select, insert, update and delete granted automatically to the anon role (the role for signed-out visitors), the authenticated role and the service_role. Supabase has since changed that. New projects stopped exposing new tables by default from May 30, 2026, and the change reached all existing projects on October 30, 2026. The catch, in Supabase's own words: "Existing tables are not affected in your project, they keep their current grants and stay reachable." Their stated reason is telling. Agents and AI platforms now create tables "and many of those operations do not have a human reviewing the diff."
Adding a policy does not take the grants back. The RLS guide puts it bluntly: "A table protected only by policies still hands anon an insert path if you never revoke the grant." Supabase RLS guide
Views skip the rules unless you tell them not to. A view is a saved query that looks like a table. Supabase's docs warn that views bypass RLS by default, so "a view over a protected table hands out every row its policies were meant to withhold."
Now put a person in front of those defaults who has never seen the Supabase dashboard, because the app builder created the tables for them. Crissy Field points out that Lovable's marketing repeatedly says no technical knowledge is needed, while its terms put responsibility for apps and data on the customer. Lovable's own security docs say the same thing in plainer words: its scans "do not replace a thorough security review," and "you are responsible for ensuring that your app meets the security requirements appropriate for its use case."
That gap is the story. Not bad code. A missing step, owned by someone who did not know the step existed.
Put this into practice: a fifteen-minute check
This works for any app on Supabase, whether Lovable, another builder, or your own hands made it. Do it on a project you own. Crissy Field deliberately did not publish how it reached other people's data, and you do not need to either.
1. Look at your app the way a stranger does. Open it in a private browser window, logged out. Open the developer tools (right-click, Inspect), go to the Network tab, and reload. Look for requests to an address ending in supabase.co/rest/v1/. Click each one and read the response. If you see rows that a signed-out visitor should not see, like emails, orders or messages, you have your answer already.
2. List which tables have RLS turned on. In the Supabase dashboard, open the SQL Editor and run:
select tablename, rowsecurity
from pg_tables
where schemaname = 'public';
pg_tables is a standard Postgres catalog view. Any row with rowsecurity set to false is a table without row-level security. It is reachable from the browser if the anon role (or authenticated, for logged-in users) also holds a grant on it, which older tables usually do. Treat every false as a table to fix, not a table to argue about. Expect to find a few. Tables created early in a prototype are the usual suspects.
3. Find the rules that let everyone in. Run:
select tablename, policyname, roles, cmd, qual
from pg_policies
where schemaname = 'public';
pg_policies lists every policy. Look at the qual column (the condition) for policies that apply to anon or public. A condition of true means every signed-out visitor can read every row the role can reach. Supabase's guide says to use that only for data that is meant to be public. A menu, fine. A bookings table, no.
4. Run the scanner you already have. If you built on Lovable, its Quick scan runs automatically every time you publish and checks for tables without row-level security, access rules that let everyone through, and leaked-password protection turned off. The Deep scan goes further, into logic like "users who can view or change data that is not theirs." Open the Security view and read what it already found. Plenty of people publish past warnings they never opened.
5. Fix one table properly. For a table where each user should see only their own rows, the shape looks like this:
alter table profiles enable row level security;
create policy "Users read their own profile"
on profiles for select
to authenticated
using ( (select auth.uid()) = id );
Supabase's helper auth.uid() returns the ID of the signed-in user making the request. This example assumes the table's id column holds that user ID; if your table stores the owner in a user_id column, compare against that instead. Once RLS is on, no data is reachable with the publishable key until you add policies, so turning it on is a safe first move even before every policy is written. Your app may break in places. That breakage is showing you every spot that was relying on the table being open.
Then follow Supabase's own order: revoke the grants a role does not need, write a separate policy for select, insert, update and delete, and add a test file under supabase/tests/ that you run with supabase test db. The guide's line on this is worth taping above your desk: "Until the suite passes, you don't know whether the policies do what you intended."
6. Check your views. If you created any views, read Supabase's section on exposing a view safely before you trust them.
What to expect: on a small app, steps 1 to 4 take about fifteen minutes. Fixing what you find takes longer, mostly because you will discover features that depended on open tables without anyone noticing.
Honest limitations
This check covers one door. It is the door Crissy Field walked through, but it is not the only one.
- It is Supabase-specific. The firm studied Supabase because it is easy to analyze and, it believes, the most common database among Lovable projects. Lovable's own newer database features were not examined, and the firm says similar mistakes may happen there too.
- RLS does not cover everything. Supabase's docs list jobs policies cannot do, like rate limits and payment checks, which need separate request checks.
- Server code can step around your rules. Anything holding the secret key ignores RLS. If an edge function or backend uses it, that code needs its own checks. Lovable's Deep scan looks for exactly this case.
- Scanners miss things. Crissy Field says automated checks "are no substitute for a professional security assessment," and Lovable says its scans do not replace a security review. If your app holds identity documents, health data or payments, pay someone to look.
- A clean check today is not a clean check next month. Supabase's newer default keeps new tables hidden until someone grants access, but an agent or a builder can add that grant along with a table. Re-run steps 2 and 3 after any change that adds tables.
The setting nobody showed you
App builders hide the database, and for a prototype that is the point. The cost is that they also hide the one screen where you decide who gets to read your users' data. Crissy Field's report is what that cost looks like at scale: tens of thousands of sites, one recurring pattern, and passport numbers in the lobby.
You do not need to stop using these tools. You need to know that a public key plus missing rules equals a public database, and you need to look. Open a private window and see what your app tells a stranger. The people whose data is in those tables would happily trade places with you for it.
Sources: Crissy Field, "Lovable: Many Apps Built on the Platform Expose Sensitive Data" · Handelsblatt, November 2, 2026 · Supabase: API keys · Supabase: Row Level Security · Supabase: Securing your API · Supabase platform defaults discussion · Lovable: Security overview · PostgreSQL: pg_tables and pg_policies. Docs read November 15, 2026.