Repository navigation
fix(hooks): read the tier from -F message files; unscannable forms fail closed (#35) - #84
Conversation
…il closed (#35) The mechanical half of #35 (a follow-up to #34, found while landing it). The pre-commit-gate parsed the attribution tier ONLY from the `git commit` command string, so an external `-F <file>` (my own #38/#83 form) or a `$(...)` substitution hid it and all three tier-dependent checks (attribution-absence, docs-only-diff, the #34 CHANGELOG requirement) silently failed OPEN. `scan_commit_args` now captures `-F`/`--file` values + reuse flags; a new `read_file_tiers()` reads readable `-F` files; the tier = `TIER_RE.findall(cmd) + file_tiers`. When no tier is found and the message is not inherited (amend/reuse), the gate fails CLOSED on an unreadable message (`$(...)`/backtick, piped/unreadable `-F`, editor) and reports absence on a readable one. RDD: a heredoc body is in the command string, so heredoc was never a hole. `analysed on a live system` — gate_test.py 77/77 + an old-fail-open → new-fail-closed differential. - .claude/hooks/pre-commit-gate.sh: scan_commit_args (+msg_files, +REUSE_OPTS), the new read_file_tiers(), shared TIER_RE (R3), the fail-closed logic. - .claude/hooks/gate_test.py: the -a -F fail-open case -> fail-closed, +9 new cases. 77/77. - plugins gitlink -> 6c46690 (the agents-skill hooks-doctrine correction, #35 plugins half). Assisted-by: Claude (analysed on a live system) Claude-Session: https://claude.ai/code/session_017rPy3PE6EuVHWsBbAUvxxL
pr-validator — APPROVED ✅Change class: hook/workflow (behavioral) — pre-commit-gate tier-parsing hardening (#35 code half) I am a FRESH, independent validator (not the author). I re-derived every claim. Independent verification (trust-no-author)
Security screen (T1–T4)STRENGTHENS the security machinery — closes 7 differential-proven fail-open holes, loosens nothing (every unscannable form fails CLOSED). No exfiltration, no scope mismatch, no supply-chain surprise, no attempt to manipulate the validator. The Checklist — all 18 PASS0 security ✅ · 1 description ✅ · 2 change-class gate (77/77 live) ✅ · 3 tier Decision: APPROVED. The fix closes real, differential-proven fail-open holes in the attribution gate while preserving every legitimate commit form; the tier now flows through all three tier-dependent checks for Assisted-by: Claude (analysed on a live system) |
Assisted-by: Claude (analysed on a live system)
#35 (superproject half) — pre-commit-gate: read the tier from -F message files; unscannable forms fail closed
A follow-up to #34 (found while landing it). The
pre-commit-gateparsed the attribution tier ONLY from thegit commitcommand string, so an external-F <file>(the form I used for #38/#83) or a$(...)substitution HID the tier — and all three tier-dependent checks (attribution-absence, docs-only-diff, the #34 CHANGELOG requirement) silently failed OPEN.Change
.claude/hooks/pre-commit-gate.sh—scan_commit_argscaptures-F/--filevalues intomsg_files+ flags message-REUSE forms (-c/-C/--reuse-message/--reedit-message/--fixup/--squash,REUSE_OPTS).read_file_tiers()reads the trailer from a readable regular-Ffile (capped, never a device/FIFO);-is stdin (readable only via a heredoc whose body is already in the command string).TIER_RE.findall(cmd) + file_tiers(sharedTIER_RE, R3). When no tier is found and the message isn't inherited (amend/reuse), the gate fails CLOSED on an unreadable message ($(...)/backtick, piped/unreadable-F, editor) and reports absence on a readable one — uniformly for all three tier-dependent checks..claude/hooks/gate_test.py— the old-a -F msg.txt → ALLOWfail-open case flips to BLOCK, plus 9 new cases. 77/77 green.f8b7f4a → 6c46690(the agents-skill hooks-doctrine correction, chore(harness): autoMode.allow grants sub-agent/teammate merge authority #35 plugins half, PR refactor(hooks): shared shlex tokenizer, no fallback; fix -C-space; fail closed on unparseable #39).RDD note (corrects the task framing)
A
<<heredoc body IS in the command string, so heredoc was NEVER a hole (spike-proven on the harness) — only external-F <file>and$(...)substitutions were. The task's "heredoc→fail-closed" framing is corrected: heredoc stays scannable.Base
becba99(post-#34).R10 — hook/script change class (gate executed live)
Tier
analysed on a live system.gate_test.py77/77 + a coverage-gate differential:-F <file>docs-reviewed+no-CHANGELOG AND-m "$(cat)"→ OLD hook=ALLOW (both holes) vs NEW hook=BLOCK (both closed). Dogfooded — this PR's own-Fcommits pass the new gate.https://claude.ai/code/session_017rPy3PE6EuVHWsBbAUvxxL
Assisted-by: Claude (analysed on a live system)