VibeSecurity

AI coding risks

What is AI-Generated Code?

AI-generated code is source code written by a large language model from a prompt, rather than typed by a person. It can work correctly while still containing security flaws that nobody reviewed.

A model writes code by predicting what plausible code looks like for your request. It optimises for something that runs and matches the prompt, not for something that is safe under attack. If you ask for a profile page, you get a profile page. You were not asking for an access rule, so you may not get one.

OWASP's guidance on large language model risks lists unsafe code generation as a known problem: models can suggest insecure code or libraries that do not exist, and those suggestions cause harm when they are trusted without verification. In practice the recurring issues are missing authorisation checks, secrets placed in frontend code, database queries built from user input, overly permissive CORS and storage settings, and invented package names.

The answer is not to stop using AI tools. It is to keep the same checks you would apply to code from any contributor you have not worked with before. Tell the assistant your security requirements up front, review changes that touch authentication, payments and data access, run automated scanning on every change, and test the running app from the outside as an attacker would.

Related terms

Sources

  1. 1.OWASP GenAI: LLM09:2025 Misinformation (unsafe code generation)
  2. 2.OpenSSF: Security-Focused Guide for AI Code Assistant Instructions