Repository navigation
Description
[agent] Found by the architecture refactor routine while fixing #2381 (PR #2453), on that PR's branch at 2e5af57 over main at 2440352. Lead L145. The first point is on main for Bun's lock as well.
The problem
#2453 makes vendor --check and vex read the content pin of a NuGet lock, as they already read Bun's: a lock that pins other bytes than the committed vendored artifact does not install it. Three places still do not agree with that rule.
1. vex --no-verify attests a package whose lock pins other bytes
The contract says of --no-verify: "verified against on-disk state (unless --vex-no-verify; the wiring gates apply either way)". It calls a pin mismatch a wiring failure ("vendor --check reports the same as a wiring failure"). The pin is compared in the verification step (core vex/verify.rs, the lock_pin_mismatch arms), which --no-verify skips, and not in the wiring gates.
The real .NET SDK 8, the tree dotnet restore --force-evaluate leaves (the lock on the upstream contentHash, nuget.config and the vendored nupkg as vendored, the app loading the upstream assembly), the binary of #2453:
$ socket-patch vex --product pkg:nuget/app@1.0.0
Warning: omitting pkg:nuget/Fx.Alpha@1.0.0 from VEX: the lockfile pins the vendored artifact to a sha512 that is not that file's, so an install does not deliver it; re-run socket-patch scan --mode vendored (vendor_lock_pin_mismatch)
Error: No applied patches with vulnerability metadata to attest.
[exit 1]
$ socket-patch vex --product pkg:nuget/app@1.0.0 --no-verify
Warning: 1 of 1 VEX statement was emitted without on-disk verification of the patch […]
Wrote OpenVEX document with 1 statement # "status": "not_affected"
[exit 0]
apply --vex, scan --vex and vendor --vex with --vex-no-verify go the same way. For Bun the same holds on main (read, and run for NuGet only): the Bun arm is in the same skipped step.
2. The run that pins a stale lock again needs the patch service, though the committed nupkg is intact
On that tree the committed nupkg holds the patch and only the lock's hash is stale. The re-vendor takes the path of a missing or stale artifact: it asks the patch service for the nupkg again, and only then pins the lock.
$ SOCKET_OFFLINE=1 socket-patch vendor
Error: Cannot vendor pkg:nuget/Fx.Alpha@1.0.0: --vendor-source=service needs the network but --offline is set
Vendored 0 packages; 1 failed.
[exit 1] # the lock still holds the upstream hash
With the service unreachable it fails the same way ("patch service request failed"). The writer has the sha512 of the committed bytes in hand at that point (core vendor/nuget_feed.rs, nuget_prelude: pin_stale), and could pin from it. The open point is the warning: that run reports vendor_artifact_rebuilt today, which would no longer be true, and vendor_artifact_reused ("re-wired as-is, no service download, no rebuild") is the contract's code for PyPI only.
3. Read, not run
scan --mode vendored --dry-runandget --mode vendored --dry-runsayalready_vendoredfrom the ledger's uuid alone (CLIcommands/scan/vendor_flow.rs, the preview'sAlreadyVendoredarm), where the wet run pins the lock again. Stop verifying and attesting a vendored NuGet package whose lock pins other bytes #2453 fixed the same answer forvendor --dry-run.- One lock whose target frameworks pin different hashes for the package (a hand-resolved merge;
dotnetdoes not write one) is reported byvendor --checkas "wiring missing … re-runsocket-patch vendorto rewire it". The config still names the feed, and the re-run fails on "conflicting contentHash values". Run at the writer: the re-vendor fails and the lock is unchanged. - The "wiring missing … re-run
socket-patch vendor" text ofvendor --checknames a command that does nothing in a project with no.socket/manifest.json(whatscan --mode vendoredleaves): it exits 0 with "No manifest to vendor from". Every ecosystem's unwired state lands on that text.
Planned fix
- Judge the pin where the wiring gates are, so that
--no-verifyreads it, for Bun and NuGet alike; a CLI test for each. - When only the pin is stale, pin from the committed nupkg with no download; a maintainer's word on the warning code would help.
- Run the three read-only points before changing them.
Not run: Bun under --no-verify, SDK 10, Windows and macOS.
Generated by Claude Code
Activity
refactor: #2453 opened for #2381, ready; #2431, #2441, #2445 merged; #…