← All news and guides
Security

Vibe Coding Security: What to Check Before You Launch an AI-Built App

AI-written code runs, but passed security tests only 56% of the time in Veracode's 2026 study. Five checks to run before launch, with real incidents and a checklist.

Mono Team ·

A laptop on a wooden desk at night with an unlocked brass padlock beside it and city lights behind.

AI coding tools write code that runs. They don't reliably write code that's safe. In Veracode's 2026 tests, models produced code that compiled almost every time, but passed security checks only 56% of the time. This guide covers the checks to run before you launch an app you built with AI, and how to run each one yourself.

None of this needs a security team. Most of the failures below are found by someone opening the browser's developer tools, or by a bot reading public code. So they can be found by you first.

Why "it works" is not the same as "it's safe"

When you test your own app, you use it the way it was meant to be used. You log in as yourself, click the buttons on screen and see your own data. An attacker skips the screen and talks to your database and APIs directly. AI tools are good at the first path and often forget the second.

The numbers say this isn't rare:

  • Veracode, July 2026. Across the models it tracks, AI-written code passed security tests 56% of the time, "virtually unchanged" from the year before, while syntax pass rates sat near 100%. The tests used raw models with no security instructions, which is how many people prompt. (Veracode)
  • Lovable apps, 2025. A researcher scanned the homepages of 1,645 apps from Lovable's public showcase. 170 of them, about 10%, let anyone read or write database tables, exposing names, emails, phone numbers, API keys, and payment and subscription records. This became CVE-2025-48757. (Matt Palmer)
  • Moltbook, January 2026. Wiz found a database key in the site's JavaScript that gave read and write access to the whole production database, because row-level security was off. It exposed 1.5 million API tokens and about 35,000 email addresses. (Wiz)
  • RedAccess, May 2026. Searching the default domains of Lovable, Base44, Replit and Netlify turned up about 380,000 publicly reachable apps. Around 5,000 held sensitive company data such as sales records, hospital schedules and internal presentations. (Axios)

Not one of these took an advanced attack. Each was a default nobody changed, or a check nobody ran.

1. Keep secrets out of the browser and out of the chat

A ring of brass and steel keys lying on a laptop keyboard under a warm desk lamp.

Here is the rule to remember: anything your app sends to the browser, anyone can read. That includes every JavaScript file, so an API key in frontend code is a public API key. The same goes for your AI tool. Whatever it can read, it can copy into a file, a commit or a log.

Leaked keys are the most common failure, and they get found fast. GitGuardian counted 28.6 million new secrets in public GitHub commits in 2025, and found that commits co-authored by Claude Code, an AI coding assistant, leaked secrets at about twice the baseline rate. It also found 24,008 secrets sitting in MCP configuration files, the files that connect AI tools to other services. (GitGuardian) In 2023, when Palo Alto Networks' Unit 42 left AWS keys in a public repository as bait, attackers picked them up within five minutes. (SecurityWeek)

Leaked keys also stay dangerous. GitGuardian found 64% of the secrets leaked in 2022 still worked four years later. Deleting the file doesn't help, because the key is still in your git history and in every copy anyone made.

What to check

  • Search what you ship. Build the app, then search the output folder for "sk-", "secret", "key" and "token". Or open your live site, press F12 and search the Sources tab. If a private key turns up, move that call to a server function.
  • Know which keys are meant to be public. Supabase and Firebase give you a public key that is designed to sit in the browser. It's safe only when row-level security or security rules are on (see check 2). The service-role or admin key must never leave the server.
  • Keep .env files out of git. Check that .env is listed in .gitignore before your first commit, not after.
  • Don't paste live keys into AI chats. Give the AI a placeholder like YOUR_API_KEY and add the real key yourself in your hosting dashboard.
  • Put a spending limit on every paid key. Where a provider offers a hard cap, set it. Where it only offers alerts, set those too, and know the difference. Google Cloud's own docs warn that an alerts-only budget "doesn't automatically cap" usage or spending. (Google Cloud)
  • If a key leaks, revoke it first. Then create a new one, update your app, and check the provider's usage logs for calls you didn't make.

2. Lock the data, not just the screen

Hiding a button isn't access control. If your app shows each user only their own orders, but the database or API will return any order to anyone who asks for it by ID, then every order is public.

This is the most common flaw on the web, not just in AI-built apps. Broken access control is number one in the OWASP Top 10 for 2025, and OWASP says 100% of the applications in its data had some form of it. (OWASP) AI tools make it more likely, because the screen they build looks right during testing. In the Lovable case above, the exposure wasn't only reading data. On one app, the researcher could create a record marked "payment_status: paid" without paying.

What to check

  • Turn on row-level security for every table. If you use Supabase, open each table's policies. A policy that lets every user see every row is the same as no policy for private data.
  • Test as two people. Make two accounts. Log in as the first, copy the ID of something it owns, then log in as the second and request that ID directly. If the data comes back, you have a hole.
  • Check on the server, every time. Each API route should check who is asking and whether they own the record, and should never trust a user ID sent from the browser.
  • Make storage private. Uploaded files such as ID documents, invoices and photos belong in private buckets, served through links that expire.
  • Protect admin pages on the server. An admin page that's simply missing from the menu can still be opened by anyone who types its address.

3. Ask your AI to attack its own code, and to prove it

The same AI that wrote the code can review it, if you ask the right way. "Is my app secure?" gets you reassurance. A review prompt with a clear format gets you findings you can check.

A prompt that works well:

  • "Review this codebase as an attacker would. For each problem you find, give me the file and line, what an attacker could do, and the exact request or steps that prove it."
  • "Only report problems you can show with a working request. Don't list general advice."
  • "Check these areas in order: secrets in client code, database access rules, API routes that skip ownership checks, file uploads, admin routes and missing rate limits."
  • "Don't change anything yet. Wait for me to approve each fix."

After each fix, run the proof again. If the attack still works, the fix didn't. Treat this as a first pass, not a full audit. The model that missed a problem while writing the code can miss it again while reviewing.

4. Treat downloaded code as instructions to your AI

Plain cardboard parcels stacked on a desk beside a laptop, one box open with packing paper inside.

When you hand your AI a template, a GitHub repository or a plugin, you're not only adding code. You're adding text the AI will read and may follow.

In March 2025, Pillar Security showed a rules file for Cursor, the kind of file that tells an AI editor how to write code, that hid instructions in invisible Unicode characters. A person reading the file saw nothing unusual. When asked to "create a simple HTML only page", the AI added a script from an attacker's site, and never mentioned it in its reply. (Pillar Security)

Packages carry a second risk. Researchers who generated 576,000 code samples with 16 models found that at least 5.2% of the packages suggested by commercial models, and 21.7% from open-source models, didn't exist. That was 205,474 unique fake package names. (Spracklen et al., USENIX Security 2025) An attacker can publish a real package under one of those names and wait for an AI to recommend it. Software supply chain failures are now third in the OWASP Top 10.

What to check

  • Read the instruction files in anything you import. Look at rules files, AGENTS.md, README files and any prompt files before your AI does. If one asks for anything unrelated to the project, delete it.
  • Look for hidden characters. Open suspicious files in an editor that shows invisible Unicode. Recent versions of VS Code highlight them, and GitHub warns about hidden or bidirectional text in a file.
  • Check every new package before you install it. Search for it on npm or PyPI. A package with no history, few downloads or a name one letter off from a popular one is a warning sign.
  • Keep production keys away from your AI agent. If an agent can run commands with your live database credentials, a hidden instruction can too.

5. Add rate limits and spending limits

Every endpoint that costs you money per call is a bill someone else can run up. That includes sending an OTP by SMS, sending email, calling an AI model and creating accounts. OWASP lists this as "unrestricted resource consumption" and its advice is direct: "Configure spending limits for all service providers/API integrations. When setting spending limits is not possible, billing alerts should be configured instead." (OWASP API Security)

What to check

  • Rate-limit login, signup, password reset and OTP routes by IP address and by account.
  • Cap AI features per user per day, so one account can't spend your monthly budget overnight.
  • Add a CAPTCHA to public forms that send SMS or email.
  • Limit upload and request sizes, so one request can't fill your storage or tie up your server.

Two problems that look fine in testing and break at launch

These aren't security holes, but they show up the same way: everything works while you're the only user.

Your app keeps asking the server for updates

AI tools often make an app check for new data on a timer, a pattern called polling. With one tester it looks smooth. With 10,000 users each checking every five seconds, your server gets 2,000 requests a second, about 173 million a day, almost all of them returning nothing new. You pay for each one.

Phones pay too. Android's developer guide warns that "a network request every 15 seconds can keep the mobile radio on continuously", and recommends push messages so an app only connects "when it knows there is data to download". (Android Developers)

The fix: use push. That means WebSockets, server-sent events, your database's realtime feature or push notifications. If you must poll, poll only while the screen is open, and wait longer between checks when nothing has changed.

Your app has three copies of the same feature

Ask an AI to change a feature and it often writes a new version beside the old one instead of editing it. Over a few rounds you get checkout, checkoutV2 and checkout-new, and the next edit goes into the wrong one. GitClear's analysis of 211 million changed lines found an eightfold rise in duplicated code blocks in 2024, and that more lines were copied and pasted than moved into reusable code. (LeadDev) GitClear sells code analytics, so weigh that, but anyone who has vibe-coded for a week will recognise the pattern.

This is a security problem too. If you patch the hole in version 3, but version 2's route is still deployed, the hole is still open.

The fix: search your project for files and routes named v2, old, new, copy or backup. Pick one version, delete the rest and check nothing still calls them. Tell your AI to edit existing code, not create new versions, and use git so you never need a copy to go back.

The pre-launch checklist

CheckHow to test itWhat a pass looks like
Secrets in the browserHow to test it: Search your build output and your live site's Sources tab for keysWhat a pass looks like: Only keys designed to be public appear
Secrets in gitHow to test it: Run a secret scanner such as Gitleaks or GitGuardian over the full historyWhat a pass looks like: No live keys, and any old ones revoked
Spending limitsHow to test it: Open the billing settings for every paid APIWhat a pass looks like: A hard cap or an alert on each one
Database accessHow to test it: Request one user's record while logged in as anotherWhat a pass looks like: Access denied
Row-level securityHow to test it: Open the policies on every tableWhat a pass looks like: On, with rules scoped to the owner
Admin routesHow to test it: Open admin addresses while logged in as a normal userWhat a pass looks like: Access denied by the server
File storageHow to test it: Open an uploaded file's link in a private windowWhat a pass looks like: Denied, or the link has expired
Rate limitsHow to test it: Send 50 login or OTP requests in a minuteWhat a pass looks like: Requests start getting blocked
Imported codeHow to test it: Read the rules and instruction files in every template and pluginWhat a pass looks like: Nothing you didn't expect
PackagesHow to test it: Look up each dependency on its registryWhat a pass looks like: Real, maintained packages
PollingHow to test it: Leave the app open and watch the Network tabWhat a pass looks like: No steady stream of requests while idle
Duplicate versionsHow to test it: Search for v2, old, copy and backup in file and route namesWhat a pass looks like: One version of each feature

If your app holds personal data

Once real people's data is involved, security stops being only good practice. Most data protection laws require it. Europe's GDPR applies to any business that offers its services to people in the EU, wherever the business is based. It requires "a level of security appropriate to the risk" (Article 32), and it requires you to report a personal data breach to the regulator within 72 hours of finding out, where feasible (Article 33). Breaking these duties can cost up to €10 million or 2% of worldwide annual turnover, whichever is higher. Many other countries have similar laws, so check the rules wherever your users live.

An open database table that anyone with a browser can read is hard to defend as appropriate security.

When to get a second pair of eyes

Run the checklist yourself first. It will catch most of what went wrong in the incidents above. Bring in an outside review before you launch if your app takes payments, stores ID documents or health data, or will be used by another company that will ask for proof of security. A review that tests the running app, not just the code, catches what a model reviewing its own work tends to miss. That's what our Tech Audit does.

FAQ

Is vibe coding safe for production apps?

It can be, but the code isn't secure by default. In Veracode's 2026 tests, AI-written code passed security checks 56% of the time. Treat the AI's output as a first draft: check secrets, database access rules, rate limits and imported code before launch.

Is it safe for my Supabase key to be in my frontend code?

The public (anon or publishable) key is designed to be in the browser, but only with row-level security turned on for every table. Without it, that key lets anyone read and write your data. The service-role key must never be in frontend code.

What should I do if I leaked an API key?

Revoke it at the provider straight away, then create a new key and update your app. Deleting the commit isn't enough, because the key stays in git history and bots scan public repositories within minutes. Check the provider's usage logs for calls you didn't make.

Can I use AI to do a security review of my app?

Yes, as a first pass. Ask it to review the code as an attacker, to prove each finding with a working request, and to wait for your approval before fixing. Re-run each proof after the fix. It's not a replacement for testing the running app.

What is prompt injection in AI coding tools?

Hidden instructions in files your AI reads, such as rules files, READMEs or package docs, that make it do something you didn't ask. Researchers have shown invisible text in a Cursor rules file making the AI add an attacker's script to a page without mentioning it.

Launching an app you built with AI? Have it checked first.