Lovable Security: How to Test a Lovable App Before Launch
AI App BuildersHetz Team

Lovable Security: How to Test a Lovable App Before Launch

Built with Lovable? How its apps usually store data, the gaps that expose Supabase data most often, and how to test and fix them before your users arrive.

Lovable turns a description into a working web app with a database, sign-in and a user interface. That speed is the reason so many people build with it, and it is also why the security question comes up so often. Is a Lovable app secure? The platform itself is run by a professional team. The app you generate is a different matter, and its safety depends mostly on who is allowed to read and change each row of data.

This guide explains how responsibility is split when you build on Lovable, why many generated apps depend on database rules, the gaps we see most often, and how to test and fix them. If you use other builders too, read our wider guide to AI app builder security. For apps written directly in a code editor, see vibe-coded app security.

Who Is Responsible for What

Security on a hosted builder is shared. The platform protects its own infrastructure and accounts. Your app, its data and its rules are your part of the job.

Lovable is responsible forYou are responsible for
Its own service, hosting and accountsThe access rules on every table of your app
Isolation between its customers' projectsWhat each signed-in user is allowed to see and change
Patching the platformKeys and secrets that your app exposes to browsers
Tools that help you buildThe logic of payments, invites, roles and plan limits

Most incidents with generated apps are not platform breaches. They happen because the app's own rules allowed more access than intended, and nobody tested it with a second account.

Why Lovable Apps Depend on Row Level Security

Lovable apps frequently use Supabase as their backend. The browser talks to the database directly, using the public key that the app ships with. That design is quick to build and safe when the rules are correct. Supabase's row level security documentation explains that policies decide which rows each request may read or write.

The public key is public by design, so it can never be the access control. Anyone who loads the page holds it. If a table has no policies, or its policies are too broad, that key is enough to read the table. This is the pattern behind CVE-2025-48757, which describes generated apps exposing data because their policies were missing or insufficient. The fix is not to hide the key. It is to make the policies correct and to prove it.

The Gaps We See Most Often

Tables without row level security

A table created by a prompt may not have row level security enabled at all. In that case the policies you wrote are not applied, and the table is open to anyone with the public key. Check every table in your project, including the ones you no longer use.

Policies that allow too much

Some policies check that a user is signed in but not that the row belongs to them. A rule such as "any authenticated user can select from projects" lets every customer read every other customer's projects. Policies should compare the row's owner column with the current user's identifier, and they should do the same for updates and deletes.

Admin checks only in the interface

The admin screen is hidden from normal users, but the database calls behind it may not check the role. A user who calls those calls directly from the browser gets admin powers. Roles must be checked where the data is, not where the button is.

Secrets in the frontend

The publishable key is meant to be in the browser. A service role key, a payment provider's secret key or an AI provider's API key is not. Generated code sometimes puts these in frontend files to make a feature work, and anyone can copy them from the page source.

Client-side values the server trusts

Prices, discounts, plan limits and roles calculated in the browser and sent to the backend can be edited before they leave the page. If the database accepts them unchanged, users can give themselves a better plan or pay less.

No rate limits on sign-up and login

Unlimited attempts make password guessing, fake account creation and abuse of AI features cheap. If your app calls a model on each request, a flood of requests becomes a bill.

What to Check and Where

CheckWhy it mattersPriority
Row level security enabled on every tableWithout it, policies do nothingCritical
Policies compare the row owner with the current userStops customers reading each other's dataCritical
No secret keys in the frontend bundleSecret keys grant full accessCritical
Roles and plan limits enforced on the serverPrevents self-upgrades and privilege escalationHigh
Private storage buckets with signed linksKeeps uploaded files away from outsidersHigh
Rate limits on auth and costly endpointsLimits abuse and runaway AI costsMedium

How to Test Your Lovable App Yourself

You can find the most obvious problems in an afternoon:

  1. Open the app as a stranger. Log out, open the browser's developer tools and watch the network tab while you use each page. Write down every call to the database or API.
  2. Search for secrets. Search the page source and the loaded scripts for "service_role", "secret" and the key prefixes of your payment and AI providers.
  3. Use two accounts. Sign in as user A and note a request that returns A's data. Replay it as user B, changing the identifier to A's. Any data returned to B is a critical finding.
  4. Try the admin actions as a normal user. Call the same functions the admin screen uses. A normal account should be refused every time.
  5. Check the storage links. Open a file link from another account, then from a logged-out browser. A private file should not load.

These steps find the obvious gaps. They are slower to repeat for every table and every new feature, and they do not chain small issues together into an attack path.

Why a Penetration Test Goes Further

A penetration test signs in as your test users, maps every route and database call the app makes, and tries to cross each boundary. It also tests combinations: a hidden field in a form, an old endpoint that still works, or a webhook that trusts its input. The findings come with the exact request and response that prove each one. We compare the automated and human approaches in automated vs manual penetration testing.

Our Lovable security testing page explains what the test covers for Lovable apps. Hetz runs this kind of test against your live domain. Each proven finding comes with a fix written for your builder, and a one-click retest closes it once the fix is live.

Fixing Findings in Lovable

Lovable responds well to precise prompts. A useful one names the table, the evidence and the rule:

"The table projects can be read by any signed-in user. A request signed in as user B returned rows owned by user A. Enable row level security on projects. Allow select, update and delete only where owner_id equals the current user's id. Do not change other tables."

Ask for one fix at a time, then retest. A finding is closed when the same request no longer returns the data, not when the code looks right.

Checking Fixes Without Breaking the Rest

A fix to one policy can change what other screens show. After a policy change, check the screens that read the same table, not only the one you were fixing. A common pattern is an owner-only rule that hides rows from a team member who should still see them, because the team membership table was never part of the rule. Test the normal paths as well as the attack paths: a customer should still see their own invoices, and a team member should still see shared projects.

Keep a short written list of which roles should see which data. Once it exists, both the builder and the tester have something to check against. The list also makes the next prompt easier to write, because you can point to the exact rule that is supposed to apply.

Rules to Add to Your Project Prompts

The cheapest finding is the one that never gets written. Put these rules in your project instructions, so each new feature inherits them:

  • Every table must have row level security enabled, and policies must compare the row owner with the current user.
  • Never put secret keys in frontend code. Use a server function for anything that needs a private key.
  • Check the user's role on the server for every admin action, not only in the interface.
  • Calculate prices and plan limits on the server, and ignore any value the browser sends for them.
  • Add rate limits to sign-up, login, password reset and any endpoint that calls an AI model.

Rules do not replace testing, because the model can still miss a case. They do reduce the number of findings, and they make the remaining ones easier to fix.

Next steps

Start with the checklist above, then run a full test with two accounts before you take real users or payments. For the cost of a test, read our guide to penetration testing cost, or compare options on pricing. When you are ready, start a scan.

FAQ

Frequently asked questions

Keep reading