Lovable and Supabase security: what to check before launch.
Every Lovable app with logins or data runs on Supabase: either your own Supabase project or Lovable’s built-in backend, which is built on it. Its security comes down to two things: which key your app holds, and the database rules that decide what that key can read.
The short answer.
- The public key
- Safe to have in your app. It’s meant to be public, and on its own it reads only what your database rules allow.
- The secret key
- Never in your app. It skips every database rule. If it’s in your front-end code or on GitHub, rotate it today.
- Row-level security
- The rules that decide which rows each user can read and change. Without them, the public key can read the whole table.
The best-known Lovable leak, CVE-2025-48757, came from missing database rules, not from a flaw in Supabase.
Which backend you’re on.
Lovable gives you two choices. Both run on Supabase, so the same rules protect your data either way.
Lovable’s built-in backend
On by default, and called Cloud in parts of the product. Lovable runs the database, logins and storage for you, and you manage them inside Lovable. Most new projects use it.
Your own Supabase project
Connected to Lovable, but owned and billed by you, with the full Supabase dashboard. You manage the auth settings, backups and instance size yourself.
The keys, explained.
Supabase uses two kinds of key, and it’s retiring the older names, anon and service_role, by the end of 2026.
| Looks like | Where it belongs | What it can reach | |
|---|---|---|---|
| Publishable key | sb_publishable_… | Your app: browser, mobile app, code | Only what row-level security allows |
| Secret key | sb_secret_… | Servers and edge functions only | Everything. It skips every rule |
| anon key (older) | A long key starting eyJ | Same as the publishable key | Same as the publishable key |
| service_role key (older) | A long key starting eyJ | Same as the secret key | Same as the secret key |
Supabase compares the publishable key to a key that only opens the lobby, and the secret key to the master key. Supabase also refuses secret keys sent from a browser, but anyone who copies one can still use it from a script, so a secret key in your app’s code is a leak, whatever else is in place.
How row-level security works.
Row-level security, or RLS, is a set of rules that run inside the database. Each rule works like a filter added to every query. This one lets each signed-in user read only their own orders:
-- Each user can read only their own orders create policy "Users read their own orders" on orders for select to authenticated using ( (select auth.uid()) = user_id );
In plain terms: when someone reads the orders table, only rows whose user_id matches their own account come back. Supabase checks two things before any row is returned: whether that kind of user may touch the table at all, and then which rows the rules allow. Supabase’s advice is to turn RLS on for every table your app can reach.
Common mistakes.
Five that come up again and again in AI-built apps. Each one looks fine in a demo.
Row-level security switched off
Supabase’s docs are blunt: a table without it is readable and writable by any role with access to it. With the public key in your app, that means anyone.
A rule that lets everyone through
Security is on, but the policy allows every row to every user. It passes a quick glance and protects nothing.
Rules for reading, not for changing
Users can only see their own records, but a separate rule lets them edit or delete anyone’s.
The secret key used to “fix” an error
A permission error appears, the AI swaps in the secret key, and the error goes away, because every rule is now skipped.
File storage left public
Uploaded IDs, invoices or photos sit in a public bucket, readable by anyone who has or guesses the link.
Check your app in an afternoon.
Eight checks you can do yourself. Tick them off as you go.
When scans aren’t enough.
Run both scanners; they catch the obvious gaps quickly. But Lovable’s own docs say its scans “do not replace a thorough security review”, and suggest a professional review for apps that handle sensitive data.
The reason is simple. A scanner can tell you a table has a rule. It can’t tell you whether the rule matches how your business works: whether a coach should see another coach’s clients, or a team member can delete the owner’s invoices. That takes someone reading the rules against your app.
Questions, answered.
Is the Supabase anon key safe to expose?
Yes. It’s designed to be public and sits in your app’s code by design. On its own it can only reach what your row-level security rules allow, which is why those rules matter so much. Supabase is replacing the anon key with the publishable key, which works the same way.
What is the Supabase service role key?
The older secret key. It has full access to your data and skips every row-level security rule, so it belongs only on a server or in an edge function, never in your app or your GitHub repository. Supabase is replacing it with secret keys that start with sb_secret_. If it has leaked, rotate it in your Supabase dashboard.
Is Supabase secure?
Supabase gives you the tools to secure your data, but it doesn’t decide your rules for you. Your app is as secure as its row-level security policies and how its keys are handled. The best-known Lovable leak, CVE-2025-48757, came from missing rules in generated apps, not from a flaw in Supabase.
Is Lovable secure?
Lovable runs a Quick security scan every time you publish and offers a Deep scan of all your code. Lovable’s own docs say these tools can’t guarantee complete security and suggest a professional review for apps that handle sensitive data.
What is row-level security in Supabase?
Rules that run inside the database and decide which rows each user can read or change. Think of each rule as a filter added to every query, such as “only rows where the owner is the signed-in user”. Supabase recommends turning it on for every table your app can reach.
Does Lovable Cloud use Supabase?
Yes. Lovable’s built-in backend is built on Supabase’s open-source foundation, with the same database, logins, storage and edge functions. You manage it inside Lovable instead of in a Supabase dashboard.
Should I move from Lovable Cloud to my own Supabase project for security?
Not for security alone: the same rules protect your data in both. Lovable suggests your own Supabase project when you want direct ownership, your own billing or full access to the Supabase dashboard.
What happened with the Lovable security vulnerability?
In 2025, a researcher found 303 endpoints across 170 Lovable projects without proper row-level security, which let anyone read data such as emails, phone numbers and API keys. It was disclosed in May 2025 as CVE-2025-48757, and Lovable added security scanning in response.
Want the rules checked properly? The X-ray reads every table’s rules against your app.
Read next
Guides
Is vibe coding bad?
What the research shows, the five things AI-built apps miss at launch, and a quick check for your app.
AI prototype to product
We take it the rest of the way
How we audit an AI-built app, keep what works and finish what real users depend on.