fix(guardrails): buffer stdin before parsing in cli-flag-verify hook - #757
Conversation
hook::read_file_path ran jq directly against the inherited fd0 with no read bound — the last remaining fd0-direct reader after the fleet-wide hook::buffer_stdin migration, and the same Windows Win32-pipe late-EOF stall class that migration eliminated. Buffer first, then pipe the payload into the parser; empty or timed-out stdin skips this advisory hook (plain exit-0 collapse, matching its class). Adds an empty-stdin skip-contract test case. Closes #446 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Claude finished @kyle-sexton's task in 1m 22s —— View job Security Review
No exploitable security vulnerabilities found in this PR. The change touches four files. The security-relevant portion is the two-line replacement in # Before:
FILE=$(hook::read_file_path) || exit 0
# After:
INPUT=$(hook::buffer_stdin) || exit 0
FILE=$(printf '%s' "$INPUT" | hook::read_file_path) || exit 0Data flow analysis — stdin → jq → path → shell:
Pre-existing surfaces not introduced by this PR (out of scope but noted for completeness): Test changes ( Version bump ( |
|
Claude finished @kyle-sexton's task in 1m 28s —— View job PR Review
SummaryMinimal, focused fix that completes the fleet-wide
|
…DMEs (wave 2) (#758) No linked issue — wave 2 of 3; #537 stays open until all 39 plugins are done. Same recipe as wave-1 PR #755 for the next 13 plugins alphabetically; guardrails is deferred to wave 3 because two in-flight guardrails version bumps (#757 lane) serialize ahead of it. Per-plugin patch bump + CHANGELOG entry; discovery and docs-hygiene entries carry dates per those plugins' own changelog convention. Verification: repro grep returns 0 hits over the 13 wave-2 READMEs; all 13 manifest versions match their CHANGELOG top entry; base predates #755 so wave-1 plugins intentionally still carry the pointer here (no file overlap between waves). ## Related - #537 (wave 2 of 3) - #755 (wave 1) - #426 (the two-plugin fix this mirrors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Closes #446
hook::read_file_pathran jq directly against the inherited fd0 with no read bound incli-flag-verify.sh— the last remaining fd0-direct reader after the fleet-widehook::buffer_stdinmigration, same Windows Win32-pipe late-EOF stall class. Fix per the issue's decided shape: buffer first, pipe the payload into the parser; empty/timed-out stdin skips this advisory hook (plain|| exit 0collapse matching its class and its siblings). Guardrails 0.9.0 → 0.9.1 + CHANGELOG.Verification:
cli-flag-verify.test.shPASS=37 FAIL=0 (35 baseline + 2 new empty-stdin skip-contract assertions); shellcheck clean. The new test asserts the skip contract, not the stall itself — a here-string//dev/nullharness cannot reproduce the Win32 late-EOF stall; behavior-preservation evidence is the suite green before/after with every case now routed through the buffered read.Related
hook::buffer_stdinmigration this completes)🤖 Generated with Claude Code