GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing github.com — Fix npm VEX attesting a patch the twin lock lacks (#798) by mikolalysenko · Pull Request #799 · SocketDev/socket-patch Conversation
|
| Issue | Test | Without fix | With fix |
|---|---|---|---|
| #798 (unit, both directions, hosted + vendored) | vex::discover::npm::tests::a_sibling_npm_lock_without_the_package_contests_it |
FAILED | ok |
#798 (CLI, socket-patch vex binary, hosted + vendored × stale package-lock / stale shrinkwrap) |
e2e_vex_lockfile npm::dual_lock_with_one_lock_missing_the_package_attests_nothing |
FAILED | ok |
| control: twin at another version stays attested | vex::discover::npm::tests::a_sibling_npm_lock_with_another_version_contests_nothing |
ok | ok |
both_locks_are_read_and_the_agreeing_mirror_adds_nothing used disjoint twins, which is exactly the #798 shape. It now uses agreeing twins and still proves both locks are read (4 refs) and that the v2 legacy mirror adds nothing.
Commands run locally (Linux, toolchain 1.93.1):
cargo clippy --workspace --all-features -- -D warnings: clean.cargo fmt --all -- --check: the touched files are clean. main already has unrelated rustfmt diffs in other files, and CI has no fmt gate.cargo test -p socket-patch-core --all-features: 5393 passed, 5 failed. One was the fixture above, now fixed: vex:: is 607/607. The other four (copy_tree::relax_loop_must_not_traverse_symlinked_root, vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry, pypi_poetry::wire_write_failure_…, pypi_requirements::wire_failure_…) depend on read-only directories, which don't hold when the sandbox runs as root. They don't touch this code.cargo test -p socket-patch-cli --all-features --test e2e_vex_lockfile: 287/287. --test e2e_vex_redirect 28/28, --test hosted_memory_engine 28/28, --test scan 104/104, --test vendor 81/81.cargo test --workspace could not finish locally because the sandbox disk ran out linking ~240 test binaries. CI runs the full set.npm/, pypi/, gem/) aren't affected: this is Rust core VEX discovery only.🤖 Generated with Claude Code
https://claude.ai/code/session_01TtZrsd52E6vxhvF9hpLVSw
Note
Medium Risk
Changes npm dual-lock VEX discovery at the attestation boundary; wrong logic would still allow false not_affected claims, though coverage is extensive.
Overview
Lockfile-only vex no longer attests when one of npm-shrinkwrap.json / package-lock.json wires a Socket patch and the twin lock has no entry for that name@version (or only a different version). Those cases emit patched_ref_unattributable with messaging that npm may re-resolve from the registry depending on major, matching the existing “sibling resolves elsewhere” rule.
Discovery now tracks every name@version mentioned in each lock (NpmLockRefs.mentioned, populated from normal, bundled, and non-registry entries). push_uncontested treats a sibling that does not mentions the wired purl as contesting the ref. The same name@version at another path in the twin still agrees and attests.
Tests/docs: new unit cases for missing sibling entries, wrong-version siblings, and agreeing paths; e2e dual_lock_with_one_lock_missing_the_package_attests_nothing; npm-compatibility.md updated. vex_consumed hosted npm tests were adjusted so alias expansion is still exercised after the name-keyed resolver (#605) finds aliases on its own.
Reviewed by Cursor Bugbot for commit 375f576. Configure here.
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
With both npm-shrinkwrap.json and package-lock.json committed, lockfile-only `vex` attested a patch that only one lock wired when the other lock had no entry for the package at all. npm 12 installs from package-lock.json and re-resolves a missing entry from the registry, so the checkout installed unpatched bytes while the VEX document said `not_affected`. A twin lock with no entry for the package now contests the wiring the same way a registry entry does (`patched_ref_unattributable`), in both directions and for hosted and vendored wiring. A twin that holds the package only at another version still contests nothing: npm installs that version, not unpatched bytes of the patched one. Fixes #798 Assisted-by: Claude Code:claude-opus-5-5
There was an error while loading. Please reload this page.
The test that proves both npm locks are read wired each package in only one lock. After #798 such a pair is contested (npm re-resolves the package missing from the other lock), so the fixture now has each lock wire both packages. It still proves both locks are read (4 refs) and that the v2 legacy mirror adds nothing. Refs #798 Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
CodeQL flagged the new dual-lock test for printing the wired patch reference (which holds the patch uuid) in an assertion message. The message now names the wiring mode instead. Refs #798 Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
|
[agent] CI status for the native compatibility suites:
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ready for review (burn-down agent).
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Conflict only in the NpmLockRefs doc comment (vex/discover/npm.rs): kept main's bundled-location wording plus this PR's package-name set; main's unwired→BTreeMap change and #588 same-lock check combine with the missing-entry contest unchanged. Co-Authored-By: Claude <[email protected]>
|
bugbot run Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
#605 taught the name-keyed npm resolver to probe bundled store trees, so it now finds aliased copies (node_modules/lp) and a nested host's store peers itself. Two vex_consumed tests from #738 assumed that set never held aliases, so main's CI went red after both merged. The tests now feed the alias-free set explicitly to keep covering alias expansion, and also check the resolver's own set reaches the same copies with no duplicates. No production code changes. Assisted-by: Claude Code:claude-opus-5-5 (cherry picked from commit 40dac07)
|
[agent] This PR didn't cause it. Current I pushed Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
A twin lock that held the package only at another version still let the wired ref through. npm keeps that entry only while it satisfies package.json, and otherwise fetches the wired version unpatched from the registry, so the lock alone can't vouch for it. The twin now contests unless it has an entry for the same name@version at any path. Lock pairs the rewriters keep in sync share that set, so they are unaffected. Refs #798 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TtZrsd52E6vxhvF9hpLVSw
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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 375f576. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Burn-down agent: labeled Ready for review.
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
The npm/hosted bench drifted +15% wall / +12% CPU over a week of main (2463257..9c43dfc). The new npm lock passes from #345, #491, #646 and #799 each added a walk of the 3000-entry package-lock.json, on top of two costs that scale badly with every extra walk: - Every hosted scan ran a full second lockfile discovery after the rewrite (`hosted_state_from_lockfiles`) only to classify a hosted vs vendored takeover, even with no vendored ledger to overlap, and then a THIRD one inside `classify_overlap_takeover_with` when there was one. The classifier now discovers once, and not at all when the vendored ledger has no entries (the hosted common case). - `Discovery::resolved_elsewhere` deduped with `Vec::contains` on every call, so recording a lock's registry entries was quadratic in its size. `finalize` already sorts and dedups the list and every earlier reader only asks whether some entry matches, so the per-call check is gone. Also trimmed per-entry allocations on the new passes: the npm extractor builds each entry's purl once (it was built for `mention` and again for `unwired`), `resolved_is_non_registry` no longer formats a prefix per entry, and `npm_spec_is_registry` no longer lowercases every edge spec. Instructions retired for `scan --json --dry-run` on the bench's npm fixture (median of 9, macOS): base 2463257 2.647G, branch head 2.755G (+4.1%), this commit 2.353G (-11.1% vs base, -14.6% vs head). Scan output is byte-identical to before. Regression test: `takeover_classifier_discovers_at_most_once` counts discoveries (test-only counter in `discover_wiring`); new unit tests pin the rewritten registry/tarball predicates. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
npm VEX attests a patch that only npm-shrinkwrap.json wires when the package-lock.json beside it has no entry for the package, though npm 12 reads package-lock.json and installs the registry copy
There was an error while loading. Please reload this page.