Before going live, test your app from the outside: a curl with no session, a second account, a search for your secrets in the build. Five checks block the launch: direct database access, another account's data, server actions, secrets and webhooks. That's also where you'll find the top risk in the OWASP Top 10.
01Why test from the outside instead of rereading the code
A generated app often looks right: the button is hidden, the page redirects, the security policy exists. None of that tells you what the server answers to a handwritten request. OWASP gives this exact case: an access check placed in the front end is bypassed with a plain curl from the command line.
Two public scans show the scale of the problem, with their limits. Matt Palmer found 303 poorly protected endpoints across 170 Lovable projects, about 10.3% of the 1,645 analyzed, looking only at homepages. He also notes that the scanner added later checked whether a policy existed, not whether it was correct.
Escape analyzed more than 5,600 public apps and reports over 2,000 vulnerabilities and over 400 exposed secrets. The vendor sells this kind of scan and admits a sample heavily skewed toward Lovable. So these figures don't give a rate for all AI-written apps, and neither compares against handwritten code. They only show that these mistakes can be found from the outside, without an account.
The same point comes up on the operations side. In a Reddit thread on the operational debt of generated code, some participants argue for focusing review on the infra files. One of them describes a flawless-looking diff, with no AI involved in that case, whose container broke on the first real request: only a step that runs the artifact would have caught it. It's one testimony, but it sums up the method well: run things, don't just read them.
The basic mistakes are covered in the basic security holes in a Next.js app. This checklist adds the proof: one command and one expected result per check. It also complements the common mistakes with Claude Code, which is about how you work with the agent.
02The checklist at a glance
Run these tests on your own app or its staging environment, never on someone else's service. The commands use placeholder names: replace the domain, the table and the identifiers. Each one proves one thing only, and together they don't replace an audit.
03The five blocking checks
1. Direct database access
If your app talks to Supabase from the browser, everyone can see the public key, and that's by design: only Row Level Security decides what it can reach. Start by listing the exposed tables without RLS, then reread the existing policies. A rule open to everyone is still a rule.
Then run the test that matters, the one Palmer describes: call the API with no session and only the public key.
You should get an empty list or a permission error. Supabase separates the two: a policy that matches no rows returns an empty result, and a missing grant returns an error. If a private row comes back, don't ship. Check your views too: they bypass RLS by default until you configure them to respect it. Finally, test a write on staging: Palmer was able to insert a row marked as paid without going through Stripe.
2. Another account's data
Being logged in doesn't entitle anyone to read everything. Create two accounts, note the ID of a resource owned by account B, then request it with account A's cookie. The expected result is 403 or 404, and 401 with no cookie. Do it for reads, updates and deletes: OWASP lists APIs with no controls on POST, PUT and DELETE among the common cases.
The cookie name depends on your auth solution: copy it from the browser's dev tools. The full reasoning is in authentication in a Next.js app.
3. Server actions and routes
A hidden button protects nothing. Next.js says so plainly: an exported Server Action stays reachable through a direct POST request, and a page-level check doesn't extend to the action. This check is done by reading, but with a closed list: pull out every entry point, then tick them off one by one.
For each file, ask three questions: is the session checked inside the function, is resource ownership checked too, and are inputs validated? As soon as you hit a no, add the test from check 2 for that entry point. If your project doesn't use Next.js, the method is the same on your API routes.
4. Secrets in the build, the HTML and the history
Anything prefixed with NEXT_PUBLIC_ is written into the JavaScript sent to the browser, as is the VITE_ prefix with Vite. Don't just search for key patterns: search for your real values. These lines extract the non-public values from your .env.local and list the build files containing one of them. The output should be empty. They only print file names.
Adjust the folder to your framework, for example dist with Vite. Then look at the rendered HTML, because a server component can send every field of a record to the client: open a logged-in page, view its source and search for fields no user should see, such as a password hash or a Stripe customer ID.
That leaves the history: a secret removed from the code stays in git. Gitleaks scans it with the command gitleaks git -v. Its author says future releases will be security patches only and is shifting focus to Betterleaks, which is worth considering for a new project. If a key turns up, rotate it: removing it from the repo isn't enough. The next steps are in handling secrets properly. A Supabase secret key bypasses all of RLS, so it's the first one to look for.
5. Payment webhooks
If your webhook grants access without checking the signature, anyone can give themselves a subscription. Stripe puts it this way: without verification, an attacker could send fake events to trigger an order or grant access. Send a fake event to staging.
You should get a 4xx error, and nothing should change in the database. A 200 means the event was accepted with no proof of where it came from. Also check that paid access is read on the server, never from a field the client can write.
04The checks to pass before opening up
6. Dependencies, real and up to date
npm audit reports known flaws, and the --audit-level=high option only fails the command from that level up, which suits a CI job. The risk specific to generated code lies elsewhere: an invented package name. A study presented at USENIX Security measures at least 5.2% hallucinated packages with commercial models and 21.7% with open-source models. These figures date from 2024-2025 and vary by model. An attacker can publish a package under one of those names, hence checking the ones you don't recognize.
A package created last week with no repository deserves to be replaced or read. OWASP now ranks these software supply chain failures third and recommends removing what you don't use.
7. Exposed files
OWASP asks that metadata such as .git and backup files stay out of the web root. This test only takes a minute, and it matters most if you configured the server yourself or with your agent.
The expected result is 404. If your app answers 200 on every URL, look at the response body before concluding anything.
8. Security headers
Compare the output with OWASP's header recommendations: nosniff, a referrer policy, HSTS, and frame-ancestors or X-Frame-Options. Two cautions: an HSTS mistake can lock users out until its duration expires, and a Content Security Policy takes time to tune. This check reduces the impact of a flaw, but it doesn't make up for failing checks 1 to 5.
9. Rate limits
Without a limit, a script can try passwords or blow up your email or AI bill. OWASP and Next.js both recommend rate limiting, with Next.js focusing on expensive operations. Run this test on staging, with a test account.
You should see 429s appear before the end of the run. The threshold depends on your usage, and the setup is described in rate limiting and API protection.
10. Your agent's skills and MCP servers
This check protects your machine rather than your app, and that's where your keys live. OpenSourceMalware documented 386 malicious skills on the ClawHub registry, often presented as trading tools. Based on the binary analysis, the installed malware likely targets API keys and .env files. The story fueled a long Reddit thread where the same advice keeps coming back: review what your agent installs. The report lists warning signs such as a base64-encoded command, a raw IP address, a password-protected zip or a tool presented as mandatory.
Adjust the folder to your agent. Empty output proves nothing, since an instruction can be phrased another way: read the whole file before installing.
05Running the list on every release
A checklist you passed once goes stale with the next round of generated code. Put whatever can be automated into CI: npm audit, gitleaks, the build secret search and the database access test against staging. Write the tests from check 2 as real integration tests too, as OWASP asks for access control. Supabase also offers policy tests run with supabase test db.
Human review then focuses on what can't be automated: new entry points, migrations and infra files. If you're on your own, run the same tests before each release and stop at the first failure. For the rest of the pipeline, see make a deployment boring.
Passing these ten tests doesn't prove the app is safe. It rules out frequent, easy-to-find mistakes. If you handle health data, financial data or regulated data, have a professional audit the app before opening it.
06FAQ
Is a vibe-coded app necessarily less secure?
The scans cited here can't tell you: they cover public apps, with no handwritten comparison group. The concrete risk comes from what wasn't checked, especially when nobody on the team knows what should be checked. These tests work no matter who wrote the code.
My Supabase key is visible in the browser: is that a vulnerability?
Not if it's the public key, since Supabase says it's meant to be exposed, with RLS doing the protecting. The vulnerability starts when a table answers without a correct policy, or when the secret key ends up on the client. In that second case, rotate the key after fixing the cause.
Can I ask the AI to run these checks?
Yes for listing entry points, writing tests and spotting omissions. No for reaching the conclusion: the scanner example Palmer cites shows that a policy can exist without protecting anything. Have it write the test, run it yourself and look at the server's real response.
Do I need a penetration test before launching?
Not necessarily for a first version with no sensitive data, if these checks pass. As soon as the app handles payments directly, health data or your customers' data, plan for one: Next.js itself recommends regular penetration testing or vulnerability scanning for the most exposed parts. Do this list first, so the auditor spends their time on what it can't find.
07Sources
Pass the five blocking checks before the first real data arrives, and move whatever can be automated into your CI. If a test fails and you can't see why, that's the right moment to get the app reviewed.
Talk about your project ↗