fix(hooks): bound HOOK.md reads during hook install validation#101469
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 12, 2026, 9:53 AM ET / 13:53 UTC. Summary PR surface: Source +5, Tests +13. Total +18 across 2 files. Reproducibility: yes. at high confidence from source and real-path evidence. Current main reads the entire file, while the contributor’s installer transcript shows a normal file accepted and a 1 MiB-plus-one-byte file rejected on the patched path. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Adopt one shared regular-file-only, 1 MiB metadata boundary for hook installation, refresh the branch, and merge after the assigned owner confirms that compatibility policy and exact-head checks pass. Do we have a high-confidence way to reproduce the issue? Yes, at high confidence from source and real-path evidence. Current main reads the entire file, while the contributor’s installer transcript shows a normal file accepted and a 1 MiB-plus-one-byte file rejected on the patched path. Is this the best way to solve the issue? Yes, provided the regular-file-only contract is intentional. Reusing the pinned safe-file helper is narrower and more maintainable than introducing a duplicate hook-specific bounded reader. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ef196b68b48d. Label changesLabel justifications:
Evidence reviewedPR surface: Source +5, Tests +13. Total +18 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (20 earlier review cycles; latest 8 shown)
|
8361b80 to
39c3cd1
Compare
|
@clawsweeper re-review\n\nI added real behavior proof to the PR body, including the local test command and output that exercises the oversized-file rejection path. |
39c3cd1 to
c0af17f
Compare
|
@clawsweeper re-review Added real behavior proof that exercises |
|
🦞🧹 I asked ClawSweeper to review this item again. |
e2dfc3c to
31234cb
Compare
3ff04c4 to
00cfcbc
Compare
5b1deaa to
3362490
Compare
dd5a9ee to
9d76ba3
Compare
603cad4 to
c9f9918
Compare
c9f9918 to
6750c7d
Compare
6750c7d to
3de3df1
Compare
|
Land-ready maintainer proof:
Known gap: no external service is involved; focused install-path proof is the relevant live boundary. |
|
Merged via squash.
|
…law#101469) * fix(hooks): bound HOOK.md reads during hook install validation * fix(hooks): remove unused fs import after switching to bounded reader * test(hooks): cover symlinked install metadata --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
resolveHookNameFromDirread hook-packageHOOK.mdmetadata without a size bound. A malicious or malformed package could therefore make the install path buffer a very large file before frontmatter parsing.Why This Change Was Made
Route the read through the repository's canonical regular-file helper with a 1 MiB byte cap. That helper checks size before opening, enforces the cap while reading, verifies file identity, and rejects symlinked or otherwise non-regular metadata leaves; this keeps the package boundary on one race-safe path instead of adding a hook-specific reader.
User Impact
Normal hook packages continue to install. Oversized, symlinked, or non-regular
HOOK.mdmetadata now fails fast with a clear validation error instead of risking unbounded allocation or reading outside the package leaf.Evidence
tbx_01kxbm12g35zctaf2wg478ebv2, Actions29201000714:pnpm test src/hooks/install.test.tspassed 30/30.fs-safe/src/regular-file.tsprechecks size, performs capped incremental reads, pins file identity, and rejects symlink/non-file leaves.