AI-Generated Code Under Fire: 45% Contain Vulnerabilities, New Gateway Offers Real-Time Security Solution

August 21, 2026
AI-Generated Code Under Fire: 45% Contain Vulnerabilities, New Gateway Offers Real-Time Security Solution
  • A security-focused analysis finds that AI-generated code frequently ships with vulnerabilities, with Veracode's Spring GenAI Code Security Update showing 45% of outputs containing a known vulnerability across Java, JavaScript, C#, and Python, while security pass rates linger around 55% for two years.

  • To address this, CAST (Code-Aware Security Transformation) proposes a security gateway that enforces policy inline as the model writes code, routing editor and IDE traffic through a local gateway to inspect both outbound tokens and inbound responses in real time.

  • CAST targets four surface areas of failure beyond the code itself: prompt injection, unsafe tool calls, data leakage on outbound paths, and actions taken without trace, with the scan focusing on the token stream rather than the finished outputs.

  • The gateway is not a replacement for traditional security measures like SAST or human review, but aims to reduce risk during the critical generation window when code is still being produced, arguing that post-generation review can be too late for certain vulnerabilities.

  • Cencurity is open source under Apache-2.0, with its code on GitHub and a Product Hunt launch, signaling a practical, auditable, in-editor security control approach for AI-assisted development.

  • Vulnerability distribution varies by weakness class, with insecure crypto and SQL injection showing high failure rates (86% and 82%), while log injection is much lower (13%), indicating training data and pedagogy shape model security behavior.

  • Key design decisions for Cencurity include: never exposing API keys outside the IDE; logging only policy violations to avoid creating new breach surfaces; enforcing security inline to prevent vulnerable code from completion; operating locally via loopback to minimize latency and exposure; and supporting multiple providers/endpoints such as OpenAI, Anthropic, and Gemini.

  • Stanford studies reveal a paradox: users with AI assistants write less secure code and grow more confident in its security, suggesting tool-assisted code can feel safer even when it's not, though skeptical prompts and rewriting can reduce vulnerabilities at the cost of scalability.

Summary based on 1 source


Get a daily email with more Tech stories

More Stories