7 min read
The 7 security holes in most Lovable apps
Lovable, Bolt and similar tools get you to a working app fast. They are much less careful about the parts users never see. These are the seven problems we find most often, roughly in order of how much damage they can do, with a prompt you can paste back into your AI tool to fix each one.
1. A secret key in browser code
Anything in your front-end code is downloaded by every visitor. If a Supabase service role key, a Stripe secret key or an OpenAI key is in there, anyone can copy it from the browser's developer tools.
The service role key is the worst case: it ignores row-level security, so whoever holds it can read and change every row in your database.
Prompt for your AI tool
Search the whole project for secret keys used in client-side code (Supabase service role, Stripe sk_, OpenAI, Anthropic). Move every call that needs one into a Supabase Edge Function that reads the key from a secret, and remove the keys from all client files. Then list which keys I must rotate.
2. Tables without row-level security
Your Supabase anon key is meant to be public. It is only safe when every table has row-level security (RLS) turned on with policies that limit each user to their own rows. A table with RLS off can be read by anyone who has your anon key, which is everyone.
Prompt for your AI tool
List every table in my Supabase database and whether RLS is enabled. Turn on RLS for every table and add policies so users can only select, insert, update and delete their own rows. Show me each policy before applying it.
3. Policies that allow everything
Sometimes RLS is on, but a policy says using (true) to make an error go away. That has the same effect as no RLS at all for that action.
Prompt for your AI tool
Find every RLS policy that uses true as its condition, or that doesn't check auth.uid(). For each one, explain who can access what, and rewrite it so it only allows the row owner (or an admin checked on the server).
4. Anyone can make themselves an admin
If a user's role is stored in a column they can update, or is set from the browser during sign-up, any user can promote themselves. Roles must be set and checked on the server.
Prompt for your AI tool
Check how user roles are stored and assigned. Make sure users cannot change their own role through the API or during sign-up, and that every admin-only action checks the role on the server, not just in the UI.
5. Stripe webhooks that don't verify signatures
Your webhook endpoint is a public URL. If it doesn't verify Stripe's signature, anyone can send it a fake "payment succeeded" event and get your product for free.
Prompt for your AI tool
Update my Stripe webhook handler to verify the Stripe-Signature header with the webhook signing secret, reject anything that fails, and process each event ID only once. Also make sure prices are set on the server, not sent from the browser.
6. Public storage buckets
Uploads like ID documents, invoices or private photos often land in a public bucket because that was the quickest way to show them. Anyone who guesses or finds a file URL can open it.
Prompt for your AI tool
List my Supabase storage buckets and whether each is public. Make buckets holding user files private, add storage policies so users only access their own folder, and serve files with short-lived signed URLs.
7. Missing browser protections
HTTPS with HSTS, a Content Security Policy and clickjacking protection are small headers with a big effect. Most AI-built apps ship without them.
Prompt for your AI tool
Add these headers to every response: Strict-Transport-Security, Content-Security-Policy (report-only first, allowing only the services the app uses), frame-ancestors 'self', and X-Content-Type-Options: nosniff. Show me where to set them for my hosting.
Check your own app
Vern's free check finds problems 1 and 7 from the outside in under a minute. Problems 2 to 6 need access to your database and code: a connected Vern Scan or a Vern Rescue covers them.