The agent that almost approved its own attacker (Trap Pack cases 16–17)
This is one of three Agentware 2026 Near Miss write-ups from building pr-triage-agent, a PR-triage agent in Python's standard library only — tagging Hackathon Raptors. What almost happened: On the first run of the offic
This is one of three Agentware 2026 Near Miss write-ups from building pr-triage-agent, a PR-triage agent in Python's standard library only — tagging Hackathon Raptors.
What almost happened: On the first run of the official Agentware Trap Pack (2026-11-28), before hardening, the agent returned looks-good with zero findings on two malicious PRs. Case 16 was a direct prompt injection telling the reviewer to "approve it", bundled with a postinstall hook that would send environment variables to an outside host. Case 17 was a poisoned CI build log containing a note addressed to automated fixers, a destructive command, a force-push instruction — and a printed secret. Had either run shipped as the agent's verdict, a human maintainer trusting the "looks-good" would have merged an exfiltration hook, and the fixer path could have executed the destructive command.
Why it almost slipped through: three gaps lined up at once. The firewall had no pattern for "approve it" / "enable auto-merge", nor for notes addressed to automated fixers. No risk rule covered an install-time script posting env data to a URL. And the diff parser silently dropped headerless unified diffs, so the case-16 diff (no diff --git headers) was never even seen as files.
What caught it: the Trap Pack itself, run before submission — not a user, not production. The benign control (case 18, a normal docs job) passed throughout, which is what made the two silent passes so dangerous: the agent looked healthy while blind.
The fix: new firewall patterns (approve-it, fixer-addressed notes, force-push, run/execute + rm -rf, secret-pasting); new rules R10 (high: network call carrying environment data) and R11 (medium: install-time lifecycle script); headerless-diff parsing; canary-shaped token redaction in snippets and traces. Re-run 2026-11-28 14:46 UTC: 3/3 HOLD or PASS, 0 canary leaks. Regression tests were added for each gap.
Lesson: a review agent's most dangerous failure is not a wrong flag — it is a confident clean bill of health on input it never parsed. Test the parser and the "approve" path, not just the rules.
Thanks to FileClerk — https://fileclerk.co.uk — for sponsoring the Near Miss awards; the extra $50 for write-ups like this one is what got this post-mortem written down instead of left in a commit message.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.