AI Code & Security

The Data

Is AI-generated code safe to launch? The 2026 data

Often, no — not without hardening. In Veracode’s 2025 study of 100+ AI models, 45% of AI-generated code introduced a known security vulnerability (OWASP Top 10). Newer, larger models were no safer. If your app handles real users, payments or data, treat AI-built code as a draft to secure — not a finished product.

The numbers

What the research actually found

FindingFigureSource
AI-generated code that failed security tests45%Veracode 2025
Cross-site scripting (XSS) not defended against86% of relevant casesVeracode 2025
Java code with a security failure72%Veracode 2025
Lovable apps exposed by one flaw (CVE-2025-48757)170+ appsReported 2025–26
Records leaked by a single Lovable-built app18,000+ (14,928 unique emails)The Register, 2026

Sources: Veracode 2025 GenAI Code Security Report; The Register (Feb 2026). Security performance did not improve with model size or sophistication.

Why it happens

Why AI writes insecure code

AI coding tools optimise for code that runs, not code that’s safe. They’ll happily generate a working login with no real session handling, put API keys in client code, skip input validation, and leave the database wide open — because the demo still works. The Lovable incidents above came from a broken object-level authorization flaw: any user could read other people’s project data, including source code and credentials.

The gaps that get exploited

  1. Fake or missing auth — Prototype logins often don’t enforce real sessions, roles or access control.
  2. Exposed secrets — API keys and tokens sitting in client-side code or the repo.
  3. No input validation — Forms and APIs open to injection and bad data.
  4. Wide-open data — No row-level security or access rules on the database.
  5. No rate limiting — One bot can drain your AI budget or take the app down.
What to do

How to make AI-built code safe

You don’t have to throw the app away — you have to harden it before real users arrive. The fix list is the same whether you built on Lovable, Bolt, Replit, v0 or Claude:

  1. Get it audited — Scan and review for the OWASP Top 10, exposed secrets and access flaws — score what’s launch-blocking.
  2. Lock down auth & secrets — Real authentication and roles; move every key to server-side environment variables.
  3. Secure the data layer — Row-level security, validation, backups — not a demo-grade store.
  4. Add rate limiting & monitoring — Caps, alerts and graceful failures so problems surface before users do.
  5. Re-test before launch — Confirm the critical paths hold under load and attack.

Want this done for you? The $500 Prototype Audit scores your app against exactly these points, and we can fix and ship it from there. More: the 10-point readiness checklist.

FAQ

Common questions

Is code from Lovable or Bolt secure by default?

No. They build fast prototypes; security is your responsibility. Real incidents have exposed thousands of records from AI-built apps. Harden before you launch.

How do I check if my AI-built app is vulnerable?

Run a production-readiness audit covering auth, secrets, the OWASP Top 10, data access and rate limits. A $500 audit gives you a scored, prioritized report. Start here.

Can the vulnerabilities be fixed without a rebuild?

Usually yes — most AI-built apps can be hardened in place. We only recommend a rebuild when the foundation genuinely can’t be secured.

By the DappaSol team — 100+ products shipped since 2020. Figures cited from Veracode (2025) and The Register (2026). Last updated June 2026.