Repository navigation
Conversation
…l callers (#431) Closes the remainder of #424's containment (read) row. The two per-tool-call hooks (#430) stay the hardened boundary; a manual save-session.sh run, doctor.sh, and a direct pipeline.extract invocation trust the ambient REMEMBER_TRANSCRIPT_PATH by design -- documented in pipeline/host.py, pipeline/extract.py and README.md, with doctor.sh now warning loudly when it finds the variable set rather than staying silent about it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
- doctor.sh's REMEMBER_TRANSCRIPT_PATH warning moved ahead of path resolution, so an unresolvable install does not also silence it via resolve-paths.sh's own early exit -- it did before. - the warning strips control characters from the value before printing it, so an embedded newline cannot forge a second report line. - host.py's docstring and README.md now give the sharper reason a containment check was rejected: transcript_path()/find_session() is the one channel both a legitimately-supplied and an ambient value travel through, so a check narrow enough to matter would also reject the legitimate one; and the "known session store" is Claude-Code-specific, not host-neutral, contradicting the earlier "never under the project" overstatement. - the new test file's win32 skip is now scoped per-test instead of module-wide, since one test never touches bash or the filesystem. Found by this branch's own self-review (Explore + oss:auditor) before handoff. Co-Authored-By: Claude Opus 5 (1M context) <[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 #431.
Closes the remainder of #424's
containment (read)row, the one item still blocking 0.24.0 after #430 hardened the two hooks with notranscript_pathof their own to offer.The decision
No containment check was added inside
pipeline/host.transcript_path()/pipeline/extract.py'sfind_session(). That function is the ONE channel both a legitimately-supplied value (fromsession-start-hook.sh/session-end-hook.sh's own validated stdin payload, exported fresh on every run) and an untrusted ambient one travel through. A containment rule narrow enough to actually matter -- restricted to the project directory, or toCLAUDE_CONFIG_DIR/~/.claude-- would also reject the legitimate value on a host or a mount this repo does not model:CLAUDE_CONFIG_DIRis itself relocatable (#166) and is Claude Code's own layout, not a Codex- or Gemini-neutral one, which is exactly the host-specific seampipeline/host.py's own module docstring already declines to invent. Trusting wherever the host says the transcript lives, rather than reconstructing or gating it, is the whole point of #407 -- reconstruction is what #157/#174/#263 got wrong.So the decision is #424's second option: a caller with no hook preamble of its own -- a manual
scripts/save-session.shrun,scripts/doctor.sh, a directpython3 -m pipeline.extract-- trusts the ambient environment by design, the same way it already trusts$PATHor$HOME. The hooks that run on every tool call with no human watching stay the hardened boundary.That decision is now written down rather than left implicit:
pipeline/host.py's andpipeline/extract.py's docstrings and the README's transcript-path section state which callers are hardened and which are trusted, and why.scripts/doctor.shnowWARNs -- naming the value, with control characters stripped so it cannot forge a second report line -- when it findsREMEMBER_TRANSCRIPT_PATHalready set in its own environment, checked ahead of path resolution so an unresolvable install does not also silence it.Self-review
Both the
Explorereviewer andoss:auditorran against the first commit and returned real findings, addressed in a second commit:CLAUDE_CONFIG_DIR/HOMEcontainment check as a cheap middle ground. Investigated and rejected --CLAUDE_CONFIG_DIRis Claude-Code-specific (confirmed by the very comment the reviewer cited), so gating on it would break legitimate Codex/Gemini transcripts, and a broader$HOMEcontainment would break the existingtest_supplied_transcript_path_is_used_verbatimpositive control, which deliberately supplies a path outside$HOMEto represent a legitimate host-reported location on a different drive/mount. Full argument is inpipeline/host.py's docstring.CLAUDE_CONFIG_DIRis user-relocatable; that one is fixed (below), but the underlying observation that these docstrings assert absolutes about host behaviour this repo cannot fully verify (Codex/Gemini transcript layouts are simply not known here) is a standing property of the whole module, not a defect introduced by this diff, and there is no single call site to point a fix at.doctor.sh's new WARN sat afterresolve-paths.sh's own earlyexit 0on failure, so it silently never fired on an unresolvable install -- moved earlier, confirmed red-then-green.doctor.sh's own--jsonbranch's_json_escape()(added for No way for an external caller to resolve a {slug}-keyed external store without reimplementing session_dir_slug #408 for exactly this reason) -- an embedded newline could forge a second report line. Piped throughtr -d '[:cntrl:]'.Test plan
tests/test_transcript_path_trust_431.py(new, 6 tests) -- watched fail before the fix, pass after, for both the doctor.sh ordering and control-character findings (temp-swappedscripts/doctor.shback to the pre-fix version, confirmed red, restored, confirmed green)python3 .oss/assemble_changelog.py --checkpasses with the newchangelog.d/431.security.mdfragment