Repository navigation
Description
hooks.d/after_save/60-git-reconcile.sh is hard-disabled unconditionally (#969/#970, merged in v0.42.1) pending a real fix for its TOCTOU-class race. The rebase/restore code the disable short-circuits is still in the file, unreached while the kill switch stands, and still carries the four defects below -- each confirmed still present at HEAD during this curate pass (2026-10-07), each logged originally as a non-blocking trap.d fragment per skills/manager/phases/findings.md's "can ship behind a trap.d fragment" row. None of the four blocks a release on their own (the hook cannot run), but all four should be fixed, or re-verified, before this hook is ever re-enabled -- otherwise the real TOCTOU fix ships back into code that still misreports its own outcome.
1. git diff --name-only errors are swallowed, so _checkout_ok can stay set after a silent restore failure. In _grc_compute_touched_paths (~lines 461-476) and its consumer in _grc_report_conflict (~lines 546-584), both git diff --name-only calls send errors to 2>/dev/null. If either fails, the touched-path list is silently empty; with an empty list the restore is skipped entirely, but _checkout_ok stays at 1 -- so the hook would log "aborted, the tree is unchanged" while conflict state may still be sitting in the tree. A merge-base failure right before it is already logged; the diff failure that can follow it is not. Not confirmed reachable in practice -- reasoned, not observed.
2. core.quotePath is left on, so a touched path with non-ASCII bytes silently drops out of the restore. Around lines 473-474, 571 and 584: touched paths come from git diff --name-only with git's default path quoting left on. Any path with non-ASCII or special bytes comes back as a quoted string, and nothing un-quotes it before it reaches ls-tree, checkout, diff and rm -- that path matches nothing and silently drops out of the restore, while _checkout_ok can stay 1 and the "tree is unchanged" message still prints. Not covered by CI (no fixture uses a non-ASCII path).
3. Two residual TOCTOU windows survive #966's own fix. (a) The content snapshot is taken immediately before git rebase --quit, not before the rebase attempt itself, so a concurrent write landing between the rebase starting and the snapshot being taken is already reflected in the "before" snapshot and gets discarded anyway. Deliberately not moved earlier -- snapshotting before the rebase attempt would make every touched path look "changed" against this run's own replay, which is a worse regression. Closing this needs a mechanism that can tell this run's own replay apart from a different slug's write, out of scope for #966. (b) A narrower gap: all per-path "now" hashes are computed in one loop before the actual checkout/rm calls run on that whole set, so a write landing after a path's hash is read but before that path's own checkout/rm executes is undetected and clobbered. Neither gap is exercised by #966's own regression test.
4. Only one of five call sites of _grc_rebase_in_progress's rc=2 path has a dedicated test. Self-review on the #952/#953 lane found the new test_undetermined_rebase_check_declines_rather_than_proceeding test forces both git rev-parse --git-path calls to fail, exercising only the first of five call sites (confirmed still 5 at HEAD: lines 697, 742, 798, 827, 845). The other four were verified correct by reading the code, but carry no dedicated test. A later &&/|| fix (commit 8a28d07) also means a could-not-tell now fires when EITHER git-path call fails, not just when both do -- the existing test still only forces both, so the single-call-failure path is untested anywhere in the file.
What would close this issue: fix (or re-verify as already covered by the eventual real-fix design) each of the four items above, then re-enable the hook per #969's own tracking note ("to be hardened later on its own branch").
[AI-generated]
Activity
fix(#975): CI -- rewrite escape handling without the forbidden backsl…
curate: promote 1 rule, decline 10 fragments (5 new issues, 1 stale) (#…
fix(#972,#975,#982): anchor v1 cache substitution, harden reconcile t…