Guide

Lovable app security: what to check before you launch

Updated 31 October 2026

A Lovable app is a React front end that runs in your users' browsers, usually backed by Supabase for data, sign-in and server functions. Most security problems in Lovable apps come from three places: database tables without row-level security, secret keys in front-end code, and server functions that don't check who's calling. Here's how to check each one, what Lovable's own security scans already cover, and where LeakFix fits.

The short version

  1. Run Lovable's Quick scan (it runs when you publish) and its Deep scan (you start it).
  2. Confirm row-level security is on for every Supabase table with real data, and that no policy simply allows everything.
  3. Make sure only the anon or publishable key is in the browser — never a secret or service_role key.
  4. Check that every Edge Function doing something sensitive verifies the signed-in user.
  5. Run a free outside-in check on your published URL.

Check your published Lovable URL

Looks for secret keys in your live JavaScript and missing security headers, and probes your Supabase API when it finds an anon key. Free, about ten seconds. For apps you own.

What do Lovable's built-in security scans check?

Lovable has two automated scans, and both are free (Lovable's security docs):

You can also ask for a security review in the project chat; that uses credits like any other prompt. Lovable is upfront that its tools "cannot guarantee complete security" and recommends a professional review for apps that handle sensitive data. Run both scans before you launch — they're free, and they look at your project from the inside.

Is the Supabase key in my Lovable app a problem?

Usually not. Your app has to ship a public key so the browser can talk to Supabase — that's by design. What matters is which key it is (Supabase's API key docs):

The older anon and service_role keys both look like long strings starting with eyJ, so you can't tell them apart at a glance. Open Settings → API Keys in your Supabase dashboard, see which is which, and compare with what's in your code. Supabase refuses secret keys sent from a browser, but that doesn't stop anyone who copies the key from using it in a script.

A public key is only safe because row-level security decides what it can read and write. So the real question is RLS.

How do I check row-level security on my Supabase tables?

1. Look at Supabase's Security Advisor

In the Supabase dashboard, open Advisors → Security Advisor. The warning that matters most is rls_disabled_in_public ("Table publicly accessible"): anyone with your project URL can read that table. Also look for rls_enabled_no_policy (RLS is on but nothing is allowed, so the table looks empty to your app) and permissive_rls_policy (a policy that's always true, such as using (true)). Details are in Supabase's advisor docs.

2. Or list your tables in the SQL editor

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

Any table where rowsecurity is false and that holds real data needs fixing.

3. Turn RLS on and add a policy

alter table public.profiles enable row level security;

create policy "Users can view their own profile"
on public.profiles for select
to authenticated
using ( (select auth.uid()) = user_id );

Change profiles and user_id to your own table and column. Once RLS is on, the API returns nothing from that table until a policy allows it, so add policies in the same change or your app will suddenly look empty. The Supabase RLS guide has more policy patterns.

4. Test it the way a stranger would

Use your public key, with no login:

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

If that returns someone's data, anyone can get it. For a private table you want an empty list ([]) or a permission error.

Where should API keys go in a Lovable app?

Lovable builds your front end with Vite, so any VITE_ environment variable — and anything written straight into a component — ends up in the browser. Lovable's docs say the same: keys can't be stored safely in client-side code. Store them in Lovable's Secrets and make the call from server-side code; for a Supabase-backed app, that usually means an Edge Function. Lovable spots keys pasted into the chat and steers you toward Secrets.

If a secret key has already shipped, rotate it before anything else — see what to do about an exposed key.

What else should I check?

The launch security checklist covers the rest, and marks what can be checked automatically.

How LeakFix fits with Lovable's scans

Lovable checks your project from the inside. LeakFix checks the live app from the outside and the repository Lovable syncs to — and can open a pull request with fixes. Use both.

Lovable scansLeakFix free checkLeakFix Launch check
Runs onYour Lovable projectYour published URLThe GitHub repo Lovable syncs to
Row-level securityDatabase review (Quick scan)Warns if your Supabase API answers the public anon key (older key format)Flags a repo with no RLS migration; adds an RLS template
Secret keysCode review (Deep scan)Keys in your live JavaScriptKeys and .env files committed to the repo
DependenciesAudit (Quick scan)——
Security headers, CORSNot listed in Lovable's scan docsGrades headers and CORSFlags missing header config and open CORS
FixesThrough the chatReport onlyA pull request you review and merge
CostFree (chat reviews use credits)Free$49 one-time

Getting a LeakFix pull request into Lovable

Lovable's GitHub integration syncs both ways. Connect your project to GitHub, run the Launch check on that repository, and merge the LeakFix pull request into the branch Lovable syncs (usually main); Lovable then picks up the merged commits. The pull request only adds new files and never touches your existing code. SQL files such as the RLS template are for you to review and run in the Supabase SQL editor.

Get a fix PR for your Lovable app

One-time $49 — no subscription, no account. You get a plain-English report and a pull request you review and merge.