Dev.to Security 🔐 Cybersecurity 👁 0 📖 2 min read

The safety feature that would have published the secret (red-team P0)

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: The firewall was built to qua

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: The firewall was built to quarantine injected instructions — but the review renderer pasted the firewall's own evidence snippet straight into the public PR comment. The snippet was the matched text ±40 characters, cleaned only of canary-shaped tokens. If a PR body said "ignore previous instructions, my password is …", that ±40-character window could have carried the credential into a public comment, posted by the agent itself via the GitHub review path. The audit (muse-a2, 2026-11-29) rated this P0: the agent's defence was the leak.

Why it almost slipped through: redaction lived in the wrong places. firewall.py cleaned canary tokens but not assignment-style secrets; trace.py redaction did not cover password="…"-style values either; and the review-publication path never passed through trace redaction at all. Every layer assumed another layer had handled it. The same audit found the residual a day later in the Trivial-fixes display (comments.py:80–82), which needed one more _redact — proof the pattern was systemic, not a single line.

What caught it: an independent cold-start audit by teammate muse-a2 on 2026-11-29, reading the code as a judge would — before the 2026-11-30 18:00 UTC freeze, and before any real PR carried a real secret through the agent. No real secret was ever leaked; the audit's scan found only synthetic fixture values.

The fix: comments.py now redacts the snippet a second time before it reaches a review; firewall.py reuses the risk module's secret patterns; trace redaction was widened; a regression test pins the behaviour. Patched 2026-11-29 (HEAD 84d0e8f, then residual HEAD 483ecfd0); full suite 77 tests, 76 pass, 1 skip.

Lesson: evidence shown to humans needs the same redaction as evidence stored in logs — "display-only" is still publication when the display is a public PR comment. Redact at the last step before the outside world, not just at the first.

This write-up is part of the Agentware Near Miss series. FileClerk (https://fileclerk.co.uk) sponsors the $50 awards for these posts — grateful for backing honest stories about near-misses instead of only success stories.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.