← All articlesSites and performance

Vibe coding security checklist before going live

Don't ask the AI whether its code is safe. Attack your app the way a stranger would, with ten tests that either pass or fail.

Julien Mauclair · ~11 min · intermediate
StackNext.jsSupabaseStripenpm

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

1. Direct database accessBlocker. With only the public key, no private row comes back.
2. Another account's dataBlocker. Account A gets an error on a resource owned by account B.
3. Server actions and routesBlocker. Each one checks the session and who owns the resource.
4. Secrets in the build and historyBlocker. No secret value in the bundle, the HTML or git.
5. Payment webhooksBlocker. An unsigned request is refused and changes nothing.
6. DependenciesBefore opening up. No known high-severity flaw, no invented package.
7. Exposed filesBefore opening up. .env and .git answer 404.
8. Security headersBefore opening up. HSTS, nosniff and iframe protection are present.
9. Rate limitsBefore opening up. Login eventually answers 429.
10. Skills and MCP serversAt install time. Every addition is read before it runs.

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.

rls-audit.sqlSQLCopy
-- Tables without RLS: this should return nothing
select tablename from pg_tables
where schemaname = 'public' and rowsecurity = false;
-- Policies to review, especially any where qual is true
select tablename, policyname, roles, cmd, qual
from pg_policies where schemaname = 'public';

Then run the test that matters, the one Palmer describes: call the API with no session and only the public key.

test-db-access.shBASHCopy
curl -s "https://YOUR-PROJECT.supabase.co/rest/v1/profiles?select=*&limit=1" \
-H "apikey: YOUR_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.

test-other-account.shBASHCopy
# No session: expect 401
curl -s -o /dev/null -w "%{http_code}\n" https://your-app.tld/api/invoices/ACCOUNT_B_ID
# With account A's cookie: expect 403 or 404
curl -s -o /dev/null -w "%{http_code}\n" -H "Cookie: session=ACCOUNT_A_COOKIE" \
https://your-app.tld/api/invoices/ACCOUNT_B_ID

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.

entry-points.shBASHCopy
grep -rln "use server" app src
find app src -name "route.ts" -o -name "route.js"

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.

build-leak.shBASHCopy
grep -v '^#' .env.local | grep -v '^NEXT_PUBLIC_' | cut -d= -f2- | tr -d '"' \
| awk 'length($0) >= 12' > /tmp/values.txt
grep -rlFf /tmp/values.txt .next/static
rm /tmp/values.txt

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.

test-webhook.shBASHCopy
curl -s -o /dev/null -w "%{http_code}\n" -X POST https://your-app.tld/api/webhooks/stripe \
-H "Content-Type: application/json" \
-d '{"id":"evt_test","type":"checkout.session.completed","data":{"object":{}}}'

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.

dependencies.shBASHCopy
npm audit --audit-level=high
npm audit signatures
# For each unknown package: creation date and source repo
npm view package-name time.created repository.url

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.

exposed-files.shBASHCopy
curl -s -o /dev/null -w "%{http_code}\n" https://your-app.tld/.env
curl -s -o /dev/null -w "%{http_code}\n" https://your-app.tld/.git/config

The expected result is 404. If your app answers 200 on every URL, look at the response body before concluding anything.

8. Security headers

headers.shBASHCopy
curl -sI https://your-app.tld | grep -iE "strict-transport|content-security|x-content-type|x-frame|referrer-policy"

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.

test-rate.shBASHCopy
for i in $(seq 1 30); do
curl -s -o /dev/null -w "%{http_code} " -X POST https://your-app.tld/api/login \
-H "Content-Type: application/json" -d '{"email":"test@example.com","password":"wrong"}'
done

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.

skills-audit.shBASHCopy
grep -rnE "base64|curl .*[|] *(ba)?sh|[0-9]{1,3}([.][0-9]{1,3}){3}" .claude/skills

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.

Careful

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

Sources & further reading
01OWASP Top 10:2025, A01 Broken Access Controlrisk ranking, bypass examples, prevention.↗02OWASP Top 10:2025, A03 Software Supply Chain Failuresdependency risks.↗03Matt Palmer, statement on CVE-2025-48757method, figures and timeline of the Lovable scan.↗04Escape, study methodologyfigures and stated biases.↗05Supabase, Row Level Securitypolicies, grants, views, tests.↗06Supabase, API keyspublic and secret keys, expected errors.↗07PostgreSQL, pg_tablesthe rowsecurity column.↗08PostgreSQL, pg_policiespolicy columns.↗09Next.js, data securityServer Actions, data sent to the client, auditing.↗10Next.js, environment variablesthe NEXT_PUBLIC_ prefix.↗11Vite, environment variablesthe VITE_ prefix.↗12Stripe, managing webhookssignature verification.↗13npm auditoptions and exit codes.↗14npm viewpackage metadata.↗15Gitleakssecret scanning in git, project status.↗16Spracklen et al., package hallucinationsmeasured across 16 models.↗17OWASP, HTTP headersrecommended values and cautions.↗18OpenSourceMalware, malicious ClawHub skillsthe campaign and warning signs.↗19Reddit thread on generated code debttestimonies, not established facts.↗20Reddit thread on malicious skillsreactions, not established facts.↗
In short

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 ↗
Julien MauclairJulien Mauclair is the co-founder and CTO of Klickbee, where he builds the agency’s websites, tracking and AI automations, and develops Klickbee Tracking. He also runs Stralya, which designs and runs AWS infrastructure for scale-ups. Before that, he built the entire AWS infrastructure of an e-commerce business, since sold.

Read next