Supabase database
Is my Lovable app secure? How to check in 10 minutes
You cannot tell from how a Lovable app looks. It is secure if three things are true: row level security is on for every table in its Supabase database, no secret key sits in the code or git history, and a stranger who signs up cannot read other people’s data. In the PatchLabs lab study (Nov 2026) of 318 public Lovable and Supabase apps, 97 (31%) let the wrong people read personal data on our 24 Nov 2026 re-check, so ten minutes of checking is worth it.
TL;DR
- A working app tells you nothing about its database rules. The checks below test the rules, not the screens.
- Start with Lovable’s security scan and Supabase’s Security Advisor. Both are quick, and both have limits their own docs state.
- Then settle the three things only a test can show: RLS on every table, no table readable by a stranger who signs up, and no secret key in the code.
How does a Lovable app keep its data private?
Lovable’s docs describe a built-in backend, enabled by default, and the option to connect your own Supabase project. This guide is about the database rules in Supabase-style projects, which is what PatchLabs tests. In these apps the browser code reads the database directly, using a public key. Row level security (RLS) is the set of per-table rules that decides what that key can read.
Lovable’s own docs call missing RLS policies the most common way app data gets exposed. So the question is whether the rules exist and whether they work. Lovable says schema migrations are saved as files under supabase/migrations/ in your project.
What are the six checks?
The times add up to about ten minutes.
| Step | Time | What it catches |
|---|---|---|
| 1. Lovable security scan | 2 min | Database access rule issues, vulnerable npm packages, MCP servers without authentication |
| 2. Supabase Security Advisor | 1 min | Tables with RLS off, always-true policies, unsafe functions |
| 3. RLS on every table | 2 min | Tables with no row rules at all (PL-008) |
| 4. Test as a stranger | 3 min | Tables a visitor or a new sign-up can read (PL-001, PL-002) |
| 5. Keys | 1 min | A secret key in the code or history (PL-010, PL-011) |
| 6. Sign-up and admin | 1 min | Roles users can edit, admin checks only in the browser (PL-019, PL-020) |
Step 1: What does Lovable’s own scan say? (2 minutes)
Open the Security view in your project. Lovable’s docs say the Quick scan runs when you open the publish dialog and finishes in seconds. It reviews your database access rules and settings, npm dependency vulnerabilities and MCP servers exposed without authentication. The Deep scan reviews all application code and is started by you. Findings are marked Critical, Warning or Info. Fix the Critical ones first.
Lovable’s docs say the scans cannot guarantee complete security and suggest an additional professional review for sensitive data. That is why steps 2 to 6 exist.
Step 2: What does Supabase’s Security Advisor say? (1 minute)
In the Supabase dashboard, open the Security Advisor. You can also run supabase db advisors in the CLI. Supabase describes advisors as deterministic checks that ship with the platform. They flag tables without RLS and policies that are always true. Supabase’s docs add that some findings may be intentional, so read each one against what the table is for.
Step 3: Is RLS on for every table? (2 minutes)
Run this in the SQL editor to list every table in public and whether RLS is on.
-- Tables in public, with row level security on or off
select c.relname as table_name, c.relrowsecurity as rls_on
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where n.nspname = 'public' and c.relkind in ('r', 'p')
order by c.relrowsecurity, c.relname;Any false is a table with no row rules. The full guide, how to check RLS on every Supabase table, explains how to read every result.
Step 4: Can a stranger read your data? (3 minutes)
RLS being on is not enough. A policy that says using (true) turns it back into an open door. Test the tables that hold personal data (profiles, customers, orders, messages, leads) as someone with no rights.
In the app, sign up a second account and look for the first account’s data. In SQL, run each table as the anon role, then as a signed-in stranger.
begin;
set local role anon;
select count(*) as anon_rows from public.profiles; -- repeat for each table
rollback;You want 0 for personal tables. A plain select in the editor is not a test: it usually runs as the postgres role, which owns your tables, and PostgreSQL’s docs say table owners normally bypass row security. The three-identity script covers the signed-in stranger and the owner.
Step 5: Is a secret key in your code? (1 minute)
Your Supabase URL and public key can be in the frontend. The service_role (or sb_secret_) key cannot, because it ignores every policy. Search the code and the history:
grep -rnE "service_role|SERVICE_ROLE|sb_secret_" --exclude-dir=node_modules .
git log --all --oneline -S"service_role"
# Any hit in src/ or in a VITE_ variable means it ships to the browserYou can also paste code into the free key check, which runs in your browser. If a secret key reached GitHub, rotate it first. Which keys are public: is the anon key safe?
Step 6: Who can sign up, and who is an admin? (1 minute)
- Email confirmation is on, so nobody signs up with an address they don’t own (PL-018).
- No policy decides access from
user_metadata, which users can edit (PL-019). - The admin screen is backed by database rules, not only hidden in the browser (PL-020).
What does a pass look like?
Every table in public shows rls_on = true. Tables with personal data return 0 rows to anon and to a stranger, and the owner still sees their own rows. No secret key appears in the code, the bundle or the history. If something fails, fix it in a new migration and test again. Be precise when you ask Lovable, because a vague request can hide an error without closing the leak. The fix is in how to secure a Lovable app’s Supabase database.
Buying or investing in a Lovable app? What to ask the seller
A demo and a revenue screenshot say nothing about who can read the app’s data. If the database leaks, the buyer inherits the leak, the users and the duty to report it. The six checks above work as a due-diligence list, with one change: the seller runs them, because only the owner should query a live database. Don’t test someone else’s live app yourself.
What you can look at without access. The free headers check grades the live site’s HTTPS, certificate, security headers and cookies from a single page load, the same request any visitor makes. It tells you about care, not about the database.
What to ask the seller for:
- The text output of the step 3 query, so you can see every table and whether RLS is on. A table with RLS off is a question to ask, not proof of a leak, because some tables are meant to be public.
- The Supabase Security Advisor list (step 2) and Lovable’s security scan (step 1), with dates.
- Read access to the GitHub repo, including
supabase/migrations. The migrations are the database rules in writing. The live project can drift from them, so ask the seller to runsupabase db diff --remoteand show it comes back empty. - Who holds the
service_roleorsb_secret_key, and when it was last rotated (step 5). Rotate every key after the sale anyway. - How admin rights are decided (step 6). If they come from
user_metadata, any user can make themselves an admin.
Red flags in a sale: the seller won’t share the migrations; a table holding emails or payments has RLS off or a using (true) policy; a secret key appears in src/, a VITE_ variable or the git history; nobody can say when keys were last rotated.
An independent report. If the repo is public, the seller can request the PatchLabs lab check and prove the repo is theirs by committing a one-line file, patchlabs-verify.txt, to the default branch. Because the seller has to commit it, the buyer knows the report covers the repo being sold. We rebuild the database from the migrations in a lab with fake rows and test it as a logged-out visitor and as a signed-in stranger. The live app and its users’ data are never touched. Private repos aren’t supported yet. For a quick first look at a public repo, the free RLS check reads the migrations without running anything.
Questions people ask
Is Lovable safe for a production app?
Lovable generates the code, and the app’s security depends on its database rules, keys and sign-up settings. Lovable’s docs say its scans cannot guarantee complete security, so check the six items above before real users arrive.
Does Lovable’s security scan guarantee my app is secure?
No, and Lovable’s docs say so. The Quick scan runs a fixed set of checks in seconds. The Deep scan reads all application code. Neither is a substitute for testing who can read your tables as an outsider.
How do I know if my Lovable app’s database is public?
Run the anon test in step 4 on every table that holds personal data. If it returns rows, anyone with your public key can read them. About 20% of the apps in the PatchLabs study (65 of 318, re-checked 24 Nov 2026) were readable that way.
What should I check before buying a Lovable app?
Ask the seller for the RLS query output, the Security Advisor and Lovable scan results, read access to the repo’s migrations, and when the secret key was last rotated. Don’t probe the live database yourself. The list and the red flags are in the due-diligence section.
Can I check a Lovable app without sharing my code?
Yes. The SQL checks run inside your own Supabase project, and the free key check runs in your browser without uploading anything. The free RLS check reads a public GitHub repo.
Sources
- Lovable docs: Security overview (checked 28 Nov 2026)
- Lovable docs: Connect to Supabase (checked 28 Nov 2026)
- Supabase docs: database advisors (checked 28 Nov 2026)
- Supabase docs: Row Level Security (checked 28 Nov 2026)
- Supabase docs: API keys (checked 28 Nov 2026)
- PostgreSQL docs: Row Security Policies (checked 28 Nov 2026)
- Supabase CLI: supabase db diff (checked 28 Nov 2026)
Related findings
The checks behind this guide, each with example code, a self-check and the fix.
Anonymous visitor can read personal data
PL-002Any signed-in user can read every row
PL-008Row level security not enabled
PL-010Service role key in client code
PL-018Sign-ups need no email confirmation
PL-019Access decided by user_metadata, which users can edit
Free check
Check your app for this, free.
Paste your public repo. PatchLabs rebuilds your database from its migrations, tests it as a visitor, a stranger and the owner, reads the code for keys and risky patterns, and hands you the fix.
Written by Manraj Singh Dhillon. Last checked 28 Nov 2026. Code samples are synthetic and run against your own project; nothing here names a real app. Spotted a mistake? Tell us.