AI coding agents can be manipulated when they treat text from a GitHub issue, pull request or review comment as an instruction instead of task data. A malicious contributor may not have permission to change a repository's protected branch, read secrets or run commands. But if an agent with those privileges reads the contributor's words and follows them, the attacker may gain indirect influence over the agent's tools.

This is indirect prompt injection: untrusted information crosses a boundary into the instructions governing an AI system. The danger is not limited to obvious requests to “ignore previous instructions”. It includes hidden HTML comments in Markdown, misleading bug-reproduction steps, altered repository guidance, forged reviewer messages and commands framed as routine diagnostics.

Security researchers documented concrete examples in 2025 and 2026. GitHub has described invisible-content attacks against coding agents; Microsoft's June 2026 research showed how a Claude Code GitHub Action could be induced to read sensitive process-environment information; and Cloud Security Alliance summarised demonstrations in which agent-generated GitHub output became an exfiltration channel. These accounts describe specific research findings, not evidence that every AI coding agent or every GitHub repository has been compromised.

This guide explains how such attacks unfold, how to recognise risky instructions and what development teams can do to prevent them. Research verified 4 November 2026.

What is prompt injection in GitHub issues and pull requests?

An issue describes a bug or requested feature. A pull request proposes code changes and gives reviewers background. When an AI coding agent is assigned to “fix issue #123” or “review this PR”, it may ingest titles, descriptions, comments, commits, changed files, linked documentation and tool responses.

Those sources are useful evidence, but they are not authoritative operating instructions. Their authors might be external contributors, compromised accounts or automated systems. An attacker can insert language that looks like guidance for the agent, asking it to take actions unrelated to the legitimate user request.

For example, a legitimate report might say “The login form crashes when a user submits an empty email.” A suspicious addition might tell the agent to disable an audit check, publish private diagnostics, or modify a workflow before fixing the form. The issue author can propose reproduction information; they cannot grant the agent new privileges.

OWASP's Secure Coding with AI Cheat Sheet identifies issue bodies, PR descriptions, review comments, error traces, dependency changelogs and repository instruction files as surfaces for agent-targeted injection. The underlying mistake is allowing lower-trust content to steer high-trust tool use.

How a GitHub prompt-injection attack unfolds

A typical attack follows five stages. Not every attempt succeeds, and successful outcomes depend on the agent's actual permissions and defences.

  1. Entry point: an attacker opens an issue or PR, edits a comment, or places text in a file the agent is likely to read.
  2. Exposure: an agent is asked to triage the issue, implement a fix or review the proposed changes, and retrieves the untrusted material.
  3. Authority confusion: the malicious passage presents itself as a required setup step, maintainer instruction, security policy or essential debugging action.
  4. Tool misuse: if the agent obeys, it might inspect unrelated files, alter security controls, write an unsafe patch, trigger a workflow or expose data through an accessible output channel.
  5. Impact or containment: the action either crosses a real security boundary or is stopped by permissions, sandbox rules, output checks or a human approval gate.

The vital distinction is between the attacker controlling content and the attacker controlling tools. Prompt injection attempts to bridge that gap. A well-designed system maintains the boundary even if the AI model interprets the text incorrectly.

Where attackers hide instructions

GitHub surfaceHow it may be abusedWhat reviewers should inspect
Issue title or bodyUrgent-looking “fix steps” or hidden Markdown contentRaw content and relevance to the reported problem
PR description and commentsFake maintainer requests or instructions presented as review feedbackComment author, permissions and requested actions
Commit messagesAgent instructions buried outside the visible PR summaryCommit history and messages read by the agent
AGENTS.md, CLAUDE.md, project rulesPersistent instructions introduced in untrusted changesDiffs and CODEOWNERS review for guidance files
Build logs and dependency messagesForged tool output masquerading as an instructionSource provenance and any new command request
Images, attachments and linked pagesInstructions embedded in media or external documentationWhether retrieved content is needed for the task

One subtle technique uses HTML comments in GitHub-flavoured Markdown. A comment can be less visible on the rendered issue page but remain present in raw text consumed by an API or agent. Invisible Unicode can create a similar difference between what a person sees and what the model receives. GitHub's agent security principles specifically describe efforts to surface or filter such invisible content.

Not every HTML comment or instruction-like line is malicious. The warning sign is a request to redirect the agent's behaviour, expand its permissions or perform an unrelated operation—especially when that request is hidden or falsely claims authority.

What researchers demonstrated in 2026

Microsoft's Claude Code GitHub Action research

On 5 June 2026, Microsoft Defender researchers described how agent processing of attacker-controlled GitHub content could lead to access to workflow secrets. In the investigated setup, command execution paths had some environment protection, but a separate file-reading tool was not constrained in the same way. The researchers demonstrated access to sensitive process-environment data.

Microsoft reported that Anthropic mitigated the issue in Claude Code version 2.1.128 by restricting access to sensitive /proc files. The lesson is broader than one product: securing shell commands does not automatically secure file-read tools, plugins or other agent capabilities. Teams should patch supported versions and verify the controls of every tool path. Read Microsoft's original research .

“Comment and Control” research

In April 2026, researchers reported prompt-injection demonstrations against several AI-assisted GitHub workflows. The Cloud Security Alliance's analysis explains that sensitive outputs could be posted back into GitHub comments, issue updates or artefacts when agents were improperly influenced.

This matters because teams sometimes assume that blocking unknown internet destinations prevents data leakage. Public or attacker-readable GitHub surfaces can themselves become an output channel. Egress controls remain valuable, but a complete defence must also govern where an agent may post, commit or upload information.

Other documented GitHub agent concerns

Orca Security's February 2026 RoguePilot research described a GitHub Copilot and Codespaces prompt-injection scenario involving repository access and token exposure. The findings were a research disclosure, not proof that all Copilot users experienced a takeover.

GitHub's own security engineering has acknowledged invisible instructions in issues and described defences such as context visibility, restricted tool permissions and network firewalls. These controls help, but protection varies with agent product, workflow design and configuration.

Why CI/CD automation raises the stakes

A developer using an agent interactively can inspect suggestions before acting. An automatically triggered GitHub Actions agent may start when an outsider opens a PR or issue, and it may run before anyone reads the content. If its environment has a writable repository token, organisation secrets, deployment keys or powerful tools, the potential impact is much larger.

GitHub's secure-use guidance cautions against running untrusted pull-request code in privileged workflows. The pull_request_target event deserves particular care because it can run with privileges associated with the base repository. It should not be combined with unsafe checkout or execution of attacker-controlled code while privileged credentials are available.

There are two separate attack classes to consider. Prompt injection manipulates the model through natural-language content; script injection occurs when untrusted fields are interpolated into executable shell commands or scripts. Both can affect AI-assisted workflows, but their technical causes and safeguards differ. GitHub's script-injection guidance recommends treating issue titles, PR bodies and related event fields as untrusted data.

How to prevent prompt injection in GitHub coding agents

1. Keep task data separate from operating instructions

Give the agent a trusted task statement from an authorised user or workflow. Label the retrieved issue and PR material as data. Tell the agent to extract requirements and evidence, not obey tool-use instructions embedded in that material.

This separation helps, but prompts alone do not enforce security. The OWASP prompt-injection guidance recommends independent tool checks, permission limits and high-risk action approval because a model may still misinterpret the trust boundary.

2. Limit who can trigger powerful workflows

Do not automatically allow every external commenter to start a privileged agent. Use appropriate GitHub permissions, trusted-actor restrictions and explicit maintainer review when a workflow would gain code-write, secret or deployment privileges.

The Codex GitHub Action security documentation notes that its default trigger policy restricts who can invoke the action and warns against expanding accepted users or bots without assessing abuse and prompt-injection risks.

3. Use least-privilege GitHub tokens and separate jobs

Give an issue-triage agent read access when reading is all it needs. Do not supply production secrets, write-enabled organisation tokens or deployment credentials to a job that processes untrusted issue or PR content. If a later stage needs to perform a privileged action, use a separate trusted job with verified input and explicit review.

A safe design is to let the first agent produce a proposed patch or structured finding, then review it before a distinct, restricted publishing or merge process. Do not assume that a successful PR review authorises a deployment.

4. Sandbox file access, command execution and networking

Use disposable workspaces, restricted filesystem mounts, network egress rules, timeouts and non-root execution. Avoid mounting cloud credential directories or giving the agent access to production databases.

Apply restrictions to every tool, not just the shell. Read tools, web browsers, MCP servers and setup scripts can have different security boundaries. GitHub's Copilot firewall documentation identifies limitations involving MCP processes and certain setup operations.

5. Protect repository guidance and workflow files

Use CODEOWNERS, branch protection and review rules for .github/workflows/, agent-instruction files, dependency manifests and deployment configuration. An external PR that changes AGENTS.md or similar files should not silently redefine what future agents are allowed to do.

Inspect raw Markdown, changed instruction files and commit history when an agent reports unexpected permission requests. Do not blindly execute “required setup commands” introduced by an unfamiliar contributor.

6. Validate every consequential tool call and output

Require human approval before deleting repositories, modifying protected branches, publishing packages, changing security policies, posting sensitive artefacts or deploying to production. Review actual arguments and destinations, not only the model's explanation of why an action is safe.

Limit which files an agent may upload and where it may comment. Secrets can escape through a PR comment or log even without an HTTP request to an attacker-controlled server. Scan diffs and artefacts for accidental credentials and unexpected file exposure before merging.

A safe, illustrative workflow for an incoming issue

Consider a repository receiving a bug report from a first-time contributor. A safer workflow proceeds as follows:

  1. Ingest as untrusted: retrieve the issue title and body as data, preserving provenance and making hidden or raw content available to reviewers.
  2. Triage with limited access: run the agent in a read-only or restricted sandbox with no production secrets and limited external tools.
  3. Generate a proposal: have the agent identify likely files, draft the changes and explain test evidence without automatically expanding its permissions.
  4. Test in isolation: run approved tests against an ephemeral copy, with appropriately controlled dependencies and network access.
  5. Review the diff: inspect any changes to workflows, instruction files, dependency definitions, security settings and unexpected outputs.
  6. Approve privileged operations separately: let an authorised maintainer decide whether to merge, publish or deploy.

This workflow does not require rejecting external contributions. It lets developers use AI assistance while keeping the authority to access secrets and alter production systems outside untrusted input.

Warning signs that a GitHub issue is trying to redirect an agent

Warning signWhy it deserves review
“The agent must follow these hidden maintainer instructions”An issue author is claiming authority they may not possess
Directions to bypass tests, logging or security scanningThe request weakens controls unrelated to the reported bug
Instructions to read credential files or environment variablesA normal bug report rarely needs secret disclosure
Requests to post logs or outputs to comments or external servicesCould turn a response channel into data exfiltration
Changes to AGENTS.md or CI workflows in a minor fixMay persistently alter future agent behaviour
Pressure to skip review because a fix is “urgent”Urgency does not grant permissions

These are indicators, not definitive proof. A real maintainer may have legitimate reasons to change a workflow, but authority must come from verified repository governance, not instructions hidden in attacker-editable text.

How teams should respond to suspected agent manipulation

If an agent has acted unexpectedly, stop the affected automation or remove its permissions, then preserve appropriate audit evidence. Review the triggering GitHub event, the original raw content, tool calls, changed files, workflow logs and any artefacts or comments the agent created.

Determine whether secrets were merely accessible or actually exposed. If credentials might have leaked, revoke or rotate them using the relevant service's incident-response process and investigate unusual repository or cloud activity. Avoid reposting the sensitive material during triage.

Patch affected agent integrations, tighten permissions, remove untrusted guidance changes and test the corrected workflow with a harmless simulated injection. For broader background on unintentional publication of internal artefacts, see FlyingEze's earlier report on AI coding agents exposing screenshots through public GitHub repositories .

Frequently asked questions

Can a GitHub issue really make an AI agent run commands?

Only if the agent reads the issue and has sufficiently permissive tools or workflow configuration. The issue text itself has no command-execution privilege; the danger arises when an agent acts on it.

Can prompt injection be hidden from a human reviewer?

Yes. Researchers and GitHub have described payloads in raw HTML comments and invisible text. Review raw inputs and avoid assuming rendered Markdown shows everything the model received.

Is GitHub Copilot or Claude Code always vulnerable?

No. Risk depends on the product version, configured tools, permissions and deployment. Security research demonstrates attack paths, not a universal compromise of every user.

Is restricting internet access enough?

No. Agents might leak information through GitHub comments, repository files or artefacts. Network restrictions should be combined with output permissions, secret isolation and review.

Should teams disable AI code review?

Not necessarily. Read-only review with limited credentials and human oversight is lower risk than an automatically triggered agent with broad write, deployment and secret access.

Conclusion: GitHub content is evidence, not authority

AI coding agents make issues and pull requests easier to process, but their ability to interpret natural language creates a new way for untrusted contributors to influence development tools. A malicious issue does not need to look like executable code: it can masquerade as documentation, review advice or a routine diagnostic instruction.

Defend the boundary between what the agent reads and what it is allowed to do. Treat issue and PR content as untrusted, constrain tools and credentials, separate privileged workflows, inspect changes and require authorisation for consequential actions. Those layered controls reduce the chance that a manipulated agent becomes a route from a public GitHub comment to sensitive systems.