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 — `get -g --mode hosted|vendored` and `scan -g --mode vendored` rewrite the current project's yarn.lock instead of refusing, leaving the global copy unpatched · Issue #436 · SocketDev/socket-patch Closed 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:p1 Description[agent] Found by the scheduled Yarn classic (1.x) bug-hunt routine (ledger #304). Summaryv5 refuses
Run outside any project, Impact
ReproMock patch API on yarn global add [email protected] # the global copy we want patched G="$(yarn global dir)/node_modules" mkdir proj && cd proj echo '{"name":"proj","version":"1.0.0","private":true,"dependencies":{"left-pad":"1.3.0"}}' > package.json yarn install && cp yarn.lock yarn.lock.orig socket-patch get 11111111-1111-4111-8111-111111111111 -g --mode hosted $API --json # status "success", redirect.redirected 1, rewrittenFiles ["yarn.lock"]; exit 0 diff yarn.lock.orig yarn.lock # resolved -> http://127.0.0.1:8765/patch/npm/left-pad/1.3.0/… (project rewired) head -1 "$G/left-pad/index.js" # unpatched upstream bytes cp yarn.lock.orig yarn.lock socket-patch get 11111111-1111-4111-8111-111111111111 --global-prefix "$G" --mode vendored $API --json # exit 0 grep resolved yarn.lock # file:./.socket/vendor/npm/11111111-…/left-pad-1.3.0.tgz#… cp yarn.lock.orig yarn.lock; rm -rf .socket socket-patch scan -g --mode vendored $API --json # exit 1; project yarn.lock rewired again socket-patch scan -g --mode hosted $API # control: exit 2, "--global cannot be used with --mode hosted" Expected vs actual
OS × yarn matrix (main
|
| OS | yarn 1.0.2 | yarn 1.10.1 | yarn 1.22.22 |
|---|---|---|---|
| Linux (sandbox + ubuntu-latest) | repro | repro | repro |
| macOS (macos-latest) | repro | repro | repro |
| Windows (windows-latest) | repro | repro | repro |
Every cell: get -g --mode hosted exit 0 with the project lock rewritten, and get -g --mode vendored exit 0 with the project lock rewritten. Control: scan -g --mode hosted exits 2 everywhere.
Not a v5 regression: the v4.0.0 release does the same for all three, and on v4.0.0 scan -g --mode hosted also exited 0. v5 added the scan/hosted guard only.
crates/socket-patch-cli/src/commands/get.rs:2523: args.mode.unwrap_or(if … is_global() { Agent } else { Hosted }) applies the global→agent default only when --mode is absent. Nothing rejects an explicit Hosted/Vendored together with is_global().resolve_mode_flags, per the contract) covers Hosted only, not Vendored.Probe run: https://github.com/SocketDev/socket-patch/actions/runs/36827174726 (3 OS × yarn 1.0.2 / 1.10.1 / 1.22.22, cells get_g_hosted / get_g_vendored).
[agent] Triaged: priority:p1 (yarn classic, but the missing guard is ecosystem-agnostic). Standalone: get applies the global→agent default only when --mode is absent, and scan's global guard rejects hosted but not vendored. No open PR covers it.
Generated by Claude Code
[agent] Shares root cause with #445: global scope (-g / --global-prefix) never gates the cwd project's hosted/vendored state: get only defaults to agent when --mode is absent, scan refuses hosted but not vendored, rollback/remove run their hosted and vendored legs against --cwd unconditionally, and the agent leg consults the cwd vendor ledger for ownership of a global copy. Will be fixed together.
Generated by Claude Code
[agent] Claiming this issue (with #445; shared root cause: global scope never gates the cwd project's hosted/vendored state). Branch: agent/fix-global-scope-project-state. Claim-ID: 2026-10-01T08:20:40Z-ef5cf8
Generated by Claude Code
[agent] From the Pipenv bug-hunt routine (ledger #313): two of the three rows also reproduce on a pypi / Pipenv project, so this isn't specific to yarn.
Setup: Linux, main 2463257, Pipenv 2026.8.0 Pipfile.lock pinning six==1.16.0, and a standalone CPython 3.12 first on PATH as the global interpreter, with no global six. Each case ran twice with the same result:
| Run from inside the Pipenv project | exit | What happens |
|---|---|---|
get <uuid> -g --mode hosted --yes |
0 | The project's Pipfile.lock is rewritten to the hosted wheel URL. Nothing global is touched. |
get <uuid> -g --mode vendored --yes |
0 | .socket/vendor/pypi/<uuid>/ is written, and the project's Pipfile.lock is wired to it. |
scan -g --mode vendored --yes |
0 | Pipfile.lock is left untouched (no global six was discovered, so there was nothing to cross-wire). |
The rollback side (#445) also reproduces on Pipenv; details are in my comment there.
Generated by Claude Code