In March 2026, Georgia Techโs Vibe Security Radar tracked 35 new CVEs directly caused by AI-generated code. Thatโs up from just 6 in January. The same month, one AI platform made headlines for a very different reason: 1.5 million API keys leaked because a founder shipped an app without a single security review.
This isnโt rare anymore. Itโs becoming a pattern. Vibe coding has made it faster than ever to build and launch software. But that speed comes with a trade-off that a lot of people are only finding out about after something breaks.
If youโre building apps with AI tools, or thinking about it, this guide walks you through what the actual risks are and what you can do about them before you hit publish.
What Is Vibe Coding?
Vibe coding means describing what you want in plain English, and letting an AI tool write the code for you. You donโt write it. You often donโt review it line by line either. You just tell the tool what you want the app to do, and it hands you working code.
This is different from traditional development, where every function gets written and checked by a person who understands what it does. With vibe coding, youโre trusting the AI to get it right.
And a lot of people are doing this. According to 2026 vibe coding data, 63% of vibe coding users are non-developers. People with no formal coding training are building real apps, some of which go live for real users.
The market reflects this shift too. Vibe coding hit an estimated $4.7 billion in 2026. Thatโs a lot of apps being built by people who may not know what a SQL injection is, let alone how to stop one.
Why Security Gets Overlooked in Vibe-Coded Apps
Most people using vibe coding tools were never trained in secure coding. They describe a feature, get code that works, and ship it. Nobody taught them what to look for before that happens.
Hereโs where security typically slips through the cracks:
- No manual review of generated code
- Trust in the toolโs output without verification
- Lack of awareness about common attack vectors
- Pressure to ship fast, especially in competitive spaces
This isnโt a guess. The data backs it up. Security vulnerabilities are up to 2.74 times more common in AI-generated code compared to human-written code. That study scanned 5,600 publicly deployed vibe-coded apps and found more than 2,000 high-impact vulnerabilities, along with 400 exposed secrets sitting out in the open. That means roughly one in three apps shipped with a serious flaw anyone could exploit.
Common Security Gaps in Vibe-Coded Applications
If you look at enough vibe-coded apps, you start seeing the same mistakes over and over. They are not random. They follow a pattern, because AI tools tend to repeat the same shortcuts when no one tells them to do otherwise.
Here are the gaps youโll run into most often:
Security Gap | What It Means | Risk Level |
Hardcoded API keys and secrets | Credentials embedded directly in source code | High |
SQL injection vulnerabilities | User input not sanitised before database queries | High |
Cross-site scripting (XSS) | Malicious scripts injected through user input | Medium-High |
Insecure authentication | Weak or missing login protections | High |
Unvetted third-party libraries | Dependencies with known flaws pulled in automatically | Medium |
Missing HTTPS enforcement | Data transmitted in plain text | High |
Open CORS policies | Too-permissive cross-origin resource sharing | Medium |
How to Secure Your Vibe-Coded Apps
These steps are practical. You can start using them today, even if you built your app in a weekend.
Use Environment Variables for Secrets
Never paste API keys, database passwords, or tokens directly into your code. Move them into environment variables or a secrets manager instead. Think of it like keeping your house keys in a lockbox instead of taped under the doormat. This one step alone prevents a huge chunk of exposure incidents. Itโs simple, but easy to skip when youโre moving fast.
Set Up Row Level Security on Your Database
If youโre using Supabase or Firebase, Row Level Security (RLS) isnโt on by default in most vibe-coded setups. Without it, any authenticated user can potentially read any row in the database, not just their own data.
This is one of the most common causes of serious data leaks in vibe-coded apps. The fix is to enable RLS in Supabase and write policies that check ownership before allowing reads or writes. When youโre prompting your AI, explicitly ask: โenable row-level security and make sure users can only access their own data.โ
Protect Your Device and Network
Security doesnโt start with your app. It starts with your own computer. Keep your OS updated, turn on a firewall, and run reliable antivirus software.
If youโre on a budget, look into budget-friendly antivirus solutions that cover the basics without costing much. This matters more than people think, especially if your machine holds production credentials. One infected laptop can undo every other step on this list.
Lock Down Your Authentication
AI tools often generate auth that checks โis this user logged inโ but not โis this user allowed to access this specific resource.โ Those are different things. In a CRUD app, every endpoint that takes a resource ID in the URL needs to verify the logged-in user actually owns that resource before returning or modifying it.
Also check:
- Are sessions expiring properly?
- Are passwords hashed with something modern (bcrypt, Argon2)?
- Are there rate limits on login attempts?
- Is there any brute-force protection?
Ask your AI tool these questions explicitly as part of the build. If you donโt, the defaults might not cover them.
Add Input Validation Everywhere
AI-generated code frequently trusts user input without checking it. This opens the door to SQL injection, XSS, and command injection. Every field that accepts user input needs to be validated on the server side, not just the frontend.
Browser validation is easy for an attacker to bypass. They can send raw API requests directly. Server-side validation is what actually matters. When prompting AI tools, ask for explicit validation on every user-facing field including type, length, and format constraints.
If your app renders any user-supplied content as HTML, sanitise it with a library like DOMPurify first.
Audit Your Dependencies
AI tools sometimes generate references to packages that donโt exist. Real attackers have started publishing packages with those hallucinated names, a practice called โslopsquatting.โ If a developer installs one of these without checking, theyโre running attacker-controlled code.
Before you ship, run a dependency audit. For Node projects, npm audit is a start. For deeper checks, tools like Snyk or Aikido scan both your direct dependencies and the transitive ones (the packages your packages depend on) against known vulnerability databases.
Treat AI-Generated Code as Untrusted
This is the mindset shift that matters most. Donโt assume the AI got the security right just because the feature works. Run every significant piece of generated code through a review, either a human one or an automated scanner.
A practical technique: after generating code, prompt the AI again with something like โnow act as a senior security engineer. review this code for injection vulnerabilities, missing auth checks, exposed secrets, and insecure defaults. list each issue and fix it.โ This catches a surprising number of problems. You can also use this in a loop (called Recursive Criticism and Improvement) to iteratively clean up the output.
Security Checklist for Vibe-Coded Apps
Before you deploy anything to production, go through this list. It wonโt catch everything, but it covers the issues that show up most often in real vibe-coded apps:
- Search the entire codebase for hardcoded secrets: API keys, passwords, tokens. Move everything to server-side environment variables.
- Check that no secrets use public environment variable prefixes (NEXT_PUBLIC_, VITE_) unless they are genuinely meant to be public.
- Verify Row Level Security is enabled on all database tables and that users can only access their own rows.
- Test each API endpoint that uses a resource ID in the URL. Log in as User A and try to request User Bโs data. If it works, the endpoint is broken.
- Confirm login endpoints have rate limiting and lockout after failed attempts.
- Review authentication flows: are sessions expiring, are passwords hashed properly, is JWTs stored in cookies (not localStorage)?
- Check that all user input is validated server-side, not just in the browser.
- Run npm audit or equivalent. Investigate anything flagged as high or critical.
- Search for CORS configuration. If you see Access-Control-Allow-Origin: * combined with Allow-Credentials: true, fix it. Allowlist specific origins.
- Check that your database is not publicly accessible from the internet. It should only be reachable from your application server.
- Run a quick AI security review prompt on each major feature: โact as a security engineer and identify vulnerabilities in this code.โ
- Run a DAST scan on the live app before launch to catch runtime issues that static analysis misses.
Best Tools for Secure Vibe Coding
One line: these tools catch what the AI missed.
Tool | What It Does | Best For |
Aikido Security | SAST, DAST, SCA, secrets detection, cloud posture, all in one dashboard | Teams wanting one tool covering everything; source code never leaves your machine |
Snyk | Dependency scanning, SAST with IDE integration, PR-level comments | Catching vulnerable packages in apps with lots of npm dependencies |
Semgrep | Lightweight, customizable static analysis, runs in CI pipelines | Teams that want fast, flexible scanning without heavy setup |
Checkmarx One | Enterprise-grade SAST with AI-native detection | Larger teams with compliance requirements |
Vibe App Scanner (VAS) | Scans live apps by URL, no code access needed, built for vibe-coded apps | Solo founders and small teams shipping with Lovable, Bolt, Cursor |
GitGuardian | Real-time secret detection in commits and repos | Stopping secret leaks before they hit the repo |
Invicti | Proof-based DAST that confirms real exploitable vulnerabilities | Testing running apps, not just static code |
GitHub CodeQL | Deep static analysis built into GitHub PRs | Teams already on GitHub who want scanning without a separate tool |
Best Practices for Creating Secure Vibe-Coded Apps
The goal isnโt to slow down your builds. Itโs to build in a way that doesnโt create cleanup work later. Here are the practices that make the biggest difference:
- Include security in your prompts from the start. Before asking the AI to build anything, describe your appโs data model, who the users are, what they should and shouldnโt be able to access, and where sensitive data lives. The AI can only protect what it knows about.
- Ask for a threat model early. Prompt: โwhat are the security risks in this architecture?โ before you start building. This surfaces problems when theyโre still easy to fix.
- Use environment variables by default. Make it a rule: never put a credential in code. Set this as an explicit instruction in your AI toolโs system prompt or rules file.
- Review before you ship, not after. Run a security review prompt on every major feature before it goes to production. It takes five minutes and itโs worth it.
- Set up automated scanning in your CI pipeline. Tools like Semgrep or GitHubโs CodeQL can run on every pull request and flag issues before they merge. Free tiers exist for most of these.
- Keep AI agents out of production. If youโre using agentic workflows, restrict them to development and staging environments only. Human sign-off should be required before anything touches production or customer data.
- Audit dependencies before launch and after major updates. Run npm audit or your language equivalent. Donโt skip this step just because the AI chose the packages.
- Donโt assume iterating makes the code safer. As mentioned earlier, more prompts can add more vulnerabilities. Treat each new iteration as a new security surface that needs checking.
- Keep your tools and dependencies updated. Outdated libraries are a common entry point. Set up Dependabot or Renovate to automate dependency update PRs.
- Know what youโre shipping. The biggest security risk in vibe coding isnโt any specific vulnerability class. Itโs deploying code you donโt understand to users who trust you with their data. The more you understand about how your app actually works, the better youโll be at catching the gaps the AI left behind.








