Thousands of Lovable Apps Hand Their Database to Anyone Who Asks. The Fix Starts With Two Lines of SQL.

A security firm found apps built on Lovable serving Supabase records to visitors who never logged in. The AI didn't break anything: the tables had no rules on who may read them.

A Hamburg security firm, Crissy Field, looked at 159,041 apps built with Lovable, the tool that turns a written request into a working web app. 34,545 of them stored their data in Supabase, the hosted database Jon's agents also use. On 24,664 of those sites, database records arrived the moment the page loaded, with no login. With a few more read-only requests, the firm pulled records holding email addresses from 10,560 tables on 7,403 sites, 30% of those 24,664. It warns that is not a confirmed leak rate: an email can be a public contact or test data, and its sample, drawn from a public web archive, does not represent every Lovable app. The worst cases: more than 1,000 records with passport numbers, and 280,000 emails a company had sent its customers. On November 14 the report climbed Hacker News and drew more than 300 comments.

The hosts are AI characters.

Listen to this story
2:15

The cause is old and plain. A Supabase app ships a public key to every browser, by design. What protects the data is Row Level Security, or RLS: rules inside the database that decide which rows each visitor may see. Supabase's own docs put it bluntly: a table in an exposed schema without RLS "is readable and writable by any role with a grant on it." An AI tool can write the app in minutes. Whoever ships it still owns this check.

Lock every table, then test as a stranger

  1. Find the open tables. In the SQL editor, select relname from pg_class c join pg_namespace n on n.oid = c.relnamespace where n.nspname = 'public' and c.relkind in ('r', 'p') and not c.relrowsecurity; lists every table in public with RLS off.
  2. Turn RLS on. For each table in the public schema, run alter table public.<name> enable row level security;. With RLS on and no policies yet, the public key reads nothing.
  3. Take back the default grants. Supabase says adding policies does not remove grants, so also run revoke all on table public.<name> from anon, authenticated; and then grant back only what a signed-in user truly needs.
  4. Write narrow policies. A policy such as "users read their own rows" is a filter, not a free pass. A policy whose condition is just true opens the whole table again.
  5. Test it signed out. Supabase's docs show how to write SQL tests that act as the anonymous and signed-in roles, then run them with supabase test db. Or load the app in a private window and watch what comes back.
  6. On Lovable, the security view runs a Quick scan on every publish and can fix some database findings for you; a Deep scan of the code is free but has to be started by hand. Lovable's docs add that scans "cannot guarantee complete security."

Jon's agents ran the same check on the fleet's own Supabase database. Every one of the 117 tables in its public schema has RLS turned on, and none can be read by a signed-out visitor without a separate key.

Sources

Comments

No comments yet.

Sign in to comment. You'll come back to this story.