Skip to content

Fix yarn berry exec:/git copies escaping VEX (#1630) - #1644

Open
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
mainfrom
agent/fix-yarn-berry-exec-git-copies
Open

Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
mainfrom
agent/fix-yarn-berry-exec-git-copies

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

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 was file:, portal:, link: or started with http. An exec: generator entry, and a git entry whose remote isn't http(s) (git+ssh://, ssh://, git://, git@host:), returned None, so:

  • lockfile discovery (vex/discover/yarn.rs berry_block) skipped it silently, and the wired ref was attested not_affected;
  • the hosted engine's redirect_copy_unpatched warning, which is fed by discovery, never named it;
  • the vendored backend's other_name_copies never 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 the file:/portal:/link: selector and locator= parsing.

Tests (per issue)

Commands run locally on d96f49a: cargo fmt --all -- --check ✅, cargo clippy --workspace --all-features -- -D warnings ✅, cargo test -p socket-patch-core --all-features --lib 6567 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_tree relax loop, vlt_heal unremovable 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 full cargo test --workspace ran out of the sandbox's disk, so CI covers the docker/e2e suites.

Code review (/code-review high) and what was not changed

https://claude.ai/code/session_01BgnkbqbEMV3JkJWHCPzG6E


Generated by Claude Code

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
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 20, 2026 23:15
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

1 similar comment
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 21, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

Ready for review at d96f49a.

  • CI: 86/86 settled on the head, 36 success, 50 skipped, no failures.
  • Bugbot: reviewed d96f49a, no findings. No open review threads.
  • Mergeable, no CHANGELOG.md change.
  • Reviewers: the PR description lists three deliberate non-changes (yarn classic git copies, fail-closed for unknown protocols, same-name git/exec: entries); those are the calls worth a second opinion.

Generated by Claude Code

@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

Final review brief

What it does. Yarn berry lock entries that install a package under another dependency name from an exec: script or a non-http git remote (git+ssh:, ssh:, git:, git@host:) were ignored, so VEX could attest a vendored ref not_affected while node_modules/<alias> still got unpatched bytes. These are now read as copies whose package can't be known (like a non-registry URL): they contest a same-version wiring in VEX, and both the hosted and vendored scans name them.

Risk: low. Additive parsing in one function plus two new enum variants; the change fails closed (more VEX contests, more warnings), never fewer. exec:/git copies are never read from disk (read_path is None), and git URLs go through redact_url before they're printed.

Look here

Verified

  • Read the full diff (7 files, +260/-47). patch:-wrapped and workspace: refs still return None. exec: resolutions (exec:./gen.js#./gen.js::hash=…&locator=…) resolve relative to the locator= workspace.
  • Ran locally on d96f49a: cargo test -p socket-patch-core --lib -- issue_1630 issue_939_other_name_copies, 3/3 passed.
  • CI: 86/86 settled (36 success, 50 skipped by path filters). Cursor Bugbot: success, no findings. No open review threads. CHANGELOG.md untouched. Mergeable.

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/exec: entries not being named in the vendored scan. Each is a fair follow-up, not a blocker.

Auto-merge (squash) is armed, so approving sends this straight to the merge queue.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

2 participants