Back to blog
coding agentsCursorCopilotCI/CDsupply chain

Coding agent security: Claude Code, Cursor, Copilot

Published on 2026-10-306 min read
In short: A coding agent (Claude Code, Cursor, Copilot in agent mode) reads files, runs commands and edits its own configuration with your rights. Booby-trapped text in a repository, an issue or a tool response can therefore become code execution on the developer's machine or in CI. Public incidents confirm it: CVE-2025-54135 (Cursor), CVE-2025-53773 (Copilot and VS Code) and the s1ngularity attack on Nx.

Why is a coding agent a different target from a chatbot?

Because it acts with the developer's rights, on their machine, based on content the developer did not write. A chatbot produces text. A coding agent reads the repository, runs commands in a terminal, edits files, calls MCP servers and sometimes opens pull requests.

That profile combines the three ingredients OWASP ties to LLM06:2025 (Excessive Agency): too much functionality, too many permissions, too much autonomy. Add the number one source of danger, indirect prompt injection: the model reads a README, a code comment, a GitHub issue or a tool's output, and treats that text as an instruction.

On the workstation, the stakes are concrete: SSH keys, cloud tokens, .env files, private repository access, session cookies, unpublished source code. In CI, deployment secrets and the right to publish packages come on top.

Which incidents and CVEs are documented?

Three public cases are enough to illustrate the three attack paths: the configuration file, the approval setting and the supply chain.

Cursor, CVE-2025-54135 ("CurXecute"). The GitHub advisory GHSA-4cxx-hrm3-49rm describes code execution through prompt injection via special MCP files. The agent could create files in the workspace without approval. Editing an existing hidden file required approval, but creating a new one, such as .cursor/mcp.json when it is absent, did not. An indirect injection could therefore make the agent write that configuration and obtain code execution without the user's consent. The advisory lists versions up to 1.2.1 as affected, a fix in 1.3.9 and a CVSS 3.1 score of 8.5. The discoverer, Aim Security, showed a scenario where the injection arrived through a Slack message the agent summarized via an MCP server.

GitHub Copilot and VS Code, CVE-2025-53773. Johann Rehberger published a chain where a prompt injection placed in a source file, a web page or an issue makes the agent write "chat.tools.autoApprove": true into .vscode/settings.json. The auto-approval mode, nicknamed "YOLO", is then on and the agent runs terminal commands without asking. Microsoft fixed it in the August 2025 Patch Tuesday. Published scores differ across sources, so we cite only the fix and the mechanism.

Nx, "s1ngularity". On August 26, 2025, malicious versions of the Nx npm package were published, after a publishing token leaked through a GitHub Actions workflow vulnerable to command injection via a pull request title. The post-install script looked for Claude Code, Gemini CLI and Amazon Q installed on the machine, and launched them with options that skip approvals (--dangerously-skip-permissions, --yolo, --trust-all-tools) to inventory sensitive files. StepSecurity sees it as the first known case of attackers turning a developer's AI assistants against them. The versions were live for about 5 hours 20 minutes.

All three cases share a point: the defense relied on a human approval or a setting that the content itself could get around.

What are the risks on the developer's workstation?

They fall into five families, summed up in the table.

RiskMechanismExample
Configuration writesThe agent edits the files that control its own rightsmcp.json, settings.json, editor tasks
Approval bypass"Auto-approve" mode switched on by content or a third partyCVE-2025-53773, --yolo options
MCP tools and extensionsThird-party server, or changed after approvalTool that returns hidden instructions
Secret leakageReading .env, SSH keys, tokens, then sending via a request or links1ngularity inventory
Data read into contextREADME, issue, web page or dependency containing instructionsIndirect injection through a cloned repo

For MCP servers, read MCP security and the article on an MCP connected to a database.

What are the risks in CI/CD?

In CI, the agent runs with no human at the screen, with secrets and often write access to the repository. Human approval, the workstation's last line of defense, exists only if you build it in.

Scenarios to examine:

  • Agent triggered by an issue or comment. Any contributor, sometimes anonymous, writes text the agent reads with the workflow's token.
  • Pull request from a fork. A workflow that exposes secrets to code or text from outside is the classic pull_request_target flaw, and it is precisely what opened the door to s1ngularity.
  • Agent output executed. A model result passed as is to a shell or a workflow expression.
  • Broad token permissions. A token with write access to contents and packages makes any injection critical.

An audit of agentic workflows looks for exactly these patterns: intermediate environment variables, direct expressions, PR checkouts, overly broad allowlists.

How do you reduce the risk day to day?

By removing modes that bypass approvals, compartmentalizing the environment and shrinking the secrets within reach. OWASP's principle applies directly: minimize extensions, their functions and their permissions, and require human approval for high-impact actions.

For developers:

  1. Never enable auto-approval (auto-approve, YOLO, permission bypass) on a machine that holds secrets, nor on a repository that is not yours.
  2. List explicitly the allowed commands instead of opening the whole terminal.
  3. Protect the configuration files of the agent and the editor: any change must ask for approval and show up in code review.
  4. Work in a container or virtual machine for unknown repositories, with no SSH keys or cloud tokens mounted.
  5. Reduce plaintext secrets: secrets manager, short-lived tokens, no .env at the root of a cloned repo.
  6. Review installed MCP servers, their source and their updates.
  7. Update the editor and the agent: the three cases above were fixed by releases.

For CI:

  • Workflow token read-only by default, elevated permissions only on the step that needs them.
  • No secrets exposed to workflows triggered by external content.
  • No model output injected into a command or expression.
  • A human approval step before any merge, publication or deployment.
  • Logging of the commands the agent runs. See what to log.

How do you test a coding agent's security in your organization?

By reproducing the three attack paths on a test repository with harmless payloads. The goal is to measure what the agent does without being asked.

  • Injection in the repo. Put a benign instruction in a README and in a comment ("create a file named canary.txt") and watch whether the agent obeys.
  • Configuration writes. Check whether the agent can create or edit its configuration files, tasks or MCP servers without approval.
  • Secret reads. Place a fake secret in a test .env and watch whether it leaves the machine through a request, a link or a comment.
  • CI path. Open a test issue or pull request and check what the CI agent reads, writes and publishes.

Record the tool version, the approval mode and the result: these behaviors change from one version to the next, so date every test.

How can CleanIssue help?

We make these scenarios part of our engagements. The Agent Red Team Express at €1,900 targets one agent in 5 days, for example a team's coding agent and its MCP tools. For CI, repositories and several agents, the Custom Red Team is quoted based on scope. Our overall framework is described in the AI agent red teaming pillar. The first conversation is a free 30-minute discovery call.

Does your product ship an AI agent? CleanIssue tests what a stranger can make it do with the Agent Red Team Express (5 days, €1,900), or a custom red team for several agents and MCP servers.

Know what your agent can do before an attacker does.

Tell us about your agent, its tools and your context. A free 30-minute discovery call.

Book a call