AI-Generated Apps Are Shipping Without Row-Level Security
Passports and 200K+ private messages leaked from AI-built apps via missing Supabase row-level security. Here's how to audit yours.

159,041 apps. That's how many AI-built web applications one research team pulled out of the Common Crawl archive and checked for a single, boring failure: could they read database records without logging in? For 7,403 of the sites they probed in depth, the answer was yes — tables containing email addresses were readable by anyone who asked. Digging further turned up full names and dates of birth, payment details, ticket codes, internal WhatsApp exports, AI-generated summaries of a property manager's email, more than 200,000 private chat messages from a lifestyle forum, and — in the worst case — over a thousand records containing passport numbers, expiry dates and nationalities. The root cause in case after case was missing Supabase row-level security, and exploiting it required nothing more exotic than a browser's developer tools.
Worth being precise about the numbers, because they get misquoted. Of the 159,041 Lovable projects identified, 34,545 used Supabase as their database. Of those, 24,664 sent database records to the browser the moment the page loaded — no login, no interaction. That alone isn't a bug; plenty of data is meant to be public. So the researchers made additional read-only requests using the exact same API key each site shipped in its own JavaScript, and looked at what came back. Records containing email addresses appeared in 10,560 tables across 7,403 sites — 30% of the sites examined closely. That's not a confirmed breach rate, and the researchers are careful to say so: some of those addresses are public contact inboxes or test data. But the cases they verified manually were unambiguous. Real customers. Real passports. Real private messages.
Supabase Row-Level Security Is the Only Gate
To understand why this keeps happening, you have to understand the deal Supabase makes with you. You get a Postgres database with an auto-generated REST API in front of it, and your frontend talks to the database directly. There is no backend tier enforcing authorization — no Express middleware, no Django permission mixin, nothing. The browser holds an anon API key, which is public by design and ships in your JavaScript bundle. A second key, service_role, bypasses everything and must never touch a client.
Because the client connects straight to the database, the database itself must decide what each request may see. That mechanism is Postgres row-level security: per-table policies that filter which rows a given role can read or modify. Here's the part that bites people: if RLS is not enabled on a table, the public anon key can read and write every row in it. Full stop. The table might as well be a static JSON file on your CDN.
create table profiles (
id uuid primary key default gen_random_uuid(),
full_name text,
email text,
date_of_birth date
);
-- This is the line that decides whether the table is public:
alter table profiles enable row level security;
-- Without it, the shipped anon key reads and writes every row.
# The "attack": the same request the app makes, minus the login
curl "https://your-project.supabase.co/rest/v1/profiles?select=*" \
-H "apikey: eyJhbGciOi..." \
-H "Authorization: Bearer eyJhbGciOi..."
Look at that curl command again. It isn't an exploit in any meaningful sense. It's the same request the legitimate frontend makes, replayed without a user session. The API key isn't stolen — it was published, served to every visitor as part of the site's own code. The only thing standing between that request and your customers' passports is a Postgres setting that nobody turned on. This is why I keep saying the Lovable exposures weren't "hacked." They were left unlocked.
Why AI App Generators Ship Broken Access Control
The obvious question: why does the generator not just enable RLS? Because from the generator's perspective, nothing is broken. The app works. The preview loads, the records appear, the demo impresses the founder who prompted it into existence. Missing access control is a silent failure — an app with no RLS behaves identically to a correctly secured one right up until someone unauthorized shows up. There's no stack trace for "stranger in another country is reading your messages table." A generator optimized for "does it run" will systematically under-invest in "who else can run it."
There's also a specification problem. "Build me a booking platform for my restaurant" contains zero information about who should be allowed to read the reservations table. A human developer fills that gap with convention, scar tissue, and awkward questions in the kickoff meeting. An LLM fills it with the statistically most common continuation — and the most common Supabase tutorial code on the internet has RLS disabled, because tutorials disable it to keep the happy path short. This is the specification-implementation gap doing what it always does: the bug lives exactly where the prompt was silent.
Then there's the defaults question, and Supabase owns a slice of this. For years, new tables created through its dashboard had RLS off unless you knew to enable it — a deliberate onboarding tradeoff, since nothing kills a tutorial's momentum like queries returning empty results. After sustained criticism, Supabase moved new projects toward RLS-by-default, but existing projects kept their original posture. Stack that on top of a generator trained on years of pre-default-change code and you get a pipeline that reliably produces exposed tables.
Finally, the human factor. Lovable's pitch is that no technical knowledge is needed — and its terms place responsibility for the application and its data squarely on the customer. That gap is where 7,403 leaking apps came from. A non-technical founder cannot audit what they cannot read. They don't know RLS exists, they don't know the anon key is public, and the platform's cheerful "your app is live!" moment gives them no reason to ask. Marketing said the plane flies itself. The fine print said they're the pilot.
One Broken Pattern, Thousands of Identical Targets
What makes this genuinely dangerous isn't any single leaky app — it's the homogeneity. AI generators produce recurring integration patterns: the same client setup, the same table conventions, the same Supabase project URL sitting in the same JavaScript bundle. That collapses the attacker's cost curve. Write one script that fingerprints a Lovable-built site, extracts the Supabase URL and anon key, lists the exposed tables, and runs select=* against each — and it works against thousands of apps with barely any modification. Broken access control has sat at the top of the OWASP Top 10 for years; what's new is the industrial scale at which identical instances of it can now be manufactured and harvested.
Some practitioners push back on calling this a "breach" at all: the sites themselves shipped the key and served the data, so consuming it isn't unauthorized access — the act of publishing was the leak. Technically, they have a point about terminology. But it's pedantry that only matters for assigning blame, and it means nothing to the person whose passport number ended up in a stranger's JSON response. Nobody consented to that architecture.
The app worked perfectly. That was the problem — it worked perfectly for everyone.
The legal fallout lands where it always lands: on whoever shipped the app. Under GDPR, the app owner is the data controller — and this research came out of Germany, about a Swedish platform, involving EU citizens' identity documents. Passport numbers plus names plus nationalities is an identity-theft starter kit; 200,000 private messages is a blackmail and phishing reservoir. Whether regulators open proceedings is an open question, but if you're a founder who vibe-coded a customer database and walked away, "the AI did it" is not a defense any data protection authority will accept.

How to Audit Generated Supabase Configs Before You Ship
If you've shipped — or inherited — an AI-generated app on Supabase, here's the audit I run. It takes an afternoon. Do it before real customer data goes anywhere near the thing.
- Inventory exposed tables. Run the RLS query below in the SQL editor. Every table in the
publicschema with RLS disabled is world-readable and world-writable through the shipped anon key. - Read every policy. RLS enabled means nothing if the policy is
using (true). Generators love emitting allow-everything policies because they silence errors during development. - Replay the app as a stranger. Copy the anon key from your deployed JavaScript and hit every REST endpoint with no session. Any rows that come back are public. Was that your intention?
- Check storage buckets. A bucket marked public turns every file in it into a fetchable URL. Photo albums and ID scans have no business in one.
- Grep the client bundle for
service_role. The anon key shipping is fine; the service key shipping is a catastrophe. Your deployed API client is a credential vault — audit it.
-- Tables exposed via the API with RLS disabled (each one is public)
select schemaname, tablename
from pg_tables
where schemaname = 'public'
and rowsecurity = false;
-- The subtler failure: RLS enabled, but what do the policies allow?
select schemaname, tablename, policyname, cmd, qual
from pg_policies
where schemaname = 'public';
The second query is where it gets interesting. You'll find tables with RLS enabled but zero policies — which fails closed and usually means a feature quietly broke and someone "fixed" it by loosening something else. And you'll find policies like this one, which I've now seen in enough generated codebases to recognize on sight:
-- The policy generators emit when a query fails during development:
create policy "allow all" on messages for all using (true);
-- It silences the error and publishes the table. Reject it on sight.
-- What a real policy looks like:
create policy "users read their own messages"
on messages for select
to authenticated
using (auth.uid() = sender_id or auth.uid() = recipient_id);
The using (true) pattern deserves special attention because it's the generated-code equivalent of commenting out an authentication check to make a test pass. It exists because the generator hit a permission error, correctly diagnosed that a policy was missing, and wrote the laziest possible one. When you find it, don't just tighten the policy — ask why the table was reachable in that code path at all. And repeat the whole audit after every significant regeneration. AI builders happily rewrite your schema, and yesterday's tight policies don't survive today's "make the dashboard show all users" prompt.
Security Scanners Help, but Defaults Decide
To its credit, Lovable's security team responded to the research directly: they identify insufficient RLS as the root cause, scan every app automatically before publishing, offer a deeper SAST scan, and let users fix findings with one click, enable auto-fix, or block publishing entirely on critical results — free, for all users. That's a genuinely reasonable toolkit, and more than most app builders ship.
But notice what a pre-publish scanner implies: the generator produced the flaw first, and now a second system exists to catch it. The scanner's finding rate is a measurement of how often the default output is insecure. I've written before about how AI security scanners are calling in our technical debt — they're useful, but they treat symptoms. The durable fix is deny-by-default generation: every table created with RLS enabled, every table getting an explicit policy even if that policy is "deny all" until the user opts into more. The insecure state should be the one that requires effort. Today it's the other way around, and 24,664 apps streaming database records on page load is what that inversion costs.

The Takeaway for Anyone Shipping AI-Built Apps
AI didn't invent broken access control. IDOR and missing authorization have topped vulnerability lists since long before anyone prompted an app into existence. What AI changed is the volume and the operator: it industrialized a known failure mode and put the deploy button in the hands of people who can't tell an RLS policy from a CSS rule. The 30% figure from this research isn't a scandal about one platform. It's a preview of every ecosystem where generated code meets a public database with an opt-in security model.
So treat every AI-generated app the way you'd treat unaudited vendor code, because that's what it is. Run the queries above before launch and after every major change. If the app will hold regulated or identity data and nobody in-house can read a Postgres policy, pay someone who can — one afternoon of expert review is cheaper than explaining passport numbers to a regulator. No-code removed the syntax. It didn't remove the responsibility, and it never will.


