docs(security): ADR-004 PostToolUse hook ordering + invariant test #4
Reference in New Issue
Block a user
Delete Branch "docs/adr-posttooluse-hook-ordering"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes the last remaining 2026-05-19 audit finding. The audit raised PostToolUse hook ordering as High: hooks see raw tool output before the firewall scan runs, so a `type = "prompt"` hook could pipe secrets to a remote LLM. The audit proposed reordering or splitting the event into raw-local vs. redacted-for-LLM variants.
After investigating, the audit's threat model is already closed transitively by Wave 1. Wave 1's SafeProvider boundary scans outgoing messages at every router arm and at every non-engine provider consumer. For each hook command type:
So the audit's literal observation about source ordering remains true; the practical leak it implied does not.
Decision (ADR-004)
Accept the current ordering. Document the transitive guarantee. Lock it in with a regression test.
Alternatives considered:
Position D (this PR) wins because: no churn, shell-hook use cases preserved, transitive guarantee made explicit and tested.
What changes
Test plan