Agent-mode npm apply, apply --check and vex skip a declared workspace member in a hidden directory (.github/actions/x, .config/tool), so its nested copy stays unpatched while VEX attests not_affected
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
- 53/100
Hướng nghiên cứu
Start with skipped_members_of and workspace_children in crates/socket-patch-core/src/crawlers/npm_crawler.rs, then read docs/ecosystems.md for the documented workspace behavior. Reproduce with the .github/actions/x workspace example and compare agent-mode scanning with the nested node_modules copy. Done when the declared hidden workspace member is crawled, or checks and VEX clearly flag the unpatched copy.
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 npm bug-hunt routine (ledger #302).
Summary
#1627 made the agent-mode node_modules walk crawl a declared workspace member whose path crosses a SKIP_DIRS name (packages/build, vendor/lib). A declared member inside a hidden directory is still pruned. A common example is a JavaScript GitHub Action kept as an npm workspace at .github/actions/<name>, matched by "workspaces": [".github/actions/*"]. Another is an explicit ".config/tool" entry. npm 7+ treats these as workspace members and installs each member's unhoistable dependencies into <member>/node_modules from the root lock, so the copy there is live.
skipped_members_of (crates/socket-patch-core/src/crawlers/npm_crawler.rs:109) walks the patterns with a walkable filter that rejects every name starting with . (line 121). It also only adds a member when its path crosses a SKIP_DIRS name (line 183). The main walk's workspace_children drops hidden dirs too (line 3476). The result:
scan --mode agentpatches every other copy of the samename@version, skips the hidden member's copy, and exits 0.apply --checkreports "Patches are in sync".vexwrites anot_affectedstatement for the vulnerability, though npm runs the unpatched bytes from.github/actions/x/node_modules/left-pad.
If the hidden member holds the only copy, scan --mode agent prints [skip] pkg:npm/[email protected] (not installed; run your package manager's install first …) and exits 0. The package is installed.
Impact
A false VEX attestation, the same class as #1627: a scanner consuming the VEX suppresses a vulnerability in code that is installed and executed (for example by the Action at runtime). Nothing in the output warns about it.
Repro (npm 10.9.4, Node 22.22.0, Linux)
The patch API is a local mock. Any patch for [email protected] shows it; a hand-staged .socket/manifest.json works the same way.
mkdir -p proj/.github/actions/x proj/packages/y && cd proj
echo '{"name":"root","version":"1.0.0","private":true,"workspaces":["packages/*",".github/actions/*"],"dependencies":{"left-pad":"1.3.0"}}' > package.json
echo '{"name":"x","version":"1.0.0","dependencies":{"left-pad":"1.2.0"}}' > .github/actions/x/package.json
echo '{"name":"y","version":"1.0.0","dependencies":{"left-pad":"1.2.0"}}' > packages/y/package.json
npm install
# lock: node_modules/left-pad (1.3.0), packages/y/node_modules/left-pad and
# .github/actions/x/node_modules/left-pad (both 1.2.0)
socket-patch scan --mode agent --yes --api-url <mock> --org test-org --api-token fake
head -c 20 packages/y/node_modules/left-pad/index.js # /* SOCKET-PATCHED */
head -c 20 .github/actions/x/node_modules/left-pad/index.js # /* This program is f <- unpatched
socket-patch apply --check … # "Patches are in sync (1 patch checked)", exit 0
socket-patch vex … -O v.json # 1 statement, status not_affected, exit 0
Expected vs actual
docs/ecosystems.md, "npm: which node_modules trees are crawled": the walk skips hidden directories and build dirs, "except that a workspace member the root package.json workspaces field declares … still has its own node_modules crawled. npm, yarn and Bun install a member's unhoistable dependencies there from the root lock." The usage docs say agent VEX attests "Installed patched files, checked against the manifest's hashes".
- Expected: the declared member
.github/actions/xhas itsnode_modulescrawled and patched. At the least,apply --check/vexmust not report the patch as in sync or attestnot_affectedwhile that copy is unpatched. - Actual: the copy is never seen. apply,
--checkandvexall succeed.
Matrix (Linux, Node 22.22.0)
| socket-patch | npm | member path | result |
|---|---|---|---|
main ecd4924 |
8.19.4 | .github/actions/x (glob) |
fail |
main ecd4924 |
10.9.4 | .github/actions/x (glob) |
fail (2/2) |
main ecd4924 |
10.9.4 | .config/tool (explicit pattern) |
fail |
main ecd4924 |
12.2.1 | .github/actions/x (glob) |
fail |
main ecd4924 |
10.9.4 | tools/build/x (control, #1627 shape) |
pass |
| v5.0.1 | 10.9.4 | .github/actions/x |
fail |
This isn't a regression: v5.0.1 does the same. macOS and Windows are untested; the cause is platform-independent. Hosted and vendored modes are unaffected, because the pin is lock-driven and npm ci installs the patched tarball into the hidden member too. The walk is shared, so yarn and Bun workspaces probably behave the same (not verified).
Suspect code
crates/socket-patch-core/src/crawlers/npm_crawler.rs:121:walkableinskipped_members_ofrejects hidden names, including the literal prefix of a pattern such as.github/actions/*.crates/socket-patch-core/src/crawlers/npm_crawler.rs:183: members are only added when the path crosses aSKIP_DIRSname, so a hidden segment would need the same treatment.crates/socket-patch-core/src/crawlers/npm_crawler.rs:3476:workspace_childrenprunes hidden dirs.
No probe runs: probe branches are blocked for this routine (see the ledger).
- Ngôn ngữ chính
- Rust
- Star
- 8
- Fork
- 2
- Merge trung bình
- 19 giờ 31 phút
- Pull request đã merge (30 ngày)
- 686
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
-
Go apply, apply --check and vex treat a module that is only another module's replace target as built, so the patch is reported applied and attested while go builds the unpatched codeCó thể đã có người làm @mikolalysenko đã nhận hôm nay. Đang mởagent:claimed agent:triaged bug bughunt pm:go priority:p2
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
SocketDev/socket-patch#1823 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Vendored gem mode writes the rewired `gem` line of a CRLF Gemfile with an LF ending, leaving the Gemfile with mixed line endingsCó thể đã có người làm @mikolalysenko đã nhận hôm nay. Đang mởagent:claimed agent:triaged bug bughunt pm:bundler priority:p1
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
SocketDev/socket-patch#1821 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CI perf: workflow_dispatch of CI — Windows-only janitor fixes re-run the full Linux + macOS nightly matrix (~100 min/day, ~30 macOS)Có thể đã có người làm @mikolalysenko đã nhận hôm nay. Đang mởagent:claimed agent:triaged ci-perf priority:p3
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 1/100
SocketDev/socket-patch#1818 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Nightly Windows: 3 Go workspace unit tests fail (Unix-only GOWORK paths)Có thể đã có người làm @mikolalysenko đã nhận hôm nay. Đang mởagent:claimed agent:triaged ci-janitor priority:p3
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
SocketDev/socket-patch#1815 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Go apply writes the shared replace into ./go.work when GOWORK names another file in the same directory, reports success, and the workspace builds unpatchedCó thể đã có người làm @mikolalysenko đã nhận hôm nay. Đang mởagent:claimed agent:triaged bug bughunt pm:go priority:p2
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 35/100
SocketDev/socket-patch#1810 · 3 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ự
-
area:cli bug dotnet good first issue priority:medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
rtk-ai/rtk#4844 · 1 bình luận ·
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 78/100
delta-io/delta-kernel-rs#3757 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
area: library data-loss type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
alplabai/signex#1740 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
test(fslc): the unreadable mutate catalog test pins the Unix I/O error text and fails on WindowsCó thể đã có người làm @rizumita đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/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 69/100
Maintainer thường phản hồi trong vòng 1 ngày