What a URL security scan can't see in your app's code
Security bugs an outside scan can't find in Lovable, Bolt or Cursor apps: ownership checks, webhooks, RLS for signed-in users, and how to check them.
A URL scanner looks at your app the way a stranger on the internet would. It loads your site, reads the JavaScript it ships, checks your headers and files, and pokes at anything that answers without a login. That catches a lot of the worst mistakes in vibe-coded apps: secret keys in the browser bundle, an open .env file, a Supabase table anyone can read with the public key.
But some of the most expensive bugs never show up from the outside. They live in your server code and database policies, and they only go wrong for someone who is already signed in, or for a request that looks perfectly normal. This guide walks through the six that we see most often in apps built with Lovable, Bolt, Cursor, Replit and v0, how to check each one yourself, and a prompt you can give your AI tool to review the code.
Why an outside scan has a blind spot
An outside scan only sees responses. If your API route returns 401 Unauthorized to a stranger, the scanner marks it as protected, and that is correct as far as it goes. What it can't see is what the same route does for a signed-in user who changes one number in the request.
The same goes for your database. A scan using the public anon key can count how many rows a stranger sees in each table. It can't tell whether every signed-in user can read every other user's rows, because that depends on policies that only apply once someone logs in.
So the outside view answers "can a stranger get in?" The code answers "once someone is in, what can they reach?" You want both.
1. Logged in, but not checking whose data it is
This is the most common serious bug in AI-built apps. The route checks that a user is signed in, then trusts an ID from the request:
// GET /api/invoices?id=123
const user = await getUser(req);
if (!user) return new Response("Unauthorized", { status: 401 });
const invoice = await db.invoices.findById(params.id); // whose invoice?
return Response.json(invoice);
Any signed-in user can change id=123 to id=124 and read someone else's invoice. From the outside, the route looks fine: strangers get a 401.
How to check it: open each server route or function that takes an ID (look for params.id, req.query, body.userId, orderId, projectId). For every database read or write, ask: does the query also filter on the signed-in user, like where user_id = user.id? If the code takes the user ID from the request body instead of from the session, that is the same bug.
The fix: always derive the user from the session or token on the server, and add it to the query. With Supabase, the simplest fix is to use the user's own token for the query, so Row Level Security does the filtering for you.
2. The service role key used where the user's token should be
Supabase gives you two kinds of keys. The public anon key (or the newer publishable key) respects your Row Level Security policies. The service role key (or the newer secret key) bypasses RLS completely. AI tools often reach for the service role key in an Edge Function or API route because it makes a "permission denied" error go away.
That key may never reach the browser, so an outside scan won't flag it. But every query made with it ignores your policies, which means the code itself must check ownership on every single query. Usually it doesn't.
How to check it: search your repo for where the Supabase client is created on the server, and look at which key each one uses. For every function that uses the secret key, check whether it filters by the signed-in user's ID taken from the verified token. Our guide on Supabase Edge Functions open to anyone shows how to tell whether a function checks the caller at all.
The fix: create the client with the anon key plus the user's Authorization header for anything done on behalf of a user. Keep the secret key for admin jobs that have no user, like a nightly cleanup or a webhook handler.
3. RLS policies that are on, but wide open to signed-in users
Turning RLS on is the first step. The policy you write next is what matters. A policy like this passes every outside check:
create policy "read profiles"
on public.profiles for select
to authenticated
using (true);
A stranger with only the anon key sees zero rows, so the outside scan reports the table as protected. But any person who signs up gets a free account and can then read every profile, including emails and phone numbers. On apps with open sign-up, "authenticated" is not much better than "public".
How to check it: in the SQL editor, list your policies:
select tablename, policyname, cmd, roles, qual, with_check
from pg_policies
where schemaname = 'public'
order by tablename;
Look for qual or with_check values of true, and for policies on tables with personal data that never mention auth.uid(). Then check update policies: can a user update their own role, plan, credits or is_admin column? A policy that lets users update "their own row" lets them update every column in it unless you restrict it. Our Supabase RLS in plain English guide explains how to write these policies properly.
The fix: compare a column to auth.uid() in every policy on user data, and move columns like role and plan to a separate table that users can't write to.
4. Stripe webhooks that trust whatever arrives
If your app takes payments, the webhook is where "this user paid" gets decided. Two things go wrong in AI-written code:
- The signature isn't verified. The handler parses the JSON and marks the order as paid. Anyone who finds the URL can send a fake
checkout.session.completedevent. The fix is Stripe's own check,stripe.webhooks.constructEvent(rawBody, signature, webhookSecret), run on the raw request body before you trust anything in it. - Payment status comes from the browser. The success page calls an API route like
/api/mark-paid, or the user's row has apaidcolumn they can update themselves (see point 3). Only the verified webhook should ever set it.
An outside scan can see that a webhook URL exists. It can't see whether the handler checks the signature without sending payment events to it, and it shouldn't do that to your live app.
How to check it: open your webhook handler and search for constructEvent (or your platform's equivalent). If it isn't there, or it runs on a parsed body instead of the raw one, fix that first. Then search the code for every place that sets your paid or plan field.
5. Secrets that never reached the browser, but did reach the repo
A URL scan finds keys in your published JavaScript. It can't see keys that only live in your code: a .env file committed to GitHub, a Stripe secret key pasted into a seed script, a database password in a config file. If the repo is public, or becomes public, or a collaborator's laptop is compromised, those keys are out.
How to check it: search the repo for common key prefixes like sk_live, sk-, service_role and -----BEGIN, and check that .env is in .gitignore. Deleting a file in a new commit doesn't remove it from older commits, so a key that was ever committed should be rotated, not just deleted. Our Cursor secrets checklist covers .env, .cursorignore and git history in detail, and the same steps apply to any tool.
6. Admin checks that only exist in the interface
AI tools are good at hiding buttons. They often hide the "Admin" menu for normal users and stop there. The admin API routes behind those buttons may only check that someone is signed in, not that they are an admin. Hiding a button doesn't lock the route behind it.
How to check it: find every route or function that deletes data, changes another user's account, issues refunds or exports data. Each one should check the user's role on the server, from a table the user can't edit. A check like if (user.email === "me@example.com") in frontend code doesn't count.
A prompt to review your own code
You can ask the AI tool that built your app to review it. Be specific, or you will get a generic "looks secure" answer. Paste something like this into Cursor, Lovable, Bolt or Claude Code:
Review this codebase for security problems that only appear for signed-in users. For every server route, API handler and edge function: 1) list what it reads or writes, 2) say whether it checks that the signed-in user owns that record, using the user from the verified session, not from the request, 3) say which Supabase key it uses. Then list every RLS policy that uses
trueor doesn't referenceauth.uid(), every column a user can update on their own row, and whether the Stripe webhook verifies the signature on the raw body. Quote the file and line for each problem. Don't change any code yet.
Then check its answers yourself. AI reviews are useful but they make mistakes in both directions: they miss real issues and they report problems that aren't there. Treat each finding as something to confirm, not a verdict.
The 15-minute version
- List your server routes and functions that take an ID. Confirm each filters by the signed-in user.
- Find every place the Supabase secret or service role key is used.
- Run the
pg_policiesquery and look fortrueand missingauth.uid(). - Make sure users can't update their own role, plan or credits.
- Confirm the Stripe webhook calls
constructEventon the raw body, and nothing else sets "paid". - Search the repo for key prefixes, and rotate anything that was ever committed.
- Check that admin routes check the role on the server.
For the outside checks that come before all of this, our pre-launch security checklist has the full list.
Check both sides
Start with the outside view. Run the free Greenlight Scan on your live URL and get a traffic-light result in about a minute: it looks for secret keys in your JavaScript, weak headers and cookies, and known-vulnerable libraries. The $19 Full Scan adds the deeper checks once you verify you own the site, like exposed files, open Supabase or Firebase data (counted, never downloaded) and API routes that answer without a login, with a fix prompt for your AI tool for every finding.
If your app takes payments or stores personal data, the code-level issues above are where the real risk sits. The $79 Launch Audit connects read-only to your GitHub repo, scans it for committed secrets, and runs a deep AI review of your auth, database policies and payment logic, including unverified webhooks. A second AI double-checks every finding before you see it, and you get a prioritized fix plan and a launch verdict. It is automated, not a pentest, so it won't replace a human security review for a high-stakes app, but it catches the mistakes AI tools make most often before your users do.
The Friday leak report
One short email a week: the newest ways AI-built apps leak data, and the one-line fix for each. No spam, unsubscribe any time.