Is Lovable secure? What is safe by default and what you must fix
The Lovable platform and the app it builds for you are different things. What is safe by default, what a security scan misses, and what to check.
Updated
Short answer: Lovable the platform and the app it builds for you are two different things. The platform runs the editor and the hosting. Whether your app is secure depends on how its Supabase database, keys and login are set up, and that part is your job. The usual gaps are tables without Row Level Security, policies that allow everyone, secret keys in browser code and open storage buckets. All of them can be fixed without a rewrite.
The platform vs the app you generate
Lovable writes a React app and connects it to a Supabase backend: a Postgres database, login, file storage and Edge Functions. Newer projects may use Lovable Cloud, which is built on Supabase, so the same rules apply. This guide is not about a flaw in Lovable itself. It is about the defaults and gaps that show up in the apps it generates, the same way they would in an app a person wrote in a hurry.
What is safe by default
- Published apps are served over HTTPS, on a
lovable.appaddress or your own domain. - Passwords, sessions and login tokens are handled by Supabase Auth. Your app does not store passwords itself.
- The Supabase URL and public (anon or publishable) key in your code are meant to be public. They are only safe when Row Level Security is on, which is the next point.
1. The public key and Row Level Security
Your app talks to the database straight from the browser using the public key, so anyone can copy that key and send their own queries. Row Level Security (RLS) is what stops them from reading other people's data. Every table in the public schema needs RLS on and a policy that says who can see which rows. Lovable usually writes policies when it creates a table, but tables added by pasted SQL, by hand or early in a project are often left open. Our RLS guide shows how to find and fix them.
2. Policies that look fine but are not
RLS being on is not enough. Look at what the policies actually say:
using (true)lets everyone through. Withto authenticatedit lets every logged-in user read every row, and anyone can sign up.- An update policy on a
profilestable that also holds aroleoris_admincolumn lets users make themselves admin. Keep roles in a separate table that users cannot write to.
3. Secrets in the client
Anything in your React code, including anything that starts with VITE_, ends up in the browser. Stripe secret keys, OpenAI keys and the Supabase service role key must live in Edge Function secrets instead. If one was ever in the code, rotate it. See what to do about an exposed key.
4. Auth rules
- In Supabase, open Authentication → URL Configuration and make sure only your real domains are in the Redirect URLs.
- Decide whether anyone should be able to sign up, and whether emails must be confirmed first.
- Do not use
user_metadatafor permissions. Users can change their own metadata from the browser. Supabase'sapp_metadataor a roles table they cannot write to is the safe place.
5. Storage policies
Files in a public bucket can be downloaded by anyone who has the URL. Use a private bucket for anything personal, like ID scans, invoices or user uploads, and write a policy on storage.objects. A common pattern is one folder per user:
create policy "Users read own files"
on storage.objects for select
to authenticated
using (
bucket_id = 'uploads'
and (storage.foldername(name))[1] = (select auth.uid())::text
);Add matching policies for insert, update and delete if users need them.
6. Edge Functions
Edge Functions are your server code. If a function calls a paid API or uses the service role key, it should check who is calling before it does anything. JWT verification can be switched off per function. If it is off, that function is open to anyone with its URL.
What a security scan catches, and what it misses
Lovable has a built-in security scan, and Supabase has a Security Advisor under Advisors in the dashboard. Both are worth running. They are good at spotting known patterns: tables with RLS off, RLS on with no policies, views that skip RLS, and risky database function settings.
They cannot know who should see what in your app. A policy can be valid and still show one customer another customer's orders. A database advisor also cannot see your front-end code or test your Edge Functions. A clean scan means no known misconfiguration was found. It does not prove your data is private. Testing with two accounts does.
A short checklist
- RLS is on for every table in the
publicschema. - No policy uses
using (true)on private data. - Logged in as user B, you cannot see or change user A's data.
- Logged out, the app shows nothing private.
- No secret key appears in the browser's JavaScript. Any that did were rotated.
- Users cannot change their own role.
- Private files are in private buckets with storage policies.
- Redirect URLs list only your real domains.
- Edge Functions check the user before doing anything that costs money.
- The Lovable security scan and the Supabase Security Advisor show no errors.
Building with more than one tool? The vibe coding security checklist covers the same ground for Bolt, v0, Cursor and Replit.