GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Yarn classic VEX attests not_affected while a bundled copy of the patched package@version stays unpatched (yarn.lock has no inBundle, so the #325 fix can't see it) · Issue #758 · SocketDev/socket-patch

Yarn classic VEX attests not_affected while a bundled copy of the patched package@version stays unpatched (yarn.lock has no inBundle, so the #325 fix can't see it) #758

New issue
Copy link
New issue
Copy link
Closed
#1712
Closed
Yarn classic VEX attests not_affected while a bundled copy of the patched package@version stays unpatched (yarn.lock has no inBundle, so the #325 fix can't see it)#758
#1712
Copy link
Labels
agent:triagedbugSomething isn't workingSomething isn't workingbughuntFound by a scheduled package-manager bug-hunt agentFound by a scheduled package-manager bug-hunt agentpm:yarn-classicYarn classic (1.x)Yarn classic (1.x)priority:p2

Description

@mikolalysenko
Mikola Lysenko (mikolalysenko)
opened on Oct 4, 2026
Issue body actions

[agent] Found by the scheduled Yarn classic (1.x) bug-hunt routine (ledger #304).

Summary

This is the yarn classic version of #325. A yarn classic project can install the same name@version twice: once from its normal yarn.lock block, and once bundled inside another package's tarball (bundledDependencies). yarn.lock never records bundled copies. It has no inBundle / bundled flag, and no block for the bundled copy at all. So socket-patch can't tell the copy exists:

  • Hosted, in-run (scan --mode hosted --vex): attests not_affected. The run gives no warning; npm's equivalent is redirect_npm_bundled_instance_skipped.
  • Vendored, in-run and post-install (socket-patch vex after a fresh yarn install --frozen-lockfile): attests not_affected. Post-install, it does print vendored_tree_out_of_sync, but the remedy it gives ("re-run your package manager's install to resync it") can't work, because yarn re-extracts the bundled copy from its parent's tarball.
  • Hosted post-install vex: correct. It hash-checks every installed copy and omits the purl as not_applied.
  • Agent mode: correct. It patches both copies.

PR #669 (the open #325 fix) only adds bundled_skipped_uuids for package-lock.json (inBundle / legacy bundled). The yarn classic rewriter never sets it, so the hosted in-run path stays as it is. #337's VEX-discovery fix also keys on package-lock's inBundle, so it doesn't cover yarn.lock either.

Impact

A false VEX statement. The shipped node_modules contains an unpatched copy of the vulnerable name@version (node_modules/<parent>/node_modules/<pkg>), and the OpenVEX document says not_affected / inline_mitigations_already_exist. Downstream scanners then suppress the finding. In vendored mode the result is the same whether or not the tree was reinstalled.

Repro

This uses a local mock patch API (--proxy-url / --patch-server-url / --vendor-url) serving a free patch for [email protected] that prepends a marker to index.js. The bundling parent is a local tarball here for brevity. yarn handles registry packages with bundledDependencies the same way.

# parent package that bundles [email protected]
mkdir -p bundsrc/package/node_modules/left-pad
tar xzf left-pad-1.3.0.tgz -C bundsrc/package/node_modules/left-pad --strip-components=1
echo '{"name":"bund","version":"1.0.0","dependencies":{"left-pad":"1.3.0"},"bundledDependencies":["left-pad"]}' > bundsrc/package/package.json
echo 'module.exports=require("left-pad")' > bundsrc/package/index.js
tar czf bund-1.0.0.tgz -C bundsrc package

mkdir proj && cd proj && git init -q && cp ../bund-1.0.0.tgz .
echo '{"name":"proj","version":"1.0.0","dependencies":{"left-pad":"^1.3.0","bund":"file:./bund-1.0.0.tgz"}}' > package.json
yarn install                                   # yarn.lock has no trace of the bundled copy
socket-patch scan --mode hosted --vex v0.json  # (or --mode vendored) + mock URLs
grep '"status"' v0.json                        # "not_affected", no warning in either mode
rm -rf node_modules && yarn install --frozen-lockfile
head -c 25 node_modules/left-pad/index.js                # /* SOCKET-PATCHED-HUNT */
head -c 25 node_modules/bund/node_modules/left-pad/index.js  # /* This program is free s  (unpatched)
socket-patch vex --output v1.json
# vendored: "not_affected" (+ vendored_tree_out_of_sync warning); hosted: purl omitted (correct)

Expected vs actual

  • Expected (README / CLI_CONTRACT on VEX, and the behaviour npm VEX attests not_affected while a bundled (inBundle) copy of the same package@version stays unpatched #325 / Bun hosted and vendored rewiring rewrites bundled: true lock entries that Bun never fetches: the bundled copy stays unpatched, scan reports success, and vendored vex attests not_affected #469 / Fix in-run hosted VEX attesting npm bundled copies (#325) #669 establish for npm and Bun): VEX must not attest a patch while an installed copy of that name@version is still unpatched. The in-run --vex should verify rather than assume, and the scan should warn that the bundled copy stays unpatched, as npm does with redirect_npm_bundled_instance_skipped / vendor_bundled_instance_skipped.
  • Actual: hosted in-run and vendored (in-run and post-install) both attest not_affected. Neither mode warns at scan time, and the vendored post-install warning gives a remedy that doesn't fix it.

Matrix (Linux, Node 22, main 045d7ec)

yarn hosted in-run --vex hosted post-install vex vendored in-run --vex vendored post-install vex scan-time bundled warning
1.7.0 not_affected (wrong) omitted (correct) not_affected (wrong) not_affected (wrong) none
1.10.1 not_affected (wrong) omitted (correct) not_affected (wrong) not_affected (wrong) none
1.22.22 not_affected (wrong) omitted (correct) not_affected (wrong) not_affected (wrong, ×2) none

Agent mode (scan --mode agent --vex) patches both copies and attests correctly (1.22.22). macOS and Windows weren't probed. The logic is OS-independent (lock-only rewriters plus VEX assembly).

Suspect code

  • crates/socket-patch-cli/src/commands/scan/hosted.rs:1262: assume_applied only drops uuids in rewrite.bundled_skipped_uuids, and rewrite_yarn_classic (crates/socket-patch-core/src/patch/redirect/mod.rs:3060) never fills it. It can't from yarn.lock alone; it would need the installed tree, or the parents' bundledDependencies.
  • crates/socket-patch-cli/src/commands/vex.rs:672-688: the vendored attestation stands on the committed artifact even when an installed copy differs. For a bundled copy, the "re-run your install" remedy is wrong, and the copy should block the attestation, as npm VEX attests not_affected while a bundled (inBundle) copy of the same package@version stays unpatched #325 does for npm.

Related: #325 (npm, fix in #669), #497 (Bun's version of the npm-only #326 fix), #601 (bundled copies in vlt/pnpm agent mode).

Activity

  1. Mikola Lysenko (mikolalysenko)
    added
    bugSomething isn't workingSomething isn't working
    bughuntFound by a scheduled package-manager bug-hunt agentFound by a scheduled package-manager bug-hunt agent
    pm:yarn-classicYarn classic (1.x)Yarn classic (1.x)
    on Oct 4, 2026
  2. Mikola Lysenko (mikolalysenko)
    added a commit that references this issue on Oct 4, 2026

    yarn-classic: run 15 ledger (filed #758)

    18967f3
  3. Mikola Lysenko (mikolalysenko)
    added
    agent:triaged
    priority:p1
    on Oct 4, 2026
  4. mikolalysenko commented on Oct 4, 2026

    @mikolalysenko
    Mikola Lysenko (mikolalysenko)
    on Oct 4, 2026
    CollaboratorAuthor
    More actions

    [agent] Related to open PR #669 (#325, npm inBundle). That PR only fills bundled_skipped_uuids from package-lock, so it does not fix this: yarn.lock has no record of bundled copies, so the yarn classic fix has to read the installed tree or the parents' bundledDependencies. Tracked as a separate cause.


    Generated by Claude Code

  5. mikolalysenko commented on Oct 5, 2026

    @mikolalysenko
    Mikola Lysenko (mikolalysenko)
    on Oct 5, 2026
    CollaboratorAuthor
    More actions

    [agent] Yarn classic bug-hunt re-triage (ledger #304): still reproduces on main 4646693, which has #669 (#325, npm bundled copies in hosted in-run VEX) and #605 (npm store copies in agent apply / vex). Neither covers yarn.lock.

    Same repro as the issue body, using the local mock API. Linux, Node 22:

    yarn hosted in-run --vex hosted post-install vex vendored in-run --vex vendored post-install vex bundled copy after --frozen-lockfile
    1.10.1 not_affected (wrong) omitted, exit 1 (correct) not_affected (wrong) not_affected (wrong) unpatched
    1.22.22 not_affected (wrong) omitted, exit 1 (correct) not_affected (wrong) not_affected (wrong) unpatched

    The scan still gives no bundled-copy warning in either mode.


    Generated by Claude Code

  6. mikolalysenko commented on Oct 7, 2026

    @mikolalysenko
    Mikola Lysenko (mikolalysenko)
    on Oct 7, 2026
    CollaboratorAuthor
    More actions

    [agent] Re-triage on main 05ecc6e (after #940): still reproduces on Linux, yarn 1.22.22, ×2.

    Same setup as the issue: root [email protected] plus a local file:./host-1.0.0.tgz whose bundledDependencies ships its own [email protected].

    step hosted vendored
    scan --vex in.json (in-run) exit 0, not_affected exit 0, not_affected
    vex with node_modules removed (lock-only) exit 0, not_affected exit 0, not_affected
    fresh yarn install --frozen-lockfile root copy patched, node_modules/host/node_modules/left-pad unpatched same
    vex after the install omitted (not_applied), correct exit 0, not_affected with a vendored_tree_out_of_sync-style warning telling you to re-run the install, which can't fix the bundled copy

    So #940's same-lock-copy check doesn't cover a bundled copy: the bundled copy has no lock block of its own. The scan still gives no warning.


    Generated by Claude Code

  7. mikolalysenko commented on Oct 8, 2026

    @mikolalysenko
    Mikola Lysenko (mikolalysenko)
    on Oct 8, 2026
    CollaboratorAuthor
    More actions

    [agent] Re-checked on main ea09714 (after #1033, which covers pnpm bundled copies but not yarn classic): still reproduces, ×2, on yarn 1.22.22.

    The project has a direct [email protected] plus bund (a file: tarball whose bundledDependencies includes left-pad 1.3.0). scan --mode hosted --vex vex.json --json exits 0 with only the berry-migration warning, and nothing mentions the bundled copy. The in-run VEX says not_affected. After a fresh yarn install --frozen-lockfile, node_modules/left-pad is patched and node_modules/bund/node_modules/left-pad is not. Post-install standalone vex correctly omits the package (not_applied, exit 1), as before.


    Generated by Claude Code

  8. mikolalysenko commented on Oct 9, 2026

    @mikolalysenko
    Mikola Lysenko (mikolalysenko)
    on Oct 9, 2026
    CollaboratorAuthor
    More actions

    [agent] Re-triage on main f3c6313 (after #1008, whose #828 change covers bundled copies in npm, Bun and vlt but not yarn classic): still reproduces, Linux, yarn 1.22.22, issue repro.

    Mode in-run scan --vex after fresh --frozen-lockfile post-install vex
    hosted not_affected, no warning node_modules/bund/node_modules/left-pad unpatched omitted (correct)
    vendored (×2) not_affected, no warning same not_affected

    Generated by Claude Code

  9. Mikola Lysenko (mikolalysenko)
    added
    priority:p2
    and removed
    priority:p1
    on Oct 9, 2026
  10. mikolalysenko commented on Oct 9, 2026

    @mikolalysenko
    Mikola Lysenko (mikolalysenko)
    on Oct 9, 2026
    CollaboratorAuthor
    More actions

    v5 triage: P2, not a release blocker. Retain the Yarn classic bundled-copy evidence limitation at P2; avoid expanding lockfile-only crawling into an archive inventory project for this release.

    This follows the maintainer's release scope: one normally completing CLI instance, prioritizing valid-lockfile patch/install behavior, compatibility, and actionable CLI UX.

  11. mikolalysenko commented on Oct 24, 2026

    @mikolalysenko
    Mikola Lysenko (mikolalysenko)
    on Oct 24, 2026
    CollaboratorAuthor
    More actions

    [agent] Claiming this issue (shared root cause: yarn classic hosted, vendored and lockfile-VEX paths read only yarn.lock, which never records copies unpacked from a parent's bundledDependencies, so nothing sees the unpatched bundled copy in node_modules). Branch: agent/fix-yarn-classic-bundled-copies. Claim-ID: 2026-10-24T10:21:10Z-ee2054


    Generated by Claude Code

  12. Mikola Lysenko (mikolalysenko)
    added
    agent:claimed
    on Oct 24, 2026
  13. mikolalysenko commented on Oct 24, 2026

    @mikolalysenko
    Mikola Lysenko (mikolalysenko)
    on Oct 24, 2026
    CollaboratorAuthor
    More actions

    [agent] Draft PR: #1712


    Generated by Claude Code

  14. Mikola Lysenko (mikolalysenko)
    added 2 commits that reference this issue on Oct 24, 2026

    Stop attesting yarn 1 bundled copies as patched

    This issue will close once commit 4b6ae5f is merged into the 'main' branch.
    4b6ae5f

    Cover yarn 1 bundles in workspaces and peers

    This issue will close once commit 44f1a19 is merged into the 'main' branch.
    44f1a19
  15. mikolalysenko commented on Oct 24, 2026

    @mikolalysenko
    Mikola Lysenko (mikolalysenko)
    on Oct 24, 2026
    CollaboratorAuthor
    More actions

    [agent] #1712 is ready for review. CI is green on 44f1a19 and Bugbot found no issues. When yarn.lock holds a Socket wiring, yarn classic discovery now reads bundled copies (bundleDependencies) from the installed node_modules, so vex and the in-run VEX no longer attest a package whose bundled copy stays unpatched. Hosted scans name the copy with redirect_copy_unpatched, and vendored scans name it with vendor_bundled_instance_skipped. One limit remains: a lock-only vex with no node_modules still can't see the copy, because yarn.lock has no trace of it.


    Generated by Claude Code

  16. Mikola Lysenko (mikolalysenko)
    closed this as completedin #1712on Oct 26, 2026
  17. Mikola Lysenko (mikolalysenko)
    removed
    agent:claimed
    on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:triagedbugSomething isn't workingSomething isn't workingbughuntFound by a scheduled package-manager bug-hunt agentFound by a scheduled package-manager bug-hunt agentpm:yarn-classicYarn classic (1.x)Yarn classic (1.x)priority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.