Repository navigation
Fix yarn berry exec:/git copies escaping VEX (#1630) - #1644
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
A yarn berry dependency built by an exec: script, or cloned from a git remote that isn't http(s), installs a package under the dependency name the depender gave it. The lock records only its version, not which package it is, and socket-patch skipped these entries entirely. So when such a copy held the patched name@version, hosted and vendored scans said nothing, and vex attested the package not_affected while node_modules shipped the unpatched copy. These entries are now read as copies whose package can't be known, like a non-registry URL tarball: possibly any package at their lock version. vex withholds a wiring of that version in the same lock (patched_ref_unattributable), and both scans name the copy (redirect_copy_unpatched / vendor_copy_unpatched). Fixes #1630 Assisted-by: Claude Code:claude-opus-5-5
The hosted scan now warns (redirect_copy_unpatched) when a yarn berry lock installs an exec: script or a git+ssh remote under another dependency name at the pinned version. Before the fix the scan reported a clean success while node_modules/lp2 stayed unpatched. A copy at another version is not named. Assisted-by: Claude Code:claude-opus-5-5
An exec: reference now goes through the same selector and binding parsing as file:, portal: and link:, so a later fix to that parsing reaches all four. Doc comments that list which lock entries count as copies now include exec: scripts and git remotes, and the user docs say the git case is berry-only. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
1 similar comment
|
BugBot review Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d96f49a. Configure here.
|
Ready for review at
Generated by Claude Code |
Final review briefWhat it does. Yarn berry lock entries that install a package under another dependency name from an Risk: low. Additive parsing in one function plus two new enum variants; the change fails closed (more VEX contests, more warnings), never fewer. Look here
Verified
Changes I made: none. Open questions: none blocking. The description lists three deliberate non-changes: yarn classic git copies, fail-closed for unknown protocols, and same-name git/ Auto-merge (squash) is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Fixes #1630
Root cause
berry_copy_ref(crates/socket-patch-core/src/formats/yarn/copy.rs) read a yarn berry lock entry as a "copy under another dependency name" only when its reference wasfile:,portal:,link:or started withhttp. Anexec:generator entry, and a git entry whose remote isn't http(s) (git+ssh://,ssh://,git://,git@host:), returnedNone, so:vex/discover/yarn.rsberry_block) skipped it silently, and the wired ref was attestednot_affected;redirect_copy_unpatchedwarning, which is fed by discovery, never named it;other_name_copiesnever named it (vendor_copy_unpatched).Fix
exec:and non-http git references are now read as copies whose package can't be read, like a non-registry url: possibly any package at the lock's version. That contests a wiring of the same version (patched_ref_unattributable), and both scans name the copy.exec:paths share thefile:/portal:/link:selector andlocator=parsing.Tests (per issue)
exec:copy of the patched package under another dependency name, so hosted and vendored scans succeed and VEX attests not_affected while that copy installs unpatched #1630, parsing:formats::yarn::copy::tests::issue_1630_exec_and_git_refs_are_unread_copiesexec:copy of the patched package under another dependency name, so hosted and vendored scans succeed and VEX attests not_affected while that copy installs unpatched #1630, VEX discovery:vex::discover::yarn::tests::issue_1630_exec_and_git_copies_contest_a_vendored_ref(control: the same copy at 2.0.0 doesn't contest)exec:copy of the patched package under another dependency name, so hosted and vendored scans succeed and VEX attests not_affected while that copy installs unpatched #1630, vendored scan:vendor::yarn_berry_lock::tests::issue_939_other_name_copies_are_namedgainedexec:andgit+ssh:casesexec:copy of the patched package under another dependency name, so hosted and vendored scans succeed and VEX attests not_affected while that copy installs unpatched #1630, hosted scan:hosted_memory_engine::issue_1630_berry_exec_and_git_copies_are_named(control at 2.0.0). It fails onmain's core (redirect_copy_unpatchedmissing) and passes with the fix.Commands run locally on d96f49a:
cargo fmt --all -- --check✅,cargo clippy --workspace --all-features -- -D warnings✅,cargo test -p socket-patch-core --all-features --lib6567 passed / 4 failed,cargo test -p socket-patch-cli --all-features --lib --test hosted_memory_engine✅, all yarn CLI test binaries (non-ignored) ✅. The 4 core failures are chmod-based permission tests (copy_treerelax loop,vlt_healunremovable lock, poetry/requirements wire-failure rollback) that can't fail a write when run as root, as this sandbox does. They don't touch yarn. A fullcargo test --workspaceran out of the sandbox's disk, so CI covers the docker/e2e suites.Code review (/code-review high) and what was not changed
exec:parsing, now shared with thefile:/portal:/link:cascade; stale doc comments listing the copy kinds.classic_blockrecords them aspkg:npm/<dep-name>@<version>rather than as an unidentified copy, andother_name_copiesfilters classic git out. Yarn berry ignores anexec:copy of the patched package under another dependency name, so hosted and vendored scans succeed and VEX attests not_affected while that copy installs unpatched #1630 is berry-only, so this PR doesn't widen to classic. The docs now say the git case is berry-only.berry_copy_reffail-closed for unknown protocols (plugin resolvers). That is a policy change beyond Yarn berry ignores anexec:copy of the patched package under another dependency name, so hosted and vendored scans succeed and VEX attests not_affected while that copy installs unpatched #1630.exec:entry under the patched package's own name now contests in VEX but isn't named by vendoredother_name_copies(same-name filter). That already happens for same-namefile:/url entries onmain, and VEX failing closed is the safe side.https://claude.ai/code/session_01BgnkbqbEMV3JkJWHCPzG6E
Generated by Claude Code