fix(guardrails): restore path-detection prefilter fail-open fix (0.9.8) - #946
Conversation
HPP_WIN_REPO_BODY / HPP_ESCAPED_WIN_REPO_BODY now accept repos|Repos|projects|Projects|dev|Dev, but the cheap pre-filter gate in hpp::scan_text still only tripped on Users|/home/|repos. Content whose only machine path was e.g. C:\Projects\acme\... or C:\Dev\acme\... early-returned 0 before the detailed scan ran — the guardrail under-blocked the very roots this change adds (fail-open in a security gate). Extend the gate alternation to list every root token the detailed bodies accept, keeping it a strict superset. Add a regression test covering a generic Windows checkout root under a widened name (Projects), which exits 2 with the fix and would silently pass without it.
…c sync Records the restored `hardcoded-path-check` pre-filter fail-open fix under a new [0.9.8] CHANGELOG entry (the gate had narrowed to `Users|/home/|repos` on main while the detailed bodies accept the widened Projects/Dev roots, so those machine paths early-returned before the detailed scan — fail-open in a security gate). Also broadens the `block_no_verify_enabled` userConfig description, which still enumerated "lefthook disables" only, to the actual configurable default set (lefthook, husky, pre-commit, simple-git-hooks) that shipped in 0.9.7.
|
Claude finished @kyle-sexton's task in 1m 54s —— View job PR Review: fix(guardrails): restore path-detection prefilter fail-open fix (0.9.8)
SummaryThe bug and fix are both correctly diagnosed. The cheap FindingsNo blocking issues. One observation and one minor note follow. Observation —
|
| Detailed pattern tokens | Pre-filter covers? |
|---|---|
repos |
✓ (was already present) |
Repos |
✓ (added in this PR) |
projects |
✓ (added in this PR) |
Projects |
✓ (added in this PR) |
dev |
✓ (added in this PR) |
Dev |
✓ (added in this PR) |
Users |
✓ (already covered Windows + macOS user paths) |
/home/ |
✓ (already covered Linux user paths) |
The updated comment at L62–64 correctly encodes the maintenance rule ("a widened body must widen this list too"), which is the right way to document this invariant for future contributors.
The block_no_verify_enabled description update accurately reflects the shipped behavior (configurable set of hook managers, not just lefthook).
Version bump 0.9.7 → 0.9.8 and CHANGELOG entry are both appropriate for a bug fix that closes a fail-open in a security gate.
Verdict: LGTM. The fix is correct, minimal, and the regression test directly exercises the fail-open path.
|
Claude finished @kyle-sexton's task in 1m 49s —— View job Security Review — PR #946
No security vulnerabilities found. Here is the full analysis of the four security-relevant surfaces touched by this PR. 1. Prefilter gate widening — SAFELine 76, hardcoded-path-patterns.sh The gate changed from: to: The gate is 2. Here-string injection surface — SAFEThe prefilter invokes The project-root branch uses 3.
|
main released guardrails 0.9.8 (#946 hardcoded-path prefilter fail-open restore + block-no-verify description) while this branch also carried 0.9.8 for the #740 config-env work; branch entry restacked to 0.9.9, main's 0.9.8 section preserved intact below it. No hook/lib/test code overlap with #740 — the #946 change is in hardcoded-path-check.
Summary
The
hardcoded-path-checkguard's cheapscan_textpre-filter had narrowed onmain: it gated only onUsers|/home/|repos, while the detailed drive-letter bodies (HPP_WIN_REPO_BODY/HPP_ESCAPED_WIN_REPO_BODY) accept the broadenedrepos|Repos|projects|Projects|dev|Devroots shipped in 0.9.7. Content whose only machine path used a widened root (e.g.C:\Projects\…,C:\Dev\…) therefore early-returned0before the detailed scan ever ran — a fail-open in a security gate. This re-widens the pre-filter gate to a strict superset of every root token the detailed bodies accept, adds aProjects-root regression test, folds in the staleblock_no_verify_enableddescription sync (it still read "lefthook disables" only, now the full configurable default set), and bumps the plugin to0.9.8.All 40
hardcoded-path-checktests pass; shellcheck clean.Closes #944
Related
9a33e665) was dropped by a concurrent force-push, landing this regression onmain; this PR restores it fix-forward.