---
title: "Vibe coding security: the traps that cost you dearly"
url: https://www.devjpt.com/en/blog/vibe-coding-security/
site: "Jean-Philippe Thériault"
type: post
language: en
published: 2026-11-28T21:46:00+00:00
updated: 2026-11-29T03:51:39+00:00
author: "Jean-Philippe Thériault"
description: "A secret key in the code, an open database, an AI acting on your live site: the security traps of vibe coding, explained for beginners, with the fixes."
translations:
  ca: https://www.devjpt.com/ca/blog/seguretat-vibe-coding/
  es: https://www.devjpt.com/es/blog/seguridad-vibe-coding/
  fr: https://www.devjpt.com/blog/securite-vibe-coding/
agent:
  instructions: "This site offers a search endpoint for AI agents. Results are returned in Markdown."
  endpoint: "https://www.devjpt.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://www.devjpt.com/.well-known/agent-skills/lire-devjpt/SKILL.md"
---

# Vibe coding security: the traps that cost you dearly

*Updated November 28, 2026.*

A tool that works isn’t necessarily a safe tool. AI writes code that works, but it doesn’t always think about security unless someone asks it to. Good news: the most serious traps are easy to avoid, even if you can’t code.

## The problem, in two numbers

In 2025, the security company [Veracode](https://www.veracode.com/press-release/ai-generated-code-poses-major-security-risks-in-nearly-half-of-all-development-tasks-veracode-research-reveals/) had more than a hundred AI models write code: in 45% of cases, the code contained a known security flaw. And newer models did no better. That same year, a [flaw](https://nvd.nist.gov/vuln/detail/CVE-2025-48757) in apps built with a popular vibe coding platform left the databases of more than 170 apps readable by anyone: names, emails, sometimes secret keys.

These numbers don’t say that vibe coding is dangerous. They say that security doesn’t come on its own: you have to ask for it, and check it.

## The five costly traps

> **Trap 1: the secret key pasted into the code.** An API key is like a credit card for a service. Pasted into the code or into a web page, anyone can read it and use it at your expense.  
> **Fix:** never paste a key or a password into the conversation or into the code. Ask the AI: “Where should I keep this key so it’s never visible?”

> **Trap 2: the database open to everyone.** Many tools keep their data in an online service. If it’s set up badly, that service lets anyone read or change the data.  
> **Fix:** ask outright: “Who can read this data? Who can change it? Show me how it’s protected.” And start with fake data.

> **Trap 3: the AI acting directly on the live site.** Some AI tools can change files or click for you. One mistake, and your site is down.  
> **Fix:** the AI works on a copy. You are the one who installs each version on the real site, after trying it.

> **Trap 4: unprotected forms.** A poorly protected form can let a stranger inject code into your site or your database.  
> **Fix:** put this in your project brief: “every form is protected, every piece of data entered by a visitor is checked, every text displayed is cleaned.” The AI knows how; it just needs to know it’s mandatory.

> **Trap 5: no backup.** Without a backup, the smallest mistake can erase data for good.  
> **Fix:** a backup before every installation, and the previous version always on hand. We cover this in [Versions and backups](https://www.devjpt.com/en/blog/vibe-coding-versions-backups/).

## The security review to ask the AI for

Before putting a tool into service, ask the AI to go over the whole project with these questions:

```
SECURITY REVIEW
1. Is there a key, a password or a secret visible anywhere?
2. Who can see the data? Who can change it?
3. Is every form protected against fraudulent submissions?
4. Is data entered by a visitor checked before it's used?
5. If I delete the tool, is any data left behind anywhere?
6. What happens if someone tries to use it without permission?
```

Ask for answers in plain language, with proof: “show me where that’s done.”

> **The win:** in the example project, security was part of the rules written down on day one: only authorized people see the data, every form is protected, every database request is prepared, every text displayed is cleaned, and even exports to a spreadsheet are protected against booby-trapped formulas. These rules were repeated and checked with every version. And when, one day, the AI agent wanted to click a button on the live site itself, the tool’s safeguard stopped it. I clicked it myself. That’s exactly what you want: any action on the real site always goes through a human.

These precautions match the ones that apply to any use of AI at work: see [Using AI at work safely](https://www.devjpt.com/en/blog/use-ai-at-work-safely/).

**In this guide:** [Vibe coding for beginners](https://www.devjpt.com/en/blog/vibe-coding-for-beginners/) · previous: [Testing without coding](https://www.devjpt.com/en/blog/test-ai-app-without-coding/) · next: [Getting a bug fixed](https://www.devjpt.com/en/blog/fix-bugs-with-ai/)

For WordPress, the course [WordPress Security](https://www.i-ci.ca/formation/la-securite-sur-wordpress) (in French) that I teach at the Institut des communications graphiques et de l’imprimabilité.

## Frequently asked questions

### Is AI-generated code secure?

AI-generated code isn’t always secure: a Veracode study published in 2025 found a known flaw in 45% of the cases tested. It becomes much safer when security is part of the instructions and a review is done before the tool goes into service.

### Where should you keep an API key in a vibe coding project?

In a vibe coding project, an API key must never be written in the code or in a web page. It belongs in a protected setting or a secret file, depending on the tool: ask the AI to show you the right method for your case.

### Should you let an AI change your website directly?

It’s better not to let an AI change your live website directly. The AI should work on a copy, and each version should be installed by a person, after it has been tried and backed up.
