Repository navigation
Description
Found by the round-one release audit of v0.23.0..9f3269e before tagging 0.24.0. Ranked containment (read), which the ranking table marks blocking: the 0.24.0 tag does not move until this lands.
Neither commit contains the defect. b909b8f (#407/#409) introduced the variable; a019b64 (#405/#417) three commits later introduced the rule that a hook with no stdin payload of its own must clear an inherited path variable -- and applied it to REMEMBER_HOOK_CWD only. It exists only in the composition, which is what a per-PR review cannot see.
Symptom
A REMEMBER_TRANSCRIPT_PATH set anywhere in the ambient environment -- a .envrc in a cloned repo, a modified dotfile -- names a file that is read and summarised into the memory store. hooks.d/after_save/50-git-backup.sh then commits and pushes that store, so the contents leave the machine.
Location
pipeline/host.py:147-165 -- the whole gate is existence:
value = (env.get(TRANSCRIPT_PATH_VAR) or "").strip()
if not value:
return None
if not os.path.isfile(value):
return None
return valuepipeline/extract.py:158-160 -- find_session() opens with supplied = _host.transcript_path() / if supplied: return supplied, short-circuiting before _validate_session_id() (:138-140, which rejects /, \ and ..) and before _session_dir(project_dir).
scripts/post-tool-hook.sh:129 and scripts/user-prompt-hook.sh:68 -- each carries unset REMEMBER_HOOK_CWD and nothing else. Both reach save-session.sh (post-tool-hook.sh:339). Verified on main: grep REMEMBER_TRANSCRIPT_PATH scripts/ matches only session-start-hook.sh and session-end-hook.sh, which set it from their own stdin payload and validate it.
Mechanism
session-start-hook.sh:224 overwrites the variable from the payload, so a session that starts normally is fine. post-tool-hook.sh and user-prompt-hook.sh have no transcript_path of their own to offer and never clear the inherited one -- and they are the hooks that trigger the routine saves. session-start-hook.sh:701 already unsets it for the recovery spawn, so the pattern exists in this codebase; it was simply not applied here.
The audit's control, using the shape of tests/test_hook_cwd_leak_417.py:
--- scripts/post-tool-hook.sh preamble ---
HOOK_CWD=cleared
TRANSCRIPT=/var/folders/.../victim.jsonl
--- scripts/user-prompt-hook.sh preamble ---
HOOK_CWD=cleared
TRANSCRIPT=/var/folders/.../victim.jsonl
and end to end: REMEMBER_TRANSCRIPT_PATH=/etc/hosts makes host.transcript_path() return /etc/hosts, and find_session(session_id="../../etc/passwd") returns /etc/hosts -- the traversal validator never runs.
Not established: a cross-hook environment-reuse leak on a live Claude Code host. That is the same reachability #417 declared unestablished, and the same answer applies -- the unset is correct regardless, because neither hook has a payload of its own to offer. What is established is that the value is trusted with no containment and bypasses an existing validator.
What would settle it
Either unset REMEMBER_TRANSCRIPT_PATH in the two hooks that have no payload to offer -- matching what #417 already did for its sibling -- or a containment check inside host.transcript_path() against the expected transcript directory. The audit prefers the chokepoint framing; the fix belongs where the boundary is, not at the backup path.
A test needs the must-fire case (a pre-set variable does not survive into the spawned save) paired with the must-not-fire control (a payload-supplied path still works).
Activity
fix: decide and document the transcript-path trust boundary for manua…
fix: #417/#424 hook-leak security tests no longer skip the whole Wind…
Clear a leaked REMEMBER_TRANSCRIPT_PATH in post-tool/user-prompt hook…
test(#900): run the #417/#424 preamble from a file, not bash -c
test(#900): run the #417/#424 preamble from a file, not bash -c
test(#900): run the #417/#424 preamble from a file, not bash -c
test(#900): run the #417/#424 preamble from a file, not bash -c