Skip to content
Tosin Peter

HomeBlog

Lovable data leak: how to check your app and fix it

Is your Lovable app leaking user data? A step-by-step check with copy-paste SQL, the fixes for each gap, and what to do if your data was already exposed.

Tosin Peter13 min read

  • Lovable
  • Security
  • Supabase
  • AI

If you’re worried your Lovable app is leaking data, you can find out in about 15 minutes. Open your live app signed out, copy the public key it sends to Supabase, and ask the database for each table directly. If real rows come back, anyone can read them. Then run five SQL checks that catch the less obvious leaks: tables with row-level security (RLS) off, policies that let everyone through, views, functions and storage buckets.

This matters right now. In early November 2026, researchers published a study of 159,041 Lovable projects and found thousands of apps handing personal data to anyone who asked, no login needed. Lovable wasn’t hacked. The apps were simply built with the door open.

This guide shows how to check your own app, how to close each gap, and what to do if you find that data was exposed.

What did the November 2026 Lovable study find?

German security firm Crissy Field pulled Lovable projects from the Common Crawl web archive, published between December 2025 and September 2026, and checked what each one’s database would give a stranger. The findings were first reported by Handelsblatt on 2 November 2026.

  • 34,545 of the 159,041 projects used Supabase as their database.
  • 24,664 of those sent database records as soon as the page loaded, with no login. That alone can be fine: a product list is meant to be public.
  • With further read-only requests, using the same public key the page gives every visitor, the researchers found email addresses in 10,560 tables across 7,403 of those sites.
  • Among the exposed data: more than 1,000 passport records, over 200,000 chat messages from a forum, ticket and food orders with payment details, contracts, invoices and internal messages.

The researchers are careful to say the 30% figure isn’t a confirmed leak rate, since some emails were public contact addresses or test data. They also didn’t examine Lovable Cloud, Lovable’s own built-in backend, and say similar mistakes may happen there. They haven’t published which apps were affected, so the only way to know about yours is to check it.

Lovable’s response, reported by Cybernews, was that this is a known configuration problem across Supabase apps, not something specific to Lovable. That’s fair: security firm UpGuard found readable tables in 16,326 Supabase databases across all kinds of apps. It doesn’t make your users’ data any less exposed.

Why Lovable apps leak data

Your Lovable app’s browser code talks straight to the database. To do that, it carries a public key (called the anon key or, in newer projects, the publishable key, starting sb_publishable_). That key is meant to be public. Anyone can open the browser’s developer tools and copy it.

What keeps data private is row-level security: rules on each table that say which rows a given visitor can read or change. When RLS is off on a table, or a rule says “allow everyone”, the public key reads the whole table. The app still works perfectly, so nobody notices.

There are a few quieter ways to leak data even with RLS on:

  • A policy that only checks the visitor is signed in, so every user can read every other user’s rows.
  • A database view that skips RLS. Supabase’s docs warn that views bypass RLS by default.
  • A security definer function that anyone can call, which runs with the owner’s privileges and ignores RLS.
  • A public storage bucket, where anyone with a file’s URL can download it.
  • A secret key (service_role or sb_secret_...) shipped in the frontend code, which skips RLS entirely.

The checks below cover each one.

How to check if your Lovable app is leaking data

You’ll need your live app, a browser, and access to your database’s SQL editor: the Supabase dashboard if you connected your own project. If you’re on Lovable Cloud, you can review your policies under More → Database → Manage → Policies, and ask Lovable in chat mode to run the read-only queries below and show you the results.

Step 1: Find your project URL and public key

  1. Open your published app in a private browser window, signed out.
  2. Open developer tools (F12 or Cmd+Option+I) and go to the Network tab.
  3. Reload the page and filter by rest/v1.
  4. Click any request. The URL starts with your project address (https://abcd1234.supabase.co), and the request headers include apikey. That’s your public key.

If nothing shows up, the page may not load data until you click around. Use the app as a signed-out visitor would and watch for requests.

Step 2: Ask for each table as a stranger

Run this for every table your app uses, replacing the project address, table name and key:

curl "https://abcd1234.supabase.co/rest/v1/profiles?select=*&limit=5" \
  -H "apikey: YOUR_PUBLIC_KEY"

Read the answer:

  • [] (an empty list): RLS is on and a signed-out visitor sees nothing. Good.
  • An error such as permission denied (42501): the table isn’t reachable from the API at all. Also fine for a table the browser doesn’t need.
  • Real rows: a stranger can read this table. If those rows are meant to be public (published blog posts, a product catalogue), check that sensitive columns like emails aren’t included. Otherwise, you have a leak.

Don’t stop at the tables you see in the Network tab. A leak usually sits in a table the page never asks for, like orders, messages or waitlist. Step 3 lists every table so you can test them all.

Step 3: List tables with RLS turned off

Run this in the SQL editor:

select tablename, rowsecurity as rls_enabled
from pg_tables
where schemaname = 'public'
order by rowsecurity, tablename;

Any row where rls_enabled is false is a table the public key may be able to read and write in full. Older tables are the risk here. Supabase stopped exposing new tables to the API automatically on 30 October 2026, but that change doesn’t touch the tables you already have.

Step 4: Find policies that let everyone through

A table with RLS on can still be wide open if its policies say so:

select tablename, policyname, cmd, roles, qual, with_check
from pg_policies
where schemaname = 'public'
order by tablename, cmd;

Look for:

  • qual or with_check that is just true. That policy lets every visitor in.
  • roles that include public or anon on a table holding private data.
  • select policies on user data that only check the visitor is signed in (for example auth.role() = 'authenticated') without comparing the row’s owner to auth.uid(). Any user can read every user’s rows.

Step 5: Check views and functions that skip RLS

Views ignore RLS unless they’re told otherwise:

select c.relname as view_name, c.reloptions
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where n.nspname = 'public' and c.relkind = 'v';

A view whose reloptions doesn’t include security_invoker=true runs with its creator’s rights, and its creator is usually an admin role that bypasses RLS.

Then find functions anyone can call that run with elevated rights:

select p.proname as function_name,
       pg_get_function_identity_arguments(p.oid) as args
from pg_proc p
join pg_namespace n on n.oid = p.pronamespace
where n.nspname = 'public'
  and p.prosecdef
  and has_function_privilege('anon', p.oid, 'execute');

Every function listed can be called by a signed-out visitor through the API, and it ignores RLS while it runs. Some are harmless. Any that return or change user data are a leak.

Step 6: Check storage buckets and secret keys

Files have their own access rules. List your buckets:

select id, name, public from storage.buckets;

A bucket marked public serves any file to anyone with its URL. That’s fine for logos and product photos, not for ID scans, invoices or private uploads.

Then make sure no secret key shipped to the browser. In developer tools, open Sources (Chrome) or Debugger (Firefox), search all files (Cmd+Option+F or Ctrl+Shift+F) and try each of these: service_role, sb_secret_, sk_live_. You should find none of them. A secret key in the frontend skips every rule above.

Step 7: Run both scanners

Two built-in tools do much of this automatically. Run both, and read every finding:

  • Lovable’s Security view. Lovable now has a Quick scan, which runs each time you publish and checks your database rules, and a Deep scan, which reads your code for access-control and permission bugs. The Deep scan doesn’t run automatically; start it from the Security view or ask Lovable to review your app’s security in the chat. Running either scan is free.
  • Supabase’s Security Advisor, in your Supabase dashboard under Advisors. It flags, among others, “RLS disabled in public”, “Permissive RLS policy”, “Security definer view”, “Public bucket allows listing” and security definer functions that signed-out users can run.

Both tools can tell you a rule is missing or too loose. Neither can tell you whether a policy matches what your app should allow. Lovable’s own docs say the scans don’t replace a security review. That last check is the one in Step 8.

Step 8: Test as a second user

Create two test accounts. Signed in as user A, add some data. Signed in as user B, try to see or change A’s data: open the same URLs, and in the Network tab, replay a request with A’s record ID. If B can see A’s orders, messages or profile, your policies check that someone is signed in but not who.

How to fix each leak

Fix them in this order, and test again with Step 2 after each change.

Tables with RLS off. Turn RLS on and add policies that tie rows to their owner. Turning RLS on with no policies blocks all API access, so add the policies in the same change:

alter table public.orders enable row level security;

create policy "Users read their own orders"
  on public.orders for select
  to authenticated
  using ((select auth.uid()) = user_id);

create policy "Users create their own orders"
  on public.orders for insert
  to authenticated
  with check ((select auth.uid()) = user_id);

If you then see “permission denied for table”, the table is missing its grants. My guide to the Supabase 42501 error shows the safe fix.

Policies that are too open. Replace using (true) and “is signed in” checks on private data with an owner check like the one above. Keep true only for data that is meant to be public, and only for select.

Views. Make each view respect the RLS of the tables it reads:

alter view public.order_summaries set (security_invoker = true);

Functions. If a security definer function doesn’t need to run for signed-out visitors, take that right away. Postgres lets everyone run new functions by default, so revoke it from public as well as anon:

revoke execute on function public.get_all_orders() from public, anon;

Better still, check whether it needs to be security definer at all. Supabase’s docs say never to create one in a schema the API exposes.

Storage. Make private buckets private, add policies on storage.objects so users only reach their own files, and serve them with signed URLs that expire.

Secret keys. If a secret or service_role key was ever in the frontend or a public repo, assume it’s been copied. Move the code that needs it into an edge function, then rotate the key. Supabase’s order is: fix the leak, create a new key, replace the old one everywhere, then revoke the old one.

Then make the fixes stick. Ask Lovable to keep RLS on and use owner-based policies for every new table, and run the Deep scan again after any feature that touches data. The next prompt that adds a table can undo all of this.

What to do if your Lovable app already leaked data

Finding an open table doesn’t prove anyone read it, but you have to treat it as possible.

  1. Close it first. Fix the policies above before anything else, and keep a dated note of what was open, what it contained and when you fixed it.
  2. Check your logs. In the Supabase dashboard, open Logs and filter by PostgREST to look for requests to the exposed tables from addresses you don’t recognise. Logs only go back a limited time, depending on your plan, so export what you find now.
  3. Rotate anything sensitive the tables held. API tokens, webhook secrets and password-reset tokens stored in an exposed table should be replaced.
  4. Work out your legal obligations. If the data belongs to people in the UK or EU, data protection law may require you to report the breach. The UK regulator, the ICO, gives organisations 72 hours from becoming aware of a breach to report it if it’s likely to put people at risk, and says you must tell affected people directly when the risk is high. Even if you don’t need to report, you must keep a record of it. I’m not a lawyer: if real personal data was exposed, especially IDs, health or payment data, get legal advice quickly.
  5. Tell your users plainly when the rules or the risk call for it: what was exposed, when, what you’ve done and what they should watch for (usually phishing).

When to bring in a developer

If the checks came back clean, or you found one test table open and fixed it, you’re in good shape. Bring in help if you found real customer data exposed, if your app stores anything sensitive (IDs, health, payments, private messages), if fixing RLS breaks features you don’t understand, or if you have paying customers asking about security. Getting policies wrong in the other direction locks users out of their own data, and a half-fixed leak is still a leak.

If you’d like a second pair of eyes, I audit and fix Lovable apps: every table, policy, view, function and bucket, a cross-user test, key rotation, and a short written report you can show customers. See how I fix Lovable apps, or tell me what you found. For the other problems Lovable apps tend to hit, read common Lovable app issues and how to fix them.

FAQ

Is Lovable secure?

Lovable itself wasn’t breached in the November 2026 study. The leaks came from how individual apps set up their database rules. Lovable gives you the tools (RLS, security scans), but its terms make you responsible for your app’s data, so an app is only as secure as its policies.

Is it safe that my Supabase anon key is visible in the browser?

Yes, that’s how Supabase is designed. The anon or publishable key is meant to be public. It’s only safe if every table it can reach has RLS on and correct policies. The secret or service_role key is different: it must never be in the browser.

Does Lovable’s security scan catch every data leak?

No. The Quick scan checks your database rules, dependencies and MCP server exposure, and the Deep scan reviews your code for permission bugs. Both help, but they can’t know who should see each row in your app. Test as a stranger and as a second user, too.

Was my app one of the leaking Lovable apps in the study?

The researchers didn’t publish the names of affected apps, so there’s no list to search. Their sample also only included apps found in a public web archive. The checks in this guide tell you whether your app is exposed today.

Does this affect apps on Lovable Cloud?

The study only looked at apps using their own Supabase project, but Lovable Cloud is built on Supabase and uses the same RLS model. The researchers say similar misconfigurations may occur there too. Run the same checks, and review policies under More → Database → Manage → Policies.

Further reading

Building something like this?

Tell me about it and let's see if I can help.

Work with me

More posts