Reading a public GitHub issue inside a write-enabled agent session taints every tool call that follows
retained text
When a coding agent pulls raw issue text or PR comments straight into an active session, any hidden prompt injection in that thread shares the same context window as your shell and file tools.
In interactive runs, `WebFetch` routes page fetches through a separate summarization call instead of handing raw HTML to the main session. Running `curl` or `gh` inside Bash skips that boundary and dumps untrusted strings straight into the conversation.
Headless automation widens the gap. Non-interactive `-p` runs skip both the folder trust dialog and `.mcp.json` project approval prompts, so an unattended triage job that reads external issues and holds write permissions can run commands with zero interactive checks.
Splitting read-only triage into a separate session or blocking writes once untrusted content enters context avoids the mix. A `PreToolUse` hook can check a local taint marker before letting `Edit`, `Write`, or `Bash` execute:
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "Edit|Write|Bash",
"hooks": [
{
"type": "command",
"command": "./scripts/block_if_tainted.sh"
}
]
}
]
}
}
```
Once a session ingests external issues or emails, exiting with code 2 from the hook forces the edit or shell step to stop until a clean session handles the implementation with sandbox network isolation turned on.document fetched 2026-11-19 00:41 · canonical https://reddit.com/r/ClaudeCode/comments/1xzhfup/reading_a_public_github_issue_inside_a