Lovable and Supabase Security: What to Check Before You Launch
By Nikola, Founder at Zerox
By Nikola, founder at ZEROX. We build React and Postgres web apps for clients, with auth and billing that hold up in production. Last updated December 2026.
Most apps keep the database behind a server that decides what each user may see. Apps built with Lovable usually work differently: the browser talks straight to a Postgres database, through Lovable Cloud or your own Supabase project, using a key that is public by design.
That is a perfectly good architecture. But it moves the whole job of protecting your data into one place, the database's row-level security rules. Get them right and the app is safe. Get them wrong and any visitor who opens the browser's developer tools can read, or change, other people's data. This guide is the check we would run before launch.
Why the public key is not the problem
Every Lovable app ships a database key to the browser. In Supabase it is called the anon key, or the publishable key in newer projects. People see it in their code and panic. Do not: that key is meant to be public. It identifies your project, nothing more.
What decides access is row-level security, or RLS. With RLS on, every query is filtered through policies such as "users can read rows where user_id matches their own id". With RLS off, a table in the public schema is open to anyone holding that public key. That is the real risk.
The key that must never reach the browser is the other one: the service_role key, called the secret key in newer projects. It bypasses RLS entirely. If it is in your frontend code, treat it as leaked and rotate it today.
Check 1: RLS is on for every table
Open your database dashboard and look at each table. Every table that holds anything other than truly public content needs RLS enabled. Supabase's Security Advisor and Lovable's automatic checks both flag tables without it, so this one is easy to catch. Fix it before anything else.
Check 2: The policies actually restrict something
RLS being on is not enough if the policy says "everyone can do everything". Read each policy and ask who it lets in:
- Select policies should match rows to the logged-in user, a team they belong to, or content that is genuinely public.
- Insert, update and delete need their own policies. A common gap is a sensible select policy next to an update policy that allows any logged-in user to change any row.
- Policies that are simply true for all users are only right for public data, such as a list of published blog posts.
Check 3: Users cannot promote themselves
If roles, plans or credits live in a table users can update, a user can make themselves an admin or give themselves a paid plan with one request. Keep roles and entitlements in a table users can read but not write, or change them only from server-side code, for example from your Stripe webhook.
Check 4: Storage buckets
File storage has its own access rules. A bucket marked public serves every file to anyone with the link. Profile pictures may be fine. Invoices, ID documents and private uploads are not. Make sensitive buckets private and give them policies like your tables.
Check 5: Server functions check who is calling
Edge or server functions often hold the secret keys, which makes them powerful. Each one should verify the user's session, check that the user is allowed to do what they asked, and validate the input. A function that trusts a user id sent from the browser undoes all the work you put into RLS.
Check 6: Test it like an attacker would, on your own app
Create two test accounts. Log in as the second one and try to load the first account's records, change them and delete them, through the app and through the browser's network tab. Then log out completely and try again. If anything comes back that should not, a policy needs fixing.
Check 7: Run Lovable's checks, then read the fine print
In Lovable, open More, then Security, in the project toolbar. Automatic checks cover database access rules, MCP endpoints open without sign-in and vulnerable packages. Advanced checks read your whole codebase for problems with sign-in, permissions, private data, keys, input, actions and payments. Run both.
Lovable is upfront about the limits: the checks find common problems, but they cannot guarantee your app is secure, and for sensitive data they recommend a professional review. A scanner knows what a missing policy looks like. It does not know that your managers should see their team's data but not other teams'.
When to get a review
If your app stores personal data, health or financial information, or takes payments, have someone who works with Postgres and auth review the policies and server functions before launch. That review, and fixing what it finds, is the first step of our vibe coding rescue work. For the rest of the pre-launch list, see the Lovable production checklist.
FAQ
Is it safe that my Supabase key is visible in the browser?
The anon or publishable key, yes, as long as row-level security is on with sensible policies. The service_role or secret key, never. It bypasses all rules and belongs only in server-side code.
Does Lovable Cloud use row-level security too?
Yes. Lovable Cloud runs on Postgres, and Lovable's own security checks look for tables without row-level security and for rules that let everyone in.
What is the most common security mistake in AI-built apps?
Access rules that do not match the business. Either RLS is off on a table, or a policy is so broad it lets any logged-in user read or edit other users' rows.
Can I fix RLS policies myself in Lovable?
Often, yes. Describe the rule precisely, for example "users can only read and update rows where user_id is their own id", then test with two accounts as described above. Bring in a developer when the rules depend on teams, roles or billing, or when fixes keep breaking other features.
Want a second pair of eyes?
Send us the app. We review the database rules, storage and server functions, tell you exactly what is exposed, and fix it for a fixed price. Start at vibe coding rescue.
