On pnpm 9 and 10, `pnpm update` and `pnpm dedupe` put the upstream release back over a hosted patch with no message (on a pnpm 9 workspace `pnpm add` does too), and the scan never says so
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ó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- rust
- Lĩnh vực
- cli, documentation
Hướng nghiên cứu
Đọc core/hosted/guidance.rs quanh redirect_pnpm_trust_lockfile và cảnh báo về Rush trong core/hosted/engine.rs, sau đó xem lại docs/testing/pnpm-compatibility.md và docs/ecosystems.md. Cập nhật các cảnh báo để mô tả hành vi đã được báo cáo của pnpm 9 và 10 cùng phạm vi Rush đã đo được, đồng thời bổ sung kết quả tương thích và ghi chú về pnpm. Hoàn tất khi cả ba vị trí mô tả bằng chứng mà không quyết định có thay đổi hành vi pin hay không.
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 architecture refactor routine on main at cfc870f, with real pnpm 9.15.9, 10.28.0 and 10.34.9 and real Rush 5.182.1.
The problem
A hosted patch of a pnpm project lives in one resolution line of pnpm-lock.yaml. On pnpm 9 and 10, ordinary commands write that line back to the upstream release, exit 0 and print nothing about it:
pnpm updateandpnpm dedupe, on every project;- on a pnpm 9 workspace, also
pnpm add,pnpm removeandpnpm update <pkg>of an unrelated package; - a second workspace member (or Rush project) that starts depending on the patched release.
The developer who ran the command keeps the patched file in node_modules, so nothing looks wrong locally. The lock that gets committed is upstream's, and every fresh clone and CI run installs the vulnerable release. Hosted mode keeps no record outside the lock, so list and vex then say there is no patch in the project.
socket-patch says nothing about this for these pnpm releases. For pnpm 11.20 and newer the registry route exists to prevent exactly this, and its warning says so: pnpm "keeps them when it resolves again (pnpm add, update, dedupe)" (core hosted/guidance.rs, lines 752 to 754). On the trustLockfile path, which every pnpm 9 and 10 project takes, the warning names two rarer commands (pnpm clean --lockfile, --force) and says "pnpm <=10 ignores the setting and installs work unchanged". docs/testing/pnpm-compatibility.md measures the loss for pnpm 11.10 and newer only, and docs/ecosystems.md has no line for 9 or 10 (it has one for vlt, at line 1026: "vlt update re-resolves an unchanged exact spec from 1.0.8 on, dropping the redirect").
In a Rush repo the scan prints the opposite: "rush install fails until rush update refreshes repo-state.json (the hosted wiring survives rush update)" (core hosted/engine.rs, line 3693). That holds for the refresh. It does not hold for rush add of the patched release in a second project, or rush update after a second project's package.json names it.
Evidence
A real left-pad 1.3.0, a stand-in patch API that grants a patched tarball, the binary built from main. Each cell starts from the same state: scan --mode hosted, then a frozen install into an empty store, so the lock holds the hosted tarball and node loads the patched file. "kept" and "lost" are the hosted tarball: line in the lock after the command; every command exits 0.
| Command | 9.15.9, one package | 9.15.9, workspace | 10.28.0 and 10.34.9, one package | 10.28.0 and 10.34.9, workspace |
|---|---|---|---|---|
pnpm install, --frozen-lockfile, --fix-lockfile, --lockfile-only |
kept | kept | kept | kept |
edit package.json to add another package, pnpm install |
kept | kept | kept | kept |
pnpm add <other> (in the workspace: --filter b, a member that does not use the patched package) |
kept | lost | kept | kept |
pnpm remove <other> (the same member) |
kept | lost | kept | kept |
pnpm update <other> (in the workspace: at its root) |
kept | lost | kept | kept |
pnpm update |
lost | lost | lost | kept |
pnpm update -r |
lost | lost | lost | lost |
pnpm dedupe |
lost | lost | lost | lost |
pnpm add [email protected] --filter b (a second dependent) |
lost | lost |
What the user sees, pnpm 10.34.9, one package:
$ socket-patch scan --mode hosted --yes && pnpm install --frozen-lockfile
$ pnpm dedupe
Already up to date
Progress: resolved 2, reused 2, downloaded 0, added 0, done # exit 0
$ grep -A1 '[email protected]:' pnpm-lock.yaml
[email protected]:
resolution: {integrity: sha512-XI5MPzVN…} # upstream's; the hosted tarball line is gone
$ node -e '…' # this machine
node loads: PATCHED
$ socket-patch list
No patches in this project. Run `socket-patch scan`. # exit 0
$ socket-patch vex --product pkg:generic/[email protected] -O vex.json
Error: No patches in this project; nothing to attest. Run `socket-patch scan` first. # exit 2
# a fresh clone of the committed files:
$ pnpm install --frozen-lockfile && node -e '…'
node loads: UPSTREAM
Rush 5.182.1 with pnpm workspaces, on pnpm 9.15.9 and 10.28.0 alike:
After the scan, a rush update and a rush install into an empty common/temp |
Pin |
|---|---|
rush update, rush update --recheck |
kept |
another package added to or removed from a second project, then rush update; rush add -p <other> |
kept |
rush add -p [email protected] in a second project |
lost |
"left-pad": "1.3.0" written into a second project's package.json, then rush update |
lost in three runs of four on 9.15.9; kept in the one run on 10.28.0 |
rush update --full |
lost, as the warning says |
The tool itself stays truthful throughout: once the pin is gone, list, vex and a dry scan report the project as unpatched, and the next hosted scan pins it again.
Planned fix
The part that needs no decision is to say it, where the user is already reading:
- In the
redirect_pnpm_trust_lockfilewarning, for a lock that is not on the registry route: one line thatpnpm updateandpnpm dedupe(and on pnpm 9,pnpm addandpnpm removein a workspace) resolve the patched packages from the registry again, and thatsocket-patch scanputs the patch back. - In the Rush warning, scope the sentence to what was measured: the pin survives the
rush updatethat refreshesrepo-state.json, and not a second project that starts depending on the patched release. - The rows above in
docs/testing/pnpm-compatibility.md, and a sentence in the pnpm notes ofdocs/ecosystems.mdbeside the vlt one.
No JSON shape, flag, exit code or file changes.
For a maintainer: whether pnpm 9 and 10 should get a pin that holds through these commands, as the registry route gives pnpm 11.20 and newer, is a design question this issue does not answer.
Generated by Claude Code
- Ngôn ngữ chính
- Rust
- Star
- 9
- Fork
- 2
- Merge trung bình
- 1 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 251
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 arch-audit bug priority:p3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
SocketDev/socket-patch#2346 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bug bughunt pm:bundler priority:p1 ux
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
SocketDev/socket-patch#2326 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
The unit test for "every jar copy must be patched" passes when VEX checks only the first copyĐang mởagent:triaged arch-audit priority:p3 refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
SocketDev/socket-patch#2319 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged arch-audit bug priority:p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
SocketDev/socket-patch#2306 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged arch-audit bug priority:p3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
SocketDev/socket-patch#2296 ·
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ó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
tamatebako/tebako#1155 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
swc-project/swc-next-issues#1148 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
registrystack/registry-stack#2828 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
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 85/100
Maintainer thường phản hồi trong vòng 1 ngày