Repository navigation
Conversation
…de too write-handoff.sh's #750 tracked-target guard refused a `tracked` or `unavailable` target but fell through silently for `symlinked-ancestor` -- a state the read-side injection guard (_remember_may_inject, lib-memory-context.sh) already refuses. A repository could commit `.remember` as a symlink pointing anywhere its author chose, and /remember would write straight through it while reporting success, reproducing the "reports success, then silently refuses on read" shape #750 was meant to close. Fix: extract the refused-states list into _REMEMBER_REFUSED_TRACKED_STATES + _remember_tracked_state_is_refused() in lib-memory-context.sh, a single source of truth both guards consult, and have write-handoff.sh's case use it instead of its own independent copy of the list. TDD: tests/test_write_handoff_tracked_target_750.py gains TestSymlinkedAncestorIsRefused (planted symlinked .remember, plus a positive control that an ordinary untracked target is still written). Red: 1 failed, 3 passed (script wrote through the symlink, exit 0). Green: 4 passed. Adjacent read-side and repo-wide scanner tests (test_injection_guard_ancestor_symlink.py, test_locale_ranges_695.py) re-run green, 9 passed. Observed on macOS; symlink handling on Windows Git Bash is not exercised by this suite (reasoned, not observed), consistent with the existing platform skip on this test file. Changelog fragment added; README has no write-handoff/symlink content, no-change-needed. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…state list Self-review (Explore and oss:auditor, spawned independently, converged on the same finding): the previous commit's _REMEMBER_REFUSED_TRACKED_STATES / _remember_tracked_state_is_refused() in lib-memory-context.sh was only wired into write-handoff.sh. _remember_may_inject (the read-side guard) kept its own independent, hand-written case over the same three states, with an unconditional `(*) return 0` default -- the exact "two lists that can drift" hazard #799 fixed on the write side, just left standing on the read side, and in the more dangerous direction (a future unmatched state would be silently INJECTED, not silently written). Fix: _remember_may_inject now gates on _remember_tracked_state_is_refused first, keeping its existing per-state messages, with a new default arm that refuses (fails closed) any refused state the inline case does not separately name -- mirroring write-handoff.sh's own defensive default arm. Verified: full read-side + write-side guard suites re-run green (34 passed): test_write_handoff_tracked_target_750.py, test_injection_guard_ancestor_ symlink.py, test_injection_guard_754_755_756.py, test_locale_ranges_695.py. No behavior change for the three states that exist today (tracked, unavailable, symlinked-ancestor all still refused, everything else still delivered) -- confirmed by these suites, not just reasoned. A second, non-blocking self-review finding (the new test's Windows skip reason is stale, mirroring an already-documented issue with a sibling test file's identical blanket skip) is logged to trap.d/799.windows-skip-reason- stale.md rather than fixed here -- it touches files outside this diff's blast radius and needs a design decision on how to narrow it. 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.
write-handoff.sh's #750 tracked-target guard refused only the
trackedandunavailablestates returned by_remember_file_tracked_state_into. That helper also returnssymlinked-ancestor, which the read-side guard (_remember_may_inject) already refused -- so a repo that committed.rememberas a symlink could have/rememberwrite straight through it while reporting success, the same "reports success, then silently refuses on read" shape #750 was meant to close.Closes #799
What changed
_REMEMBER_REFUSED_TRACKED_STATES, and a helper_remember_tracked_state_is_refused()inscripts/lib-memory-context.sh.scripts/write-handoff.shnow gates on that helper before its refusalcase, coveringtracked,unavailable,symlinked-ancestor, and a defensive default that also refuses._remember_may_inject(), still carried its own independent copy of the same three-state case ending in an unconditional allow-through default -- meaning a future state added to the shared list without also touching that second case would make the read side the one that silently let it through. Fixed in the same PR:_remember_may_inject()now gates on the same shared helper first, keeps its existing user-facing messages, and fails closed on an unrecognised state instead of falling through to allow it.Testing
TDD: a new test class plants
.rememberas a symlink to an outside directory and asserts refusal plus that the file is never created through the symlink, paired with a positive control (an ordinary untracked.remember, still written). Before the fix this failed (script wrote through the symlink and exited 0); after,tests/test_write_handoff_tracked_target_750.pyplus the adjacent guard/locale suites are green (34 tests after both commits).bash -n scripts/lib-memory-context.shpasses. The fullpytestsuite was not run, per this repo's convention of running it locally on demand rather than as a merge gate.🤖 Generated with Claude Code
[AI-generated]