`vendor -g` and `vendor --revert -g` still rewire the current project: on vlt, `--revert -g` silently unpatches a vendored project (the #446 fix skipped vendor.rs)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Start with crates/socket-patch-cli/src/commands/vendor.rs at the manifest-driven vendoring path around line 810 and run_revert around line 3119. Compare their global-scope handling with project_state_in_scope and global_mode_conflict in commands/mod.rs:44, then run the supplied vendor -g and vendor --revert -g reproductions. Done means global commands no longer modify the project's lockfile, vendor directory, or ledger and produce the documented usage behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
[agent] Found by the scheduled vlt bug-hunt routine (ledger #307).
Summary
PR #446 (fixing #436 / #445) made every -g / --global-prefix run leave the cwd project's hosted pins and vendored wiring alone, but only in get, scan, apply, rollback and remove. The standalone vendor command was not changed, and it ignores global scope completely:
vendor --revert -grun inside a vendored project reverts the project's vendoring:vlt-lock.jsongoes back to the upstream registry entry and.socket/vendor/is deleted. It exits 0 and the global copy is untouched. The nextvlt ciinstalls pristine left-pad, so the project is silently unpatched. This is the #445 failure again, reached throughvendorinstead ofrollback.vendor -grun inside a project whose.socket/manifest.jsonholds a record (for example one written byget -g, which records the global patch in the cwd manifest) vendors into the project. It creates.socket/vendor/npm/<uuid>/…, rewiresvlt-lock.jsonto afile~.socket+vendor+…node, and does a hosted→vendored takeover (vendor_takeover_reverted_redirect) when the project was hosted. It exits 0.SOCKET_GLOBAL=1/SOCKET_GLOBAL_PREFIXbehave the same as the flags.
Impact
A user who patched a global tool (get -g) and then runs vendor --revert -g or vendor -g from inside their project gets their project's lockfile rewritten, with exit 0 and no warning. With --revert -g the project is unpatched on the next frozen install. This is the same class of damage as #445, which was rated p1.
Expected (CLI_CONTRACT.md)
Global scope never touches the project's state (v5.0). A
--global/--global-prefixrun that starts inside a project acts on the global installs only. The--cwdproject's hosted pins and vendor ledger are not its target …
scan and get with --mode vendored under -g are a usage error (exit 2: "global installs have no project lockfile … to wire vendored artifacts into"). vendor -g should be refused the same way, or be a no-op on the project. vendor --revert -g must not revert the project's ledger entries.
Repro (Linux, vlt 1.3.3; a local mock registry plus patch API, as in the ledger)
G=$PWD/gprefix; npm install -g --prefix $G --registry $REG [email protected]
mkdir proj && cd proj
echo '{"name":"app","version":"1.0.0","dependencies":{"left-pad":"1.3.0"}}' > package.json
echo '{"config":{"registries":{"npm":"'$REG'"}}}' > vlt.json
vlt install
socket-patch scan --mode vendored --yes --json # rc 0, project vendored
cp vlt-lock.json lock.vendored
socket-patch get pkg:npm/[email protected] -g --global-prefix $G/lib/node_modules --yes --json # rc 0, global patched
socket-patch vendor --revert -g --global-prefix $G/lib/node_modules --yes --json # rc 0
cmp vlt-lock.json lock.vendored # differs: back to the registry entry; .socket/vendor gone
rm -rf node_modules && vlt ci --allow-scripts :scripts
node -p "require('left-pad')" # pristine
The vendor -g variant: skip the scan --mode vendored step, then run get … -g followed by vendor -g --global-prefix …. vlt-lock.json gains "file~_d left-pad": "prod file:./.socket/vendor/npm/<uuid>/left-pad-1.3.0/node_modules/left-pad …" and the next vlt ci installs the vendored copy into the project.
Actual vs expected
| Command (inside the project, global copy patched) | Expected | Actual |
|---|---|---|
vendor --revert -g (flag or SOCKET_GLOBAL=1) |
project's vendoring kept | project's vendoring reverted, rc 0, vlt ci → pristine |
vendor -g |
exit 2 usage error (as scan -g --mode vendored), or no project change |
vendors into .socket/vendor, rewires vlt-lock.json, hosted→vendored takeover, rc 0 |
OS × version
| OS | vlt 1.0.10 | vlt 1.2.0 | vlt 1.3.3 | npm control (package-lock) |
|---|---|---|---|---|
| Linux | repro (vendor -g and --revert -g) |
repro | repro (2/2 runs, flag and env) | repro (vendor --revert -g unwinds the npm project too) |
| macOS / Windows | untested (no probe branch this run) | untested | untested | — |
The logic doesn't depend on the package manager: it reproduces against npm too. I'm filing it under vlt because that's where I found it, as with #445.
First bad
Release 4.0.0 predates vlt support. On main, vendor has never consulted global scope. #446 (551c362) fixed the sibling commands but left vendor.rs untouched, so this is a gap in that fix rather than a regression. Tested on main 61cfb9b.
Suspect code
crates/socket-patch-cli/src/commands/vendor.rs:665: only the manifest-less eject path checksis_global(). The manifest-driven vendor path (falling through to the vendoring at ~:810) andrun_revert(vendor.rs:3119) never consultcrate::commands::project_state_in_scope(commands/mod.rs:44) orglobal_mode_conflict.
- Ngôn ngữ chính
- Rust
- Star
- 8
- Fork
- 0
- Merge trung bình
- 1 ngày 31 phút
- Pull request đã merge (30 ngày)
- 151
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SocketDev/socket-patch
-
agent:triaged bug bughunt pm:yarn-berry priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
SocketDev/socket-patch#783 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bug bughunt pm:pipenv priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
SocketDev/socket-patch#744 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bug bughunt pm:cargo priority:p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
SocketDev/socket-patch#651 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bug bughunt pm:composer priority:p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
SocketDev/socket-patch#515 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A report-only `scan -g` tells you to run `socket-patch scan --mode agent [PATHS]` without `-g`, so following the hint scans the cwd project instead of the global installCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởagent:triaged bug bughunt pm:npm priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
SocketDev/socket-patch#464 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SocketDev/socket-patch
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
-
review-drift
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
oxidecomputer/hansei#14 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
rubys/roundhouse#444 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Published hardy-bpa-server image is built without the file-cla featureCó thể đã có người làm @EmbryoSpace đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
ricktaylor/hardy#755 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
semaphoreci/docker-images#46 · 1 bình luận ·