Nexus Void Research

AI Coding Assistant, Claude Code, Cursor, Codex, AppSec, Security

AI Coding Assistant Security: Claude Code, Cursor, Codex

The security risks of Claude Code, Cursor, Codex and Copilot: insecure code, leaked secrets, prompt injection and excessive agency, and how to control each.

AI coding assistant security covers the risks that come with letting tools like Claude Code, Cursor, Codex and GitHub Copilot write and change your code. The risks fall into three groups: the code they generate can be insecure, the way they're used can leak secrets and context, and the assistant itself can be manipulated through prompt injection in the files and tools it reads. Each group needs a different control.

Last updated 31 October 2026.

These tools are genuinely transformative for productivity, which is exactly why their security deserves attention rather than dismissal. The goal isn't to stop using Claude Code or Cursor; it's to use them with the guardrails their speed demands. In our review of 23 studies and 48,185 CVEs, roughly one in three AI-generated code samples contained a vulnerability, and an academic study of GitHub Copilot found about 40% of generated programs in security-relevant scenarios were vulnerable (Pearce et al.). Insecure output isn't a rare edge case; it's a baseline rate to plan for. For the evidence on whether assistants introduce vulnerabilities, see can AI coding assistants introduce vulnerabilities?

What are the main AI coding assistant security risks?

Risk

Example

Control

Insecure generated code

Injection-prone queries, missing authorization, weak crypto

Static analysis and review on every pull request

Hardcoded secrets

Keys written into files, configs or the frontend

Secret scanning; keep .env files out of agent reach

Risky dependencies

Outdated, malicious or hallucinated packages

Dependency scanning plus a pre-install check

Prompt injection

Hidden instructions in a repo file, issue, web page or tool

Treat external content as untrusted; require approval for risky actions

Excessive agency

Agent granted broad file, shell, cloud or API access

Least privilege, sandboxing, scoped tokens

Malicious tools and servers

A compromised MCP server or extension

Connect only reviewed servers; pin versions

These map closely to the OWASP Top 10 for LLM applications, including prompt injection, excessive agency and supply chain risks.

How does prompt injection affect coding assistants?

When an assistant reads a repository, an issue, a dependency's README or a connected tool, any hidden instruction in that content can become part of what the model acts on. Researchers have repeatedly shown indirect prompt injection steering coding agents into leaking secrets or making unintended changes, and sandbox escapes have been demonstrated against several agents, as in our coverage of AI coding agent sandbox escapes in Cursor, Codex and Gemini CLI. The more autonomy and tool access the assistant has, the more one injected instruction can do. See what is prompt injection and MCP security for the mechanics.

How do you secure Claude Code, Cursor and Codex?

The controls are similar across tools; the settings differ.

  • Claude Code: use its permission settings to require approval for shell commands and file writes outside the project, keep sensitive files out of reach, and review what MCP servers you've connected. Anthropic's Claude Code security documentation describes the permission model.

  • Cursor: keep secrets out of files the agent can index, review agent-run terminal commands, and use project rules to state security requirements (for example, "never hardcode credentials; use parameterized queries").

  • Codex: run tasks in its sandboxed environment, keep network access off unless a task needs it, and review the diff before merging.

  • All of them: don't let the same model be the only reviewer of its own code. Put an independent check on every pull request.

How do small teams manage AI coding assistant security?

Put automated controls between generation and production, because manual review can't keep up with assistant output:

  1. Scan every pull request for insecure code, secrets and vulnerable dependencies.

  2. Check packages before install, since agents hallucinate package names that attackers register (research on package hallucination; see how to detect malicious npm packages).

  3. Constrain what agents can touch: least privilege for files, shell, cloud and tokens.

  4. Fix findings as they appear instead of filing them, so a backlog never forms (how to fix security bugs in AI-generated code).

  5. Make the security check required, so nothing merges on the assistant's say-so alone.

This lines up with the "produce well-secured software" practices in the NIST Secure Software Development Framework. For a launch-ready list, use the vibe coding security checklist or the AI-generated code security checklist for startups.

How does ARGUS secure code from Claude Code, Cursor and Codex?

Claude Code, Cursor and Codex each ship some built-in review, but it's the same kind of model checking its own output, inside the editor, with nothing deciding what reaches your main branch. An independent layer turns "the assistant looked at it" into "a policy decided whether it merges."

From the assistant alone

What ARGUS adds as an independent layer

Inline hints from the model that wrote the code

An independent scan of code, dependencies, secrets and infrastructure as code across all your repositories

Findings you still read, judge and fix by hand

The smallest fix opened as a pull request, verified with a build and a re-scan

Every issue flagged equally

Ranking by reachability, EPSS and CISA KEV, so exploitable issues surface first

No enforcement

A required check on every pull request, with rules you set

ARGUS also guards the agent itself: over MCP, an agent can ask ARGUS for an allow, warn or block verdict before installing a package. The honest scope: ARGUS secures the code, dependencies and configuration your assistants produce before they ship; it isn't a runtime firewall or API gateway, container scanning covers base-image CVEs, and it works with GitHub today. See a sample ARGUS review or where it fits in an AI coding workflow.

Frequently asked questions

Should we stop using Claude Code, Cursor or Codex?

No. They deliver real productivity gains. Pair them with automatic scanning and fixing on every pull request instead of abandoning them.

Which is the biggest risk?

For most teams, the volume of unreviewed generated code, followed by leaked secrets. Prompt injection grows with how much autonomy and tool access you give agents.

Can Claude Code review its own code for security?

It can flag issues, and that's useful, but it's advisory and comes from the same kind of model that wrote the code. Keep an independent, required security check on every pull request.

Which AI code security tools work with these assistants?

See the best AI code security tools for 2026 for a comparison.

Our read

AI coding assistants move the bottleneck from writing code to reviewing it, and most teams haven't moved their security to match. Treat the assistant as a fast, capable and occasionally unsafe contributor: valuable, but subject to the same automated checks you'd want on any pull request. Give agents least privilege, scan everything they produce, and fix as you go.

Related reading: Vibe coding security · MCP security · Securing an AI-native startup built with Cursor and Claude Code · AI code security tools for small dev teams · AI agent security in 2026

DATA SOURCES

OWASP Top 10 for LLM Applications: https://genai.owasp.org/ ; Nexus Void analysis (securing AI-generated code): https://nexusvoidai.com/research-analysis/securing-ai-generated-code-evidence-review ; NIST SSDF: https://csrc.nist.gov/projects/ssdf

Liked this post? Share it: