Repository navigation
fix(security): apply_patch paths stay inside the working directory (GHSA-pw64-v3mg-xxmm) - #942
Conversation
…HSA-pw64-v3mg-xxmm) host_patch._resolve joined the patch path with the working directory and resolved it without a containment check, so an Update or Delete of a traversal path (../../../etc/hostname), an absolute path or a symlink leading out made the hook read that file as the operation's preimage. _resolve now refuses any path that resolves outside cwd with HostEventError, so patch_events produces no event for it, as it already does for any operation unsafe to translate. A real secret outside the project is never copied into an event: the 4 escape cases fail on the unfixed resolver and pass with the fix; a path inside the project is translated as before; 961 hook tests pass.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude finished @cdeust's task in 1m 31s —— View job Review of PR #942 done: no Blockers, verdict approve
Each Add, Delete and Update path, and each I could not run pytest, ruff or the craftsmanship gate here because those commands needed approval in this runner. The review comes from reading and tracing the code. Verdict: approve |
Review 1 of 3: PR #942 (GHSA-pw64-v3mg-xxmm)Reviewed at commit Blockers: none. Each Add, Delete and Update header, and each
The 4 escape tests would fail on the unfixed resolver. The existing hook tests use only relative paths inside Notes, no action before merge
Verdict: approve |
…tory (GHSA-pw64-v3mg-xxmm) Mutation gate on #942: 2 survivors in _resolve. The tests matched a substring of the escape message, so a reworded or wrapped message passed; they now match it exactly. Local gate (PostgreSQL 18.6): 0 judged survivors, 5 on untouched lines.
|
Claude finished @cdeust's task in 1m 13s —— View job Review 2 of 3: PR #942 (GHSA-pw64-v3mg-xxmm)
Blockers: none.
I could not run pytest, ruff or the craftsmanship gate here because those commands needed approval in this runner. I also could not post a separate comment with Notes, no action before merge
Verdict: approve |
Fix for GHSA-pw64-v3mg-xxmm (accepted, CVE requested). The advisory is published with 4.24.0. Developed and verified in the advisory's private fork.
host_patch._resolverefuses a Codexapply_patchpath that resolves outside the working directory, symlinks included, withHostEventError.patch_eventsthen produces no event, so the hook never reads an outside file as an operation's preimage.tests_py/hooks/test_host_patch_containment.pycovers a relative traversal (Update and Delete), an absolute path, a symlink leading out, and a path inside the project. The 4 escape cases fail on the unfixed resolver and pass with the fix. 961 hook tests pass.ruff: clean;check_craftsmanship.py: OK.