Prompt-Injection PR Trick Leaks Repo Secrets

Help Net Security · High sophistication
Last updated July 30, 2026

A researcher showed that AI coding agents used in GitHub workflows can be tricked by a malicious pull request description into running “safe-looking” commands and then posting the results publicly, leaking secrets. The issue isn’t just the prompt; it’s how the agent’s automation pipeline (the “harness”) approves steps and then publishes outputs across stages without re-checking trust.

How the attack worked

A researcher demonstrated that AI coding agents wired into GitHub workflows can be manipulated through a pull request description alone. The PR text looks like a routine bug report asking for a few diagnostic shell commands to be run and the output pasted back. Because the agent processes this untrusted text before any human reviews it, it extracts the embedded commands, gets them approved as "safe," executes them, and then automatically posts the results back into the public PR thread. If those results include secrets, they are exposed to anyone with visibility into the repository.

Why it succeeded

The scenarios tested against default and recommended configurations from three major agent vendors show the weakness is not the prompt injection itself, it is how the automation pipeline, or harness, handles trust across stages. One stage approves a command as safe. A later stage publishes the output by default. Neither stage re-checks the other's assumptions, so approval and publication combine into an exfiltration chain. In one case, a documented CI configuration recommended for processing untrusted input still failed because a configured restriction was not enforced at the point of execution, a finding that produced a maximum-severity advisory.

What to watch for

  • Untrusted pull request or issue text being treated as executable instructions by an automated agent
  • Command output posted automatically to a public thread or log without review for sensitive data
  • Multi-stage workflows where state written in one stage is consumed as trusted context by a later, more privileged stage
  • Reliance on "recommended" security configurations without verifying they are enforced at runtime
  • Protected path or restriction lists that assume a fixed set of risks while ignoring attacker-influenced state elsewhere

How to build resistance

Organizations using AI coding or CI agents should treat all externally supplied text, including PR descriptions, as hostile input rather than as instructions to execute. Automatic posting of command output to PR threads or logs should be disabled or tightly gated, since output may contain secrets that were never meant to be shared. Most importantly, trust should be re-validated at the point of consumption, such as execution or publishing, rather than assumed to carry over from an earlier approval decision. Teams should specifically trace every path where agent output or agent-influenced state gets picked up by a later stage with different privileges, since that handoff point is where these defenses have repeatedly failed in testing.

Key findings

  • A malicious pull request description can cause an AI agent to extract and run shell commands and then post the output back into the PR thread, exposing secrets.
  • The failures happen at handoffs across workflow stages: one stage approves a command as “safe,” another stage publishes the output by default, creating an exfiltration chain.
  • The research was tested against default/recommended configurations of three vendors’ agent tooling (Anthropic, Google, OpenAI).
  • Google’s advisory for Gemini CLI is rated CVSS 10.0 (GHSA-wpqr-6v78-jr5g), tied to restrictions not being enforced at execution time.
  • OpenAI’s Codex CLI sandbox can be bypassed in multi-stage workflows where state from one stage becomes trusted input in the next.

Who’s being targeted

  • Commonly targeted roles: Software Engineers, Repo Maintainers, DevOps/CI-CD, Platform Engineering, Security Engineering.
  • Affected industries: Software development, DevOps/CI-CD, Technology vendors, Any organization using AI coding/CI agents.
  • Attack channels: github.
  • Impersonated: External contributor (helpful bug reporter), Legitimate open-source contributor, Normal workflow step / trusted automation stage.

Red flags to watch for

  • Untrusted PR content is being treated as instructions for an automated agent
  • Outputs are automatically posted back publicly (“published”) without reviewing for secrets
  • Multi-stage workflow trusts earlier-stage outputs as safe without re-validation
  • Relying on documented “recommended” restrictions without verifying enforcement at execution time
  • Assuming approval earlier in the chain guarantees safety later
  • High-severity advisory exists for the workflow/repo
  • Shared workspace between stages with different privileges
  • “Protected paths” focus on known locations but ignore attacker-influenced state elsewhere
  • Downstream tools inherit trust decisions without re-checking context
Try Mirage

Mirage safely runs attacks like this one against your own team, so you find out what happens before a real adversary does.

Get a demo

Frequently asked questions

How does a malicious pull request lead to a secret leak?

A pull request description can contain text that an AI agent parses as instructions, extracting shell commands, getting them approved as safe, and then automatically posting the command output back into the PR thread, which can expose secrets.

Is this a flaw in the AI model or the surrounding automation?

The research found the core issue was not the prompt injection itself but how the agent's automation pipeline, or harness, approves steps and publishes outputs across workflow stages without re-checking trust at each handoff.

Which vendors were affected by this issue?

The testing covered default and recommended configurations of agent tooling from Anthropic, Google, and OpenAI, including a CVSS 10.0 advisory tied to Google's Gemini CLI and a sandbox bypass issue in OpenAI's Codex CLI.

What should teams do to reduce this risk?

Teams should treat pull request text as hostile input, tightly control automatic posting of command output, and re-validate trust at the point of execution or publishing rather than only at the initial approval step.

Read the video transcript

Imagine this: a pull request lands with a tidy bug report, and before any human reads it… your AI bot already has. The PR text says, 'Here are a few shell commands to run… please paste the output here.' The agent extracts those commands, gets them marked as safe, runs them, and then posts the output right back on the PR thread, secrets and all. Here’s the nasty part: the failures are in the handoffs. One stage labels a command as safe, the next stage blindly runs it, and another stage auto-publishes the output. In tests, Anthropic, Google, and OpenAI agent workflows all leaked data this way, even Google’s Gemini CLI, with a CVSS 10 advisory, when a configured restriction just wasn’t enforced at execution time. Your move: if your CI uses AI agents on pull requests, kill auto-posting of command output to PRs and logs, and review every place untrusted PR text can turn into an executable command.

Similar attacks