How to Secure a Lovable App: Fix Supabase RLS in 7 Steps
After a study found thousands of Lovable apps leaking data without login, here is how to secure a Lovable app: run its security scans, turn on Supabase RLS, hide secret keys and re-test before publishing.
Image: TeQBlogs
To secure a Lovable app, run Lovable’s built-in security scan, then make sure Row Level Security (RLS) is switched on with proper policies for every database table that holds user data. Keep secret keys out of the browser, enforce sign-in checks on the server and re-scan before every publish.
This matters right now. A study by German security firm Crissy Field with the business daily Handelsblatt, reported in mid-November 2026, found that 24,664 of the 34,545 Supabase-backed Lovable projects it examined sent database records to visitors without any login. Exposed data reportedly included passport details, orders with addresses and more than 200,000 private chat messages.
Quick summary
| Step | What to do | Where |
|---|---|---|
| 1 | Run a Quick and a Deep security scan | Project Security view |
| 2 | Fix every Critical finding first | Security view findings |
| 3 | Check RLS policies on every table | More → Database → Manage → Policies |
| 4 | Move API keys into Secrets | Project Secrets |
| 5 | Enforce sign-in and roles on the server | Edge Functions / server code |
| 6 | Block publishing with critical issues | Workspace settings → Security |
| 7 | Re-test signed out, then re-scan | Your live app + Security view |
What went wrong with Lovable apps
Nobody had to hack Lovable or Supabase. Apps built this way talk to a Supabase database from the browser using a publishable (anon) key, and that key is public by design. What protects the data is Row Level Security: database rules that decide which rows each visitor may read or change.
Also read: How to Upgrade PostgreSQL 14 to 18 With pg_upgrade (Step by Step)

Supabase’s own documentation warns that a table in an exposed schema without RLS is readable and writable by any role that has a grant on it. When RLS is missing or a policy says “allow everyone”, anyone holding the public key can read the table. The researchers say they found such gaps; they have not named the affected apps or published the exact access method, and they could not tell whether any data was misused.
According to the report, Lovable describes this as a known, industry-wide Supabase configuration problem rather than an AI flaw, and points to its security scanning tools. The researchers noted that Lovable’s terms place security responsibility on customers.
| Figure from the study (as reported) | Number |
|---|---|
| Lovable projects found online (Dec 2025 – Sep 2026) | 159,041 |
| Projects using Supabase | 34,545 |
| Projects sending records without login | 24,664 |
| Websites with email addresses in readable tables | 7,403 |
What you need before you start
- Access to edit the Lovable project (workspace admin or owner rights for workspace settings).
- A list of the tables that store personal data: profiles, orders, messages, files, payments.
- Two test accounts, so you can check that one user cannot see the other’s data.
How to secure a Lovable app in 7 steps
Follow these steps in order. Lovable’s documentation says its scans cannot guarantee complete security, so apps handling sensitive data should also get a professional review.

Step 1: Run a Quick scan and a Deep scan
Open your project’s Security view and click Run quick scan. It checks the database, audits dependencies and checks MCP servers in seconds. Then click Run deep scan, which also reviews all your app code for access control gaps, unauthenticated endpoints, leaked secrets, payment and login issues and exposed personal data. Scans are free; you can also type “Review my app’s security” in the project chat, which uses credits.
Step 2: Fix Critical findings first
Findings are labelled Critical, Warning or Info. Start with Critical items such as tables without per-record access control or policies that let everyone through. Do not publish until these are resolved.
Step 3: Turn on RLS and write real policies
Go to More → Database → Manage → Policies. Every table with user data should have RLS enabled and a policy that limits rows to the right person. If you manage your own Supabase project, the SQL to enable RLS is:
alter table public.orders enable row level security;
Once RLS is on, Supabase blocks all access through the publishable key until you add policies. A typical “users see only their own rows” policy checks that auth.uid() matches the row’s user_id column and allows only signed-in users. Supabase also recommends indexing the columns your policies filter on, and revoking default anon and authenticated grants on older projects where they are not needed.
Step 4: Move keys and secrets out of the frontend
Anything in the browser is public. Store API keys in Lovable’s Secrets, read them only in server-side code and make third-party API calls from the server. Never put a Supabase secret (service role) key in frontend code, because it bypasses RLS.
Step 5: Enforce sign-in and roles on the server
Lovable’s guidance is clear: frontend code should never make security decisions. Check sessions, roles and permissions inside Edge Functions or server routes, validate all input on the server, and remember that server code using the service role must check permissions itself.
Step 6: Block publishing when critical issues are open
Workspace admins and owners can switch on Block publishing with critical issues under Workspace settings → Security → Privacy & security → Publishing. The Quick scan also runs automatically whenever the publish dialog opens.
Step 7: Test signed out, then re-scan
Open your live app in a private browser window without signing in and confirm no private lists, profiles or orders load. Sign in as test user A and confirm you cannot see user B’s data. For internal tools, set Project access to your workspace and require sign-in. Then run the scans again.
If the scan still shows problems
- Policy exists but data still shows: look for a policy using
trueor applying to theanonrole; tighten it to signed-in owners. - New tables keep appearing without RLS: review policies after every schema change; Supabase supports event triggers to enable RLS on new tables automatically.
- App breaks after enabling RLS: that is expected until policies exist; add a policy for each legitimate read and write.
- You think data was exposed: rotate keys, review logs, inform affected users and report cyber incidents to CERT-In as required.
Building with AI agents also brings its own risks; see our guide to AI agent security, the Cursor extension breach and Google’s latest warning on autonomous AI cyberattacks. If your app handles customer data and you need a proper build or review, a professional web development team can help harden it before launch.
Frequently asked questions
Are Lovable apps secure by default?
Not automatically. Protection depends on Row Level Security policies in the Supabase database, and the November 2026 study found thousands of apps where data loaded without login. Run Lovable’s security scans and check every table’s policies.
Is the Supabase anon key a secret?
No. The publishable (anon) key is meant to be in the browser, so security must come from RLS policies. The secret (service role) key must never be exposed because it bypasses RLS.
Does Lovable’s security scan cost money?
According to Lovable’s documentation, the Quick and Deep scans are free. Asking the AI in chat to review your app’s security uses credits.
How do I check if my Lovable app leaks data?
Run a Deep scan, check policies under More → Database → Manage → Policies, and open your live app signed out in a private window. If private data appears without login, fix RLS immediately.
Bottom line
The Lovable exposure was a configuration problem, not a break-in, and that means owners can fix it. Run both scans, switch on RLS with owner-only policies, move secrets to the server and block publishing with critical issues. If your app stores IDs, payments or private messages, get a professional security review too.
