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 — Fix Bun/vlt bundled copies left unpatched (#469, #471) by mikolalysenko · Pull Request #472 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-opus-5-5

Fixes #469
Fixes #471

Summary

Bun and vlt projects whose dependency bundles the patched package (bundleDependencies) got a successful hosted/vendored scan, and VEX attested not_affected, while the copy the parent actually loads stayed unpatched. These copies are now skipped loudly by the rewriters and never attested by VEX, matching what #337 did for npm.

Root cause

#337 (#325) taught only the npm-lock paths that a bundled copy (unpacked from the parent's tarball) is never reached by a rewire. The Bun and vlt backends had no equivalent:

  • Bun (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): bun.lock records a bundled copy as its own parent/child entry with meta { "bundled": true }. bun.lockb marks the dependency edge with Bun's bundled behavior bit (0x40, verified against a real Bun 1.3.14 lock). Bun also shares ONE binary record between a regular and a bundled install of the same version. The hosted rewriter, the vendored rewriter and vex/discover/bun.rs all ignored this.
  • vlt (vlt hosted and vendored vex attests not_affected while a bundled copy of the same name@version in node_modules/.vlt stays unpatched (the #325 fix covers npm locks only) #471): vlt-lock.json records neither the bundled copy nor the parent's bundleDependencies (verified with real vlt 1.3.3). The copy exists only in the installed store at node_modules/.vlt/<parent id>/node_modules/<parent>/node_modules/<name>. vlt links real dependencies as symlinks beside the package, so a real directory inside a store package's node_modules is always a bundled copy.

Changes

  • vendor::bun_lock_text::is_bundled_entry: the shared bundled-meta check. It fails closed: a meta that won't parse but mentions "bundled" counts as bundled.
  • Bun hosted (rewrite_bun_lock, rewrite_bun_binary): a bundled entry or bundled-only record is skipped with redirect_bun_bundled_instance_skipped and is not counted or confirmed. A binary record shared with a regular install is still redirected for that install, with the same warning. Each skipped uuid lands in the new RewriteResult.bundled_skipped_uuids, and hosted scan --vex verifies those purls instead of assuming them applied (Bugbot finding).
  • Bun vendored (vendor::bun_lock, vendor::bun_binary): bundled entries and records are never rewired, with vendor_bundled_instance_skipped. When nothing else matches, vendoring refuses with vendor_lock_entry_not_rewritable, which names the real reason instead of "run bun install".
  • Bun VEX (vex/discover/bun.rs): a bundled entry or record is never a ref, even when Socket-wired. It contests same-name@version refs in the same lock and, via resolved_elsewhere, in other locks.
  • bun.lockb codec: BinaryPackage.bundled / bundled_only come from the dependency edges' behavior bits.
  • vlt (vendor::vlt_bundled, new): a bounded, confined walk of the store for bundled copies. VEX withdraws a ref whose name@version has one. Vendored warns, or refuses when the bundled copy is the only install. The hosted scan warns redirect_vlt_bundled_instance_skipped and withholds the purl from in-run VEX.
  • CLI_CONTRACT.md "Contested locks" now covers Bun and vlt.
  • New diagnostics and test messages don't print patch uuids or URLs (CodeQL).
  • The npm, pypi and gem wrappers only dispatch to the binary, so they need no change.

Test evidence

I watched every new regression test fail without its fix, then pass with it:

Issue Test Red without the fix
#469 bun.lock hosted patch::redirect::tests::bun_lock_bundled_entry_is_skipped_with_loud_warning ✔
#469 bun.lock vendored vendor::bun_lock::tests::bundled_entry_is_never_rewired ✔
#469 bun.lock VEX (hosted + vendored, both shapes, other-version control) vex::discover::bun::tests::bundled_entries_are_never_refs_and_contest_the_same_version ✔
#469 hosted in-run scan --vex in_process_redirect::scan_redirect_bun_bundled_copy_is_not_attested_in_run ✔
#469 bun.lockb codec vendor::bun_lockb::tests::bundled_edges_flag_their_records (real Bun 1.3.14 fixtures bun-lockb-bundled/{only,both}) n/a (new field)
#469 bun.lockb hosted patch::redirect::bun_binary::tests::bundled_records_are_not_redirected_silently ✔
#469 bun.lockb vendored vendor::bun_lock::tests::binary_bundled_records_are_never_silently_rewired ✔
#469 bun.lockb VEX vex::discover::bun::tests::binary_bundled_records_are_never_attested ✔
#471 vlt VEX (hosted + vendored, other-version control) vex::discover::vlt::tests::an_installed_bundled_copy_contests_the_ref ✔
#471 vlt vendored vendor::vlt_lock::tests::a_bundled_store_copy_is_reported_not_silently_left_unpatched ✔
#471 vlt hosted scan (CLI) in_process_redirect vlt::scan_redirect_vlt_bundled_store_copy_warns ✔

Local results:

  • cargo clippy --workspace --all-features -- -D warnings: clean.
  • cargo test --workspace --all-features --no-fail-fast: all pass except the tests that use chmod to force write failures. This sandbox runs as root, which bypasses them, and they pass on CI's non-root runners.
  • e2e_redirect_bun_build (16), e2e_vendor_bun_build (14) and e2e_bun_lockb (12) pass with --include-ignored against real Bun 1.3.14.
  • Goldens: the new bun-lockb-bundled discovery golden is added. The pdm and poetry equivalence goldens are re-blessed because they hash Debug output, which now includes the empty new field; their inputs are unchanged.
  • Formatting: main is not rustfmt-clean and CI has no fmt check, so this PR leaves untouched files alone. An earlier cargo fmt --all churn was reverted in 4a787fe.

Follow-ups

  • On a vlt project where the bundled copy is the only install, the hosted scan still also prints the generic redirect_vlt_entry_not_found next to the new redirect_vlt_bundled_instance_skipped, which gives the real reason.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RcHrVGj3ZJ2CJQn6LezdCC


Generated by Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude
Start fix for #469, #471
a5d90b0
Assisted-by: Claude Code:claude-opus-5-5
This was referenced Oct 1, 2026
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
Closed
vlt hosted and vendored vex attests not_affected while a bundled copy of the same name@version in node_modules/.vlt stays unpatched (the #325 fix covers npm locks only) #471
Closed
@claude
Skip bundled bun.lock entries, never attest them
1280bd6
Bun records a bundleDependencies copy as its own parent/child entry
flagged { "bundled": true } and unpacks it from the parent's
tarball, never reading the entry. Hosted and vendored scans rewired
those entries and reported success, and vex attested not_affected,
while the copy the parent loads stayed unpatched.

Both rewriters now skip a bundled entry with a loud warning (vendored
refuses when it is the only instance), and vex never takes a bundled
entry as a ref: it contests a ref for the same name@version in the
same lock or any other, like npm's inBundle handling (#325).

Refs #469

Assisted-by: Claude Code:claude-opus-5-5
github-advanced-security[bot]
github-advanced-security Bot found potential problems Oct 1, 2026
View reviewed changes
Comment thread crates/socket-patch-core/src/vex/discover/bun.rs Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread crates/socket-patch-core/src/vex/discover/bun.rs Fixed

Uh oh!

There was an error while loading. Please reload this page.

Claude (claude) added 6 commits October 1, 2026 14:54
@claude
Skip bundled bun.lockb records, never attest them
28c593c
bun.lockb marks a bundleDependencies edge with the bundled behavior
bit. A record only such edges reach is unpacked from the parent's
tarball, so redirecting or vendoring it installed nothing while scan
reported success and vex attested not_affected. Bun also shares one
record between a regular and a bundled install of the same version,
where the bundled copy stays unpatched.

The binary codec now flags those records. Hosted and vendored skip a
bundled-only record (vendored refuses when nothing else matches),
warn when the record is shared, and vex never attests either case.

Refs #469

Assisted-by: Claude Code:claude-opus-5-5
@claude
Contest vlt bundled store copies in vex/vendor
a4d97ac
vlt unpacks a bundleDependencies copy into its parent's store entry
and records no vlt-lock.json node for it, so no hosted or vendored
rewire reaches it. vex still attested the patch as not_affected while
that copy stayed unpatched.

vex now looks for real package directories inside each store
package's own node_modules (vlt links real dependencies as symlinks
beside the package), and does not attest a ref whose name@version a
bundled copy also installs. Vendored warns about such a copy, and
when it is the only install it refuses with that reason instead of
"run vlt install".

Refs #471

Assisted-by: Claude Code:claude-opus-5-5
@claude
Warn on vlt bundled copies in hosted scan
85f2274
A hosted scan in a vlt project pinned the regular lock node and
reported a clean success while a bundled copy of the same version,
unpacked into its parent's store entry, stayed unpatched. The scan
now warns redirect_vlt_bundled_instance_skipped and keeps that purl
out of the in-run VEX attestation.

Refs #471

Assisted-by: Claude Code:claude-opus-5-5
@claude
Document Bun and vlt bundled copies in contract
98991c2
Assisted-by: Claude Code:claude-opus-5-5
@claude
Keep patch uuids out of bundled-copy diagnostics
71b32c4
CodeQL flagged the new bun and vlt bundled-copy diagnostics for
printing the patch uuid. They now name only the package, matching
the other recent VEX diagnostics.

Assisted-by: Claude Code:claude-opus-5-5
@claude
Add bundled bun.lockb golden, quiet test output
1659386
The new bun-lockb-bundled fixtures join the VEX discovery golden
corpus. The new bundled-copy tests no longer print lock specs or
diagnostics that carry patch URLs and uuids (CodeQL), only case
numbers and diagnostic codes.

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 1, 2026 15:38
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Oct 1, 2026
View reviewed changes

@cursor cursor Bot left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread crates/socket-patch-core/src/patch/redirect/bun_binary.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@claude
Keep bun bundled copies out of in-run VEX
93f8463
A hosted scan --vex treated every confirmed redirect as applied. When
Bun shares a record between a regular install and a bundled copy,
or bun.lock has both entries, the regular entry is redirected but
the bundled copy stays unpatched, and the in-run attestation still
said not_affected.

The bun rewriters now record the uuids whose bundled instance they
skipped, and hosted scan verifies those purls instead of assuming
them applied, matching a standalone vex run.

Refs #469

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Oct 1, 2026
View reviewed changes

@cursor cursor Bot left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude
Keep rewrite goldens stable with the new field
63b4b4a
The redirect equivalence goldens hash each RewriteResult. The new
bundled_skipped_uuids set is left out of the serde digests while
empty, and the two goldens that hash its Debug form (pdm, poetry)
are re-blessed: their inputs are unchanged, only the printed struct
gained the empty field.

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Oct 1, 2026
View reviewed changes

@cursor cursor Bot left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude
Drop unrelated rustfmt churn from this PR
4a787fe
An earlier cargo fmt --all reformatted about 120 files this fix does
not touch (main is not rustfmt-clean and CI has no fmt check). Those
files are back to main's bytes, and the files this PR changes carry
only their real edits on top of main's formatting.

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Oct 1, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

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 4a787fe. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

[agent] CI note on head 4a787fe: the only red check is native (ubuntu-latest, 2.17.3) in PDM patch compatibility. 1 of 44 live-API backtest cells failed. I don't think this PR causes it:

  • This PR changes no pip-family code. The diff covers Bun and vlt lock handling, VEX discovery for those, and one filter in hosted scan --vex.
  • The same workflow passed every cell on 93f8463, which has the same runtime code as 4a787fe. The later commits only re-bless test goldens and revert formatting.
  • On earlier heads of this branch, the Poetry, PDM and vlt backtests each failed a different single cell, with a different check, version or mode each time (appliedExactlyOne, rescanIdempotent, vlt crlf-lock). The next run passed them, which points to the live patch API these scripts call.

I'm re-running the failed job once. If it fails again I'll treat it as real and dig in.


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Mikola Lysenko (mikolalysenko) commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

Burn-down agent: ready for review at 4a787fe (4a787fef74321c9e4c6d0f691f17461eb4eea756).

  • CI: all check runs green on this head (484 success, 5 skipped, 0 failed). The PDM patch compatibility / native (ubuntu-latest, 2.17.3) cell that was red earlier passed on its single re-run, consistent with the live-API flake noted above.
  • Bugbot: reviewed 4a787fe, no new issues; all earlier threads resolved.
  • Mergeable with no conflicts (16 commits behind main, no overlap).
  • Reviewer focus: the Bun and vlt lock rewriters now skip/contest bundled copies the same way the npm path does (Fix npm VEX attesting packages with an unpatched bundled copy (#325) #337), plus the matching VEX discovery change.

Slack announcement not sent: no Slack send tool is available to this agent; the next run will retry.


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 1, 2026
Bun hosted and vendored modes skip a URL or file: tarball copy of the patched package without warning, and vendored vex attests not_affected (the #326 fix covers npm locks only) #497
Closed
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed 4a787fef74321c9e4c6d0f691f17461eb4eea756. Recommendation: ready to merge from a code-review perspective.

No actionable correctness or security regressions found. Bundled Bun entries are excluded from rewiring and attestation, including binary records shared by regular and bundled installs. The vlt installed-store check contests the same package/version, and in-run hosted VEX does not assume those skipped copies were patched.

Validation: cargo test -p socket-patch-core --lib bundled: 19 passed. cargo test -p socket-patch-core --lib bun_lockb: 27 passed across codec and restore compatibility fixtures. cargo test -p socket-patch-cli --test in_process_redirect bundled: 2 passed, covering Bun in-run VEX and vlt warnings. Full workspace and real Bun/vlt toolchain matrix not rerun.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Tanmay182003
Tanmay Singla (Tanmay182003) approved these changes Oct 2, 2026
View reviewed changes
@mikolalysenko
Mikola Lysenko (mikolalysenko) merged commit 1169ae6 into main Oct 2, 2026
533 of 534 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/fix-bundled-copy-bun-vlt branch October 2, 2026 15:36
This was referenced Oct 2, 2026
Perf regression: bun/hosted wall +110% (1169ae68, #472) #578
Closed
Perf regression: vlt/hosted wall +127% (1169ae68, #472) #579
Closed
Benchmark tracking: socket-patch scan #580
Open
Fix PyPI vendored to hosted takeover being refused (#328) #503
Merged
Agent-mode apply skips a bundled copy inside another vlt/pnpm store entry whenever the package is also installed normally, and VEX attests not_affected #601
Closed
Stop re-parsing bun lock entries for every patch in scan (#580) #1051
Merged
Mikola Lysenko (mikolalysenko) added a commit that referenced this pull request Oct 7, 2026
@mikolalysenko @claude
Check bun spec match before the bundled-entry parse (#578)
b8475ca
Since #472, rewrite_bun_lock called is_bundled_entry(entry) before
comparing the entry's spec with the dep. is_bundled_entry JSON-parses the
entry's meta object, so a hosted rewrite of N patched deps over a lock of
M entries paid N x M serde_json parses where the loop used to do string
compares. Callgrind put 62% of bun/hosted instructions there, and
bun/hosted and bun/rescan wall time roughly doubled.

The vendored path had the same shape: classify_rewritable and
bundled_matches in vendor/bun_lock.rs ran the bundled check on every
entry before classify, once per target package.

Both checks are pure, so evaluate the cheap spec match / classify first
and run is_bundled_entry only on an entry that resolves the target. The
result is unchanged: a bundled copy is still skipped and reported.

A test-only BUNDLED_CHECKS counter (same pattern as lock_fragments'
RENDERS) lets regression tests pin the call count: 20 deps over 201
entries made 4020 checks before and 21 now; the vendor scans made 402
and now make at most 4.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 7, 2026
Fix open bun issues (#992, #861, #784, #764, #735, #635, #599, #578, #497, #443, #371) #1009
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@Tanmay182003 Tanmay Singla (Tanmay182003) Tanmay182003 approved these changes
+1 more reviewer
@github-advanced-security github-advanced-security[bot] github-advanced-security[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

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

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

vlt hosted and vendored vex attests not_affected while a bundled copy of the same name@version in node_modules/.vlt stays unpatched (the #325 fix covers npm locks only) 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

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@mikolalysenko @github-advanced-security @Tanmay182003 @claude
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.
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.