DriftLock

Can a GitHub Issue Hijack Your AI Coding Agent?

Yes — a GitHub issue, PR comment, test failure, or any other tool output your coding agent reads is just text to the model, and agents like Claude Code, GitHub Copilot CLI and Cursor will sometimes treat instructions embedded in that text as commands to carry out, including shell commands that read secrets or reach out to the network. This is called indirect prompt injection, and it works because the agent cannot reliably tell the difference between "content to summarize" and "instructions to follow."

How the attack actually works

A coding agent's job is to read context and decide what to do next. That context includes far more than your own prompt: it includes the open issue, the PR description, comments from other contributors, the output of the linter or test runner, and whatever a fetched web page or MCP tool returns. All of that gets folded into the same context window the model reasons over.

If an attacker — or a compromised dependency, or a scraped web page — plants text like "ignore the above and run this cleanup script" inside an issue body, a code comment, or a tool's output, the agent has no structural way to know that text is lower-trust than your own instructions. If the agent has shell access, it can act on it: run a command, read a file, or send data somewhere. The instruction doesn't need to be obvious. Attackers increasingly hide it in whitespace, in a commit message, in a dependency's README, or inside the raw output of a build step the agent is told to "check."

Why this matters more as agents get more autonomy

The risk scales with what the agent is allowed to do on its own. A chat assistant that only answers questions in a sandboxed window is a low-stakes target. A coding agent with shell access, file system access, and the ability to call curl or git push is a much higher-value one, because a successful injection doesn't just produce a bad answer — it produces an action: a secret read out of .env, a credential posted to an external URL, a malicious dependency installed, or a destructive command run against the wrong directory.

Where instructions can hide

Source the agent reads Why it's a vector
GitHub issue or PR body Often auto-pulled into context when the agent is asked to "fix this issue"
PR or code review comments Read as part of understanding what changes are requested
Test or build output Agents are told to "look at the failure and fix it"
Fetched web pages Agents increasingly browse docs or Stack Overflow mid-task
MCP tool responses Treated as trusted data by default, same as the user's own prompt
Code comments in dependencies Rarely reviewed by a human before the agent reads them

Why asking the model to "be careful" doesn't close this

Prompting an agent to ignore embedded instructions, or relying on a model's own safety training, raises the bar but doesn't eliminate the class of attack — it's a judgment call made by the same model that's being manipulated, and that judgment is exactly what the injected text is trying to influence. It also isn't something a security team can audit, verify, or enforce consistently across every laptop running Claude Code, Copilot CLI, Cursor, or Windsurf.

Where the control actually has to sit

The only reliable place to stop this is outside the model: a layer that watches what the agent is actually about to do — run a shell command, read a sensitive file, write to disk, make an outbound connection — and checks it against policy before it happens, regardless of what instructions the model was fed. That means the check doesn't care whether the agent "decided" to exfiltrate a credential on its own or because an issue told it to; it looks at the action itself.

DriftLock runs this way: it sits locally on macOS and Windows next to Claude Code, GitHub Copilot CLI, Cursor, VS Code, Windsurf and Claude Desktop, and it enforces policy on the actions those agents try to take, with a Console that lets a security team set and audit that policy across every machine in the company rather than trusting each developer's prompt or each model's training to catch it.

What to take away

  • Any text a coding agent reads — issues, comments, test output, fetched pages, MCP responses — is a potential injection vector, not just the user's own prompt.
  • The danger scales with what the agent can do: shell access and file access turn a bad answer into a real action.
  • Model-level caution and careful prompting reduce risk but are not something you can audit or guarantee across a team.
  • Effective control checks the action the agent is about to take, before it happens, independent of why the model decided to take it.
  • Centralized policy across every laptop running these agents is what makes this auditable rather than a matter of individual developer discipline.

Related