Repository navigation
Conversation
`hooks.d/after_save/60-git-reconcile.sh` has produced a destroys-class security finding in five consecutive release audits across two releases (#932, #939, #946, #952's regression, #966), each fix closing one race window and opening the next, narrower one. #969's gate-3 round-2 audit found a further one: a foreign write landing in the window from the start of `git rebase --no-autostash` through the conflict firing -- before #966's own pre/post-`rebase --quit` snapshot is even taken -- is still silently discarded by the scoped conflict restore, while the hook still logs "aborted, the tree is unchanged". Per the scheduler's ruling for v0.42.1: rather than attempt a sixth fix, the hook is hard-disabled. It now exits 0 immediately, printing a one-line notice naming #969, before even reading `git_reconcile.enabled` -- the kill switch does not itself depend on the flag whose read is downstream of the disabled code path. New regression test TestHardDisabledPending969 (in tests/test_git_reconcile_903.py) proves the kill switch itself: against the exact TOCTOU scenario #969 reports as still open (a shimmed `git` that injects a foreign, in-restore-set write at the `rebase --no-autostash` call), confirmed red against the pre-kill-switch hook (same assertions failing because the old hook ran normally and never emitted the #969 notice) and green after. Every other test in that file and in tests/test_git_reconcile_mapfile_floor_952.py that drives the hook's actual reconcile/conflict/restore/NDC-bump behavior is now class- or test-level skipped with a reason naming #969, kept as documentation of intended behavior for when the real fix lands and the kill switch is removed -- rather than left to fail, or silently passing for the wrong reason (nothing touches the tree because the hook never runs, not because the behavior under test is correct). docs/configuration.md's `git_reconcile.enabled` row now discloses the hard-disable up front. changelog.d/969.fixed.md names the user-visible change: anyone with git_reconcile.enabled=true sees no more automatic reconcile until #969's real fix ships. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…port_error() oss:auditor self-review on the kill switch itself (Class A, absence the caller cannot read): the notice was a bare `echo ... >&2`, not routed through `report_error()` like every other notice in this hook file. `log()`/`report_error()` write by path to the daily log and hook-errors.log specifically so a hook's own disablement is never invisible to `/remember:doctor`'s "Recent errors" -- a hook that was silently skipped (#252) is the exact failure mode `report_error()` exists to close, and a raw echo reproduced it for this hook's own hard-disable. Switched to `report_error()`, and TestHardDisabledPending969 now asserts the notice reaches both the daily log and hook-errors.log instead of asserting on captured stderr, which the production dispatch path never routes anywhere persistent. Explore's self-review also found that hooks.d/after_save/50-git-backup.sh and scripts/user-prompt-hook.sh still describe the OLD "git_reconcile may act automatically" behavior -- now false while the kill switch is in place. Not fixed here: 50-git-backup.sh's wording is pinned by tests/test_git_backup_push_rejected_253.py::TestTheRejectionNoticeRespectsReconcile (#935), and correcting it needs that test class rewritten too -- a second file's protected test contract, past this diff's blast radius. Logged to trap.d/969.stale-reconcile-prose-not-updated.md for /oss:curate. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…#967) Logged from the v0.42.1 release's gate 3 security audit (round 1): swallowed git diff --name-only errors leaving _checkout_ok set with an empty touched-path list, and core.quotePath leaving non-ASCII restore-set paths unmatched. Both rank misreports (non-blocking); the blocking destroys-class finding from the same audit is filed separately as #966. Co-authored-by: Claude Sonnet 5 <[email protected]>
This was referenced Oct 7, 2026
fdaviddpt
added a commit
that referenced
this pull request
Oct 8, 2026
…977) trap.d/ held 11 fragments from the v0.42.0/v0.42.1 release gate-3 audits and the #969 kill-switch lane's own self-review. One (#881's Unicode line- separator gap in the anti-log-injection control-char regex) is promoted to a standing jit-context rule, scoped to pipeline/log.py and scripts/log.sh -- proven to fire on pipeline/log.py and stay silent on an unrelated file. The other ten are declined as rules (each a scoped, single-site fix rather than a generalizable lesson) and re-verified against HEAD: - #888 (v1 cache-path substring substitution), #913 (SESSION_DIR cache keyed on the wrong variable) and #918 (lost rotate-credential advice) are each still true and each filed as its own issue (#972, #973, #974). - #952 (two fragments), #953 and #966 all describe defects in 60-git-reconcile.sh's rebase/restore code, now hard-disabled (#969/#970) -- still present but unreached. Consolidated into one pre-re-enable checklist (#975) rather than four separate issues, since all four gate the same future event. - #969 (two fragments) are both fallout from the same hard-disable landing without its downstream prose/log cleanup -- consolidated into one issue (#976). - #951 (a macOS CI flake investigation on a since-closed PR) is stale: the file and hook it investigated have both been substantially rewritten since (#966, #969/#970). No issue filed; a fresh investigation would need to start from the current tree. Co-authored-by: Claude Sonnet 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #969.
This hook has produced a
destroys-class finding in 5 consecutive release audits (#932, #939, #946, #952, #966), each fix closing one race window and opening the next. Per the scheduler's recorded ruling in #969, this round does not attempt a sixth fix:hooks.d/after_save/60-git-reconcile.shnow callsreport_error("git-reconcile", "disabled pending #969 (destroys-class TOCTOU race); tracking issue has the real fix")thenexit 0, placed immediately after the twosourcelines and strictly before thegit_reconcile.enabledconfig read -- unconditional, not gated on that flag.Tests
New:
tests/test_git_reconcile_903.py::TestHardDisabledPending969::test_disabled_even_when_enabled_and_toctou_conflict_would_fire. A shimmed git injects a foreign write at thegit rebase --no-autostashcall itself -- the exact window #969 says is still open, earlier than #966's own shim atrebase --quit. Asserts exit 0, the notice naming #969 in both the daily log and hook-errors.log, the foreign file untouched, HEAD unchanged, no rebase-merge state, no reconcile lock.RED confirmed twice (via
git stash push -- hooks.d/after_save/60-git-reconcile.sh, re-run,stash pop): fails because the pre-#969 hook runs normally and never emits any #969 notice.GREEN:
python3 -m pytest tests/test_git_reconcile_903.py tests/test_git_reconcile_mapfile_floor_952.py -q --no-cov=> 7 passed, 22 skipped, every skip reasoned and naming #969. Targeted scope only -- this machine is reportedly too slow for the full localpytest; CI is the matrix gate.6 whole test classes in
tests/test_git_reconcile_903.pyand 1 test function intests/test_git_reconcile_mapfile_floor_952.pyare skip-marked (not deleted) as documentation of intended reconcile/conflict/restore/NDC-bump behavior, for when #969's real fix lands and the kill switch is removed.Docs / changelog
docs/configuration.md'sgit_reconcile.enabledrow now leads with the hard-disable disclosure naming #969.changelog.d/969.fixed.mdadded.README.mdhas zero mentions of this hook (the repo's onlydocs_targetsentry) and needed no change.Self-review
Two full rounds (Explore + oss:auditor concurrently, tree_snapshot clean both times). Round 1: Explore found stale reconcile-enabled prose in
hooks.d/after_save/50-git-backup.shandscripts/user-prompt-hook.sh-- stale prose logged to trap.d/969.stale-reconcile-prose-not-updated.md rather than fixed in this diff, because 50-git-backup.sh's wording is pinned by a protected #935 test contract. oss:auditor found the kill-switch notice was a bareecho >&2, invisible to the daily log / hook-errors.log -- fixed in the follow-up commit by routing throughreport_error(). Round 2 (mandatory perfix_commit_scope.py's needs-second-pass) returned no findings.TestOffByDefault's own docstring framing is slightly stale but not worth its own diff -- it calls itself a "positive control for every other test in this file," and now that the 6 must-fire classes it paired against are skipped, TestHardDisabledPending969 is arguably the more relevant pairing, but TestOffByDefault's own assertions remain independently true and non-vacuous.
[AI-generated]