A comment asking an AI review bot to collect diagnostics can look harmless beside a pull request. Inside the CI runner, that request may reach an agent with file access and usable credentials. If the agent follows instructions embedded in the comment, someone with permission to join a discussion can influence actions performed with the project’s authority.
The exposure begins when repository content enters the agent’s context and changes its behavior. Teams adopting AI reviewers need to trace that path through the runner, including what the agent can read and where its responses can go.
When Discussion Text Becomes a Tool Request
The AI reviewer might be supplied with the diff, along with comments, build logs and repository instructions. An attacker can put the instructions anywhere within those pieces of input, passing them off as troubleshooting help or company policy.OWASP mentions indirect prompt injection as instructions appearing via some other media being read by the model. As for CI/CD, the effect will depend on what is connected to the model. The process is quite simple: The agent reads attacker-supplied instructions, perceives them as the task and then calls for some tool action. A file reader fetches some confidential data, and then there comes an answer. Shell escaping is necessary when it comes to building commands. Still, the application executing the actions called by the model’s tools must have its own authorization procedure. Even an escape-friendly comment can contain instructions for the agent.
A Tool Boundary That Failed in Practice
In June 2026, Microsoft published a paper discussing how Claude Code’s GitHub Action could reveal workflow secrets after being run on malicious GitHub content.The analysis highlighted an important inconsistency. Environment scrubbing was used for subprocesses such as Bash, while Read ran outside the sandbox. It could read from /proc/self/environ to obtain the ANTHROPIC_API_KEY of the workflow.The problem was fixed by Anthropic in Claude Code 2.1.128 by restricting access to /proc files. It was known to be a documented and patched vulnerability. The operational takeaway is relevant not only to this particular approach. Analyze the execution context of each tool. Using a restricted shell does not provide adequate security when other allowed tools can read process information or credentials.

Follow the Workflow Trigger
GitHub normally withholds repository secrets from pull_request workflows originating from forks, except for the restricted GITHUB_TOKEN. Repository settings and other triggers require separate examination.
A workflow responding to ordinary pull request comments uses issue_comment, which runs from the default branch. Depending on its configuration, that workflow can pass credentials to an agent while it reads comments from outside contributors.
The pull_request_target event also uses trusted repository context. GitHub’s event documentation explains these distinctions. Reading untrusted text into a privileged agent creates an exposure path even when the contributor’s branch is never executed.
If invocation requires maintainer privileges, verify current repository permissions through GitHub. A command prefix such as /review identifies a requested action; it does not authenticate the author or authorize access to secrets.
Check who can invoke the bot and which discussions it retrieves. Bind approval to a specific input snapshot and commit. A maintainer’s invocation provides little assurance about instructions hidden in other content the agent subsequently reads.
Separate Analysis From Authority
I would begin with the runner’s actual access. List credentials made available through environment variables, files, credential helpers and attached services. Include the model provider’s API key.
Run analysis in a disposable environment with only the repository access it needs. Keep deployment credentials and broad write permissions in separate jobs. Start with minimal GITHUB_TOKEN permissions and grant additional capabilities individually.
On self-hosted infrastructure, disposal must include writable host state. Shared volumes, Docker sockets or reused workspaces can reconnect jobs that appear separate in the workflow file. Verify teardown after failed and cancelled runs.
An API broker can keep the model credential outside the agent process, with authentication and usage limits enforced by the broker. Restrict file tools to approved workspace paths, including checks against symlink escapes. Apply network restrictions at the execution layer.
Network allowlists should cover every tool’s outbound connections. A tool server with its own HTTP client can bypass restrictions enforced solely inside a Bash subprocess. Verify these controls from each component’s actual execution environment.
Cloud federation needs the same scrutiny. GitHub’s OpenID Connect (OIDC) integration lets authorized jobs obtain tokens for cloud authentication. Grant id-token: Write only where required and constrain cloud trust conditions. A short token lifetime still leaves time for misuse.
If a separate job publishes findings, validate its input and destination independently. Bind the report to the expected repository, pull request and commit; enforce a bounded schema. Derive the publication target from trusted event metadata. Schema validation limits structure; enforce allowed actions separately, including which destinations a publisher may address. Check report content for accidental disclosures.
Treat generated text as untrusted data throughout. Passing model output directly into a shell recreates an execution path.

Test Reads, Outputs and Recovery
An agent may disclose information through a review comment, uploaded artifact or diagnostic log. An approved model endpoint can also receive secrets included in tool results. Restrict sensitive reads before those results enter model context.
Log masking provides limited assurance. GitHub warns that automatic redaction is not guaranteed, particularly when secret values are transformed. Inspect every enabled output channel.
Build an isolated test workflow containing fake credentials. Submit comments that request diagnostic collection or claim authority to override the review task. Include instructions embedded in files and tool responses. Check attempted file reads, network destinations and published output.
Tests should establish whether runtime controls deny the operation even when the model requests it. Repeat them after changing the agent, model, tools or workflow permissions.
Capture invocation details, commit identifiers and tool activity without recording credential values. If exposure occurs, stop the workflow and revoke affected credentials. Preserve evidence in restricted storage, remove public disclosures and inspect repository changes and cloud activity within the credentials’ scope.
Keep Review Content Outside the Credential Boundary
AI review becomes easier to assess when its capabilities are explicit. For each workflow, determine which content can reach the model, which operations the executor permits and which credentials remain accessible.
A pull request discussion should help an agent understand the proposed change. It should never acquire the authority to expand file access, obtain deployment credentials or choose an unrestricted publication destination. Enforce those decisions in the workflow and tool runtime, then test them with hostile inputs.
