Zazel-pixel/injection-guard
194 stars · Last commit 2026-11-07
A small, dependency-free prompt-injection guard for coding-agent hooks (Claude Code, Codex), measured on public datasets and real sessions.
README preview
# injection-guard A small prompt-injection guard for the hooks of coding agents (Claude Code, Codex). One Python file, standard library only, no network. It has been measured on public datasets and on three months of real agent sessions, and it is honest about what it misses. It does two things: - **After every tool call** (`PostToolUse`), it scans what came back (a web page, a file, a command's output, an MCP response) for text that tries to pass itself off as an instruction, and tells the agent. It never blocks. - **Before every shell command** (`PreToolUse`), it blocks the common forms of `curl ... | sh`, the step where fetched content becomes code that runs. It parses shell quoting, so a note that merely *mentions* that command is not blocked. Many other forms still get through: see the next section. ## What it does not catch Read this before relying on it.