Skip to content

fix: unquote literal quotes, guard the start cache, refuse laundering tracked content (#780, #781, #782) - #783

Merged
fdaviddpt merged 5 commits into
mainfrom
fix/780
Sep 26, 2026
Merged

fdaviddpt merged 5 commits into
mainfrom
fix/780

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

What

Three injection-guard bypasses, all in the same release delta, all found by the release-auditor:

Self-review

Two rounds. Round 1 (Explore + oss:auditor, concurrent) found and fixed 4 issues: an unconditional directory-scaffold mkdir that defeated the #782 migration-refusal retry path by permanently creating the target directory; an exact-case ls-files pathspec in the #782 scan that a case-insensitive filesystem (macOS default, Windows) could bypass, fixed with icase pathspec magic; a #781 test that did not isolate its two new checks from each other; and a Windows-unsafe bash-literal in a new test helper. Round 2 (a single lightweight oss:auditor re-audit of the fix commit, per this repo own fix_commit_scope verdict) found nothing further, with one informational platform note graded as already covered by CI.

Tests

Each of the three fixes has its own red-then-green TDD cycle plus a positive control per bug. Full detail -- exact pytest invocations, exact failure messages, the three-round #782 fix-iteration history -- is in this run own working note, not repeated here.

tests.full

not-run -- narrowed to the touched-file suites plus this repo own cross-cutting scanner tests, per its own narrowed-never-full convention; CI 13-leg matrix (3 OSes x 4 interpreters) is the source of truth for the whole suite.

Tooling friction (non-blocking, filed here rather than as separate issues)

  • tooling: a raw grep/cat/sed -n/head/tail at command position is blocked by a JIT rule
  • tooling: supertool default cwd silently resolved against the main clone
  • tooling: supertool edit at dash refuses a payload with an even run of backslashes
  • tooling: git commit -m is blocked in favor of supertool git-commit
  • tooling: a raw git worktree list is blocked in favor of supertool git-worktrees

Closes #780, Closes #781, Closes #782

🤖 Generated with Claude Code

[AI-generated]

fdaviddpt and others added 5 commits September 26, 2026 10:28
…refuse laundering tracked content

- #780: `_remember_git_unquote_into`'s `printf '%b'` did not know the
  two-character escape `\"` -- a tracked path with a literal double-quote
  byte still bypassed the injection guard. Pre-translate `\"` into the
  octal escape `\042` before calling `%b`. Bumps
  `_REMEMBER_CACHE_FORMAT_VERSION`.
- #781: `_remember_start_cache_context_load` served a cache hit without
  ever consulting the injection guard, letting a repository-committed
  cache pair (manifest with only a `VERSION=` line, zero `SRC=` lines)
  bypass it entirely. The loader now runs `_remember_may_inject` on the
  cache and manifest files themselves, and refuses a manifest naming zero
  `SRC=` lines.
- #782: the legacy-store migration held back only a tracked `config.json`,
  laundering every other tracked file (e.g. a planted `now.md`) into the
  external store the injection guard exempts by design. The migration now
  scans for any git-tracked content beyond `config.json` and refuses the
  whole migration (fail-closed on `could-not-tell`) rather than moving it.

Closes #780, Closes #781, Closes #782

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ows bash

Three defects found across the two review spawns (Explore, oss:auditor) of
9e3b867, all in the #782 fix:

- The tracked-content scan used an exact-case `ls-files -- ".remember/"`
  pathspec, unlike every sibling tracked-file check in this codebase (which
  deliberately uses `:(icase)`). On a case-insensitive filesystem (macOS,
  Windows), a repository committing `.Remember/now.md` resolved to the same
  on-disk directory this migration operates on, and the scan saw nothing
  tracked -- reopening the exact laundering #782 closes, gated only on
  filesystem case-sensitivity. Fixed with `:(icase)` and a case-insensitive
  compare against the excluded config.json path (inlined locally --
  `_remember_ci_eq` is not sourced into bootstrap-dirs.sh's context; the
  first attempt called it anyway and silently misclassified config.json
  itself as tracked content on every run, caught by the existing symlinked-
  config test going red).
- The unconditional directory-scaffold step further down in
  bootstrap-dirs.sh created REMEMBER_DIR as an empty scaffold even when the
  migration was refused for tracked content, permanently satisfying the
  migration guard's own `[ ! -e "$REMEMBER_DIR" ]` and silently defeating
  the "start a new session to retry" instruction the refusal message
  itself prints. Fixed by gating that scaffold step on a new
  `_remember_legacy_migration_refused` flag.
- A new test (`_session_start_full`) spawned the literal `"bash"` rather
  than the already-resolved `_BASH` constant every sibling call in this
  test suite uses -- on Windows, plain `"bash"` resolves to the System32
  WSL launcher, not Git Bash. Fixed to reuse `_BASH`.

Also strengthens the #781 zero-SRC-lines test with a sibling case that
isolates the `_remember_may_inject` calls from the independent
`_mf_saw_src` check (both land in the same diff and either alone would
have made the original test pass).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
… control

The macOS legs failed test_untracked_cache_inside_a_git_repo_is_still_served
with load returncode 1. The #781 guard is not at fault: under /bin/bash 3.2
_remember_may_inject reports not-tracked and returns 0 for both files. The
miss comes from `[ "$_cache" -nt "$_src" ]` (scripts/lib-memory-context.sh:1021).
bash 3.2 compares mtimes in whole seconds, so a publish in the same second as
the source write is a tie, and a tie is a deliberate miss (#668). bash 5
compares nanoseconds, so the test passed under Homebrew bash.

Forward the cache mtime by 5s, as the sibling positive case already does.
Also assert the manifest names the source, so the hit cannot come from an
empty -nt loop. No change to the library or the guard.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
On windows-latest the manifest holds the source path with mixed separators
(C:\...\project/.remember/core-memories.md) while str(core) is all
backslashes, so the substring check missed. Normalise backslashes to '/'
on each SRC= line and on str(core), then require an exact match for one
line. Still an exact-path positive control, not an endswith.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… positive control

On every windows-latest leg, test_inproject_store_still_refuses_the_same_tracked_file
got out == "" with exit 0. _session_start_full passed str(SESSION_START_SCRIPT), which
is all backslashes on Windows; the hook derives its own directory with
_HOOK_DIR="${BASH_SOURCE[0]%/*}", which only splits on "/", so _HOOK_DIR fell back to
"." and `source "$_HOOK_DIR/resolve-paths.sh" || exit 0` left silently before the
injection guard ever ran. The "PLANTED-BY-REPO not in out" assertion was passing
vacuously on Windows for the same reason.

Same root cause and same fix as #669 round 5 / #712: SESSION_START_SCRIPT.as_posix().
hooks.json joins ${CLAUDE_PLUGIN_ROOT}/scripts/... with "/", so the real host is
not affected. No assertion changed, no skip added.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@fdaviddpt
fdaviddpt merged commit e194810 into main Sep 26, 2026
16 checks passed
@fdaviddpt
fdaviddpt deleted the fix/780 branch September 26, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment