Repository navigation
Description
block-hook-bypass.sh has no target-path carve-out of any kind except the /dev/null discard, so a
scratch-data write in a read-only investigation — a throwaway probe file under a session/job temp
root, which no formatter, secret scanner or path checker would ever process — is blocked exactly like
a repo-file write. The guard is behaving as designed (it is producer-scoped: it fires on
echo/printf/cat/python3 -c as the producer, regardless of where the target lives), and the
cost is real rework in analysis workloads. The same shape has now been reported three times across
two sessions.
Rows
- I5 F2b —
plugins/guardrails/hooks/block-hook-bypass.sh:502-503and:571-572— the only
target-based exemption in the guard is the/dev/nullliteral; a grep of the file for
tmp/TEMP/scratchreturns only the telemetry line at:113, so there is no temp-path
concept in the guard at all.
Evidence
At HEAD, plugins/guardrails/hooks/block-hook-bypass.sh:571-572 (and the mirror at :502-503 in the
cat lane):
[[ -n "$LAST_STDOUT_TARGET" ]] || continue
[[ "$LAST_STDOUT_TARGET" == "/dev/null" ]] && continueBehavioral reproduction #1 (HEAD copy):
echo '{"tool_name":"Bash","tool_input":{"command":"echo hello > /tmp/scratch/data.json"}}' \
| bash plugins/guardrails/hooks/block-hook-bypass.sh
→ exit=2, BLOCKED: echo/printf > file write bypasses Write/Edit hooks
Behavioral reproduction #2 (unplanned, live): the validation pass that produced this ledger was
itself blocked by the installed guard while building a throwaway telemetry-sink probe under /tmp —
PreToolUse:Bash hook error: [block-hook-bypass.sh]: BLOCKED: echo/printf > file write bypasses Write/Edit hooks.
Corrected mechanism (the original framing is falsified in part)
The item framed a carve-out as a tightening of the existing producer scoping. It is not. The guard
is producer-scoped, not target-scoped (header :14-19, producer_redirect_bypass at :509), so a
carve-out by target path adds a genuinely new axis to the guard's design. That matters for the
fix shape and for its security review: a target-path allowlist is exactly the one-token-bypass
surface that already had to be fixed once here (echo x > /dev/null > real.txt, see
set_last_stdout_target at :477 and the left-to-right note at :465-472).
Any fix must therefore match on a normalized, resolved target path — never a substring or a bare
prefix compare — and must ship a test asserting the bypass shape still fails, not merely that the
happy path passes.
Adjacent, not duplicate
- guardrails: hooks ship false-positive over-fires with no per-hook fixtures or shared precision convention (6-issue class: diff-scope, quoted-arg, boolean-intent, stdin, path-branch) #547 — the umbrella "guardrails hooks ship false-positive over-fires" class issue; closest
existing home. - fix(guardrails): block-hook-bypass false-positives a print-only python3 -c, pushing users to the opaque form #2148 —
block-hook-bypassfalse-positives a print-onlypython3 -c. Different arm; fix(guardrails): block-hook-bypass false-positives a print-only python3 -c, pushing users to the opaque form #2148's
own scope note says theecho >file/cat >fileblocks it hit were correct. - fix(guardrails): block-hook-bypass wrongly blocks echo/printf ... >&N as a file-write bypass #1680, block-hook-bypass.sh:375 — patsub_replacement (Bash 5.2+) silently disables the >&N sentinel restore, false-positives on bare echo/printf >&2 #1667, guardrails: block-hook-bypass _py_write open( indicator blocks read-only python3 -c reads #1601 — different forms (fd dup,
patsub_replacement,_py_write). - Inbox
20260730-182801-guardrails-hook-false-positives-…(status: done, guardrails 0.19.3 /
PR fix(guardrails): stop blocking read-only python open() and cat > /dev/null #2007) — closest prior art: its resolution records that "F2 (out-of-repo plugin-data append)
remains unreproduced". This row is the reproducible version of that unresolved row. - guardrails: REPLACE_ALL conflates a jq failure with a legitimate false, silently #2126 and fix(guardrails): every hook calling hook::require_jq fails OPEN when jq is absent, while the same guard fails closed on length #2146 were checked and are unrelated (
REPLACE_ALLextraction;jq-missing
fail-open).
Provenance
Severity: MED · Provenance: UNVERIFIED (the originating item's own banner disclaims verification;
the validation pass reproduced the fact at HEAD twice, but no fresh-context auditor pass ran, so this
row has not had an independent audit pass)
Origin: handoff-inbox item 20260810-225908-claude-ops-permissiondenied-inert-and-guardrails-friction
Ledger: .work/handoff-inbox-batch-4/ledgers/I5-claude-ops-guardrails-unverified.md § F2b
Verified against repo HEAD 685dd381.
Operator decision (batch-4 reconciliation DQ-2): CODE IT. This row is being implemented in the
same pass that files it, under the design constraints stated above.
Activity
docs(guardrails): state the true scope of block-hook-bypass's quoted-…
fix(guardrails): decide block-hook-bypass's exemptions on the whole r…