Skip to content

Commit 14c8342

Browse files
committed
npm bughunt run 76 (2026-12-06)
1 parent b9d4417 commit 14c8342

3 files changed

Lines changed: 43 additions & 13 deletions

File tree

‎entries/npm/20261206T065217Z.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[agent] 2026-12-06: npm bug-hunt run
2+
3+
Run 76. Tested main `cd7c5c5` (unchanged since the last run; release v5.2.0) on Linux with Node 22.23.5 and npm 12.2.3, 10.9.9, 8.19.4 and 7.24.2. No new npm release (latest 12.2.3). Patch data came from a local Python mock of the patch API, serving marker patches built from the real `left-pad@1.3.0`, `is-number@7.0.0`, `core-js@3.37.1` and `JSONStream@1.3.5` tarballs. It also served a synthetic `crlf-bin-x` package from an upstream registry route, and the patch routes under a `/mirror/` base path for `SOCKET_PATCH_MIRROR_URL`.
4+
5+
**Re-triage** (no change, no comment)
6+
- #2304: still reproduces (after a vendored scan, `scan --mode agent` says "2 vulnerabilities left to patch"; a bare `scan` says "Nothing left to patch").
7+
- #2331: still reproduces on 12.2.3 (vendored + `omit-lockfile-registry-resolved=true`, one `npm install`, cold `npm ci` fails EINTEGRITY).
8+
9+
**Cells**
10+
- npm 12 `allowScripts` with a patched package that has a postinstall (`core-js@3.37.1`, `strict-allow-scripts=true`), hosted and vendored: a version-pinned approval is warned (`redirect_npm_allow_scripts` / `vendor_npm_allow_scripts`) and `npm ci` fails ESTRICTALLOWSCRIPTS, as documented. A name-only approval runs the script on patched bytes, and `vex` passes: **pass**.
11+
- CRLF-shebang bin (#1756) where the patched file is the bin, all three modes: install, scan, `npm ci`, bin runs, `vex`. Agent re-apply is a no-op, and agent rollback restores the file with the bin still working: **pass**.
12+
- Git dep (`lp: github:left-pad/left-pad#v1.3.0`) beside registry `left-pad`, agent mode, npm 10.9.9 (v3) and 8.19.4 (v2): both copies patched, `vex`, rollback restores: **pass**.
13+
- v4 `postinstall: socket-patch apply` hook on a vendored project, 12.2.3: `npm ci` online and with the API unreachable stays patched, `vex`, `vendor --check`, rollback, `npm ci` upstream: **pass**.
14+
- Patch mirror on npm 8.19.4 and 7.24.2 v2 locks, hosted: packages and legacy `dependencies` entries both pinned under the mirror, `npm ci` patched, `vex`, re-run no-op, rollback byte-exact: **pass**.
15+
- Patch mirror + npm 12 `allow-remote=root` with a transitive pin: warned, `npm ci` EALLOWREMOTE, `--allow-remote=all` patched, rollback byte-exact (documented): **pass**.
16+
- Upper-case legacy name `JSONStream@1.3.5`, all three modes, through `vex`, `list` and `rollback JSONStream`: **pass**.
17+
- `dev` / `optional` lock flags after hosted and vendored rewrites, then `npm ci --omit=dev` / `--omit=optional` / plain: **pass**.
18+
19+
**Issues**
20+
- None filed, commented on or closed.
21+
22+
**False positives ruled out**
23+
- Vendored npm 12: running npm's own `npm install-scripts approve core-js` writes an absolute `file:` tarball approval and drops the version approval, so `strict-allow-scripts` fails after `rollback`. socket-patch leaves `allowScripts` alone by design, and its warning names the working name-only approval (added to `known-non-bugs/npm.md`).
24+
- Agent `rollback` printing "Removed N patches from manifest" is the documented v5 full-state rollback.
25+
26+
**Next**: re-triage #2275 and #2476; VEX `@scope` purl vs scanners; an interrupted scan on npm 12.

‎known-non-bugs/npm.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,4 @@ One line each. Moved from state/npm.md on 2026-11-26; search with git grep.
166166
- A mirrored hosted pin is not a patch for a run without `SOCKET_PATCH_MIRROR_URL` (`vex`: "No patches in this project"), and vendoring over mirror pins downloads from the patch server (CLI_CONTRACT "Patch mirror"; 2026-12-04).
167167
- `vex` / `list` from a workspace member directory say "No patches in this project" (exit 2) when the lock and `.socket/` live at the workspace root: discovery is cwd-scoped, same as `scan` / `apply` (npm 12.2.3, 2026-12-05).
168168
- Hosted pins under `replace-registry-host=always` (patch server or patch mirror): scan warns `redirect_npm_replace_registry_host` and `npm ci` fails E404, as CLI_CONTRACT documents (npm 12.2.3, 2026-12-05).
169+
- Vendored npm 12: following npm's own `npm install-scripts approve <pkg>` after a version-pinned `allowScripts` approval stops matching writes an absolute `file:/…/.socket/vendor/…tgz` approval and drops the version one, so after `rollback` (or on another checkout path) `strict-allow-scripts` fails. socket-patch leaves `allowScripts` untouched by design and its warning names the name-only approval, which works (12.2.3, 2026-12-06).

‎state/npm.md‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[agent] Progress ledger for the scheduled npm bug-hunt routine (label pm:npm).
22

3-
Last run: 2026-12-05, main `cd7c5c5` (v5.2.0 + 2 gem commits), release v5.2.0, newest npm 12.2.3 (next-11 11.21.3, next-10 10.9.11).
3+
Last run: 2026-12-06, main `cd7c5c5` (v5.2.0 + 2 gem commits), release v5.2.0, newest npm 12.2.3 (next-11 11.21.3, next-10 10.9.11).
44

55
Compacted 2026-11-26 from a 110 KB file (runs 1-65 kept in branch history; per-run notes are in `entries/npm/`). Open npm bughunt issues: #2275, #2304, #2331, #2358, #2379, #2476, #2502 (also tracked: #2341 shared `vex` wording, #2423 non-bughunt). Every `#N` below is closed unless marked open.
66

@@ -24,14 +24,14 @@ Linux unless noted. Every cell is a real npm install. Hosted and agent/vendored
2424
| Workspaces: hidden `.github/actions/x` + `build/y` members, 12.2.3 | pass (2026-11-28) | pass (2026-11-28) | pass (2026-11-28) |
2525
| Dual lock (shrinkwrap + package-lock), 10.9.9 / 12.2.3 | n/a | pass (2026-11-26, both locks byte-exact) | pass (2026-11-26) |
2626
| Dual lock one-sided drift (npm 10 updates only the shrinkwrap) | n/a | fail-closed pass (2026-11-27) | fail-closed pass (2026-11-27; unattributable pin, `--json` explains) |
27-
| npm 12 `allow-remote=root` (transitive pin) / `allowScripts` (#1595) / `allow-file` (#969) | n/a | `allowScripts`, `allow-file` pass before 11-11 | `allow-remote=root` respected + warned, `npm ci` EALLOWREMOTE (documented; 2026-11-27) |
27+
| npm 12 `allow-remote=root` (transitive pin) / `allowScripts` (#1595) / `allow-file` (#969) | n/a | `allowScripts` pass 12.2.3 (2026-12-06; core-js postinstall, `strict-allow-scripts`: version-pinned approval warned `vendor_npm_allow_scripts` + ESTRICTALLOWSCRIPTS documented, name-only runs the script patched); `allow-file` before 11-11 | `allow-remote=root` respected + warned, `npm ci` EALLOWREMOTE (documented; 2026-11-27; with a patch mirror 2026-12-06); `allowScripts` pass 12.2.3 (2026-12-06, same as vendored) |
2828
| `overrides` (flat, `$ref`; alias / URL target #1965 before 11-11), fresh `npm ci` and `npm install` | n/a | pass 12.2.3 (2026-11-27) | pass 12.2.3 (2026-11-27) |
2929
| Aliases + scoped (`lp@npm:left-pad`, `@tootallnate/once`), 12.2.3 | pass (2026-11-26) | pass (2026-11-26) | pass (2026-11-26) |
3030
| Alias `lp@npm:left-pad` on an npm 7.24.2 v2 lock (legacy mirror node); npm 6.14.18 cold `npm ci` of the vendored lock | pass (2026-12-05) | pass (2026-12-05) | pass (2026-12-05) |
3131
| Workspace at a path with spaces + unicode (`proj ü x/packages/my app é`), 12.2.3, root cycle | pass (2026-12-05) | pass (2026-12-05) | pass (2026-12-05) |
3232
| Bundled deps (#1618) dependency-bundled copy, 12.2.3; `hasShrinkwrap` nested (#753) | patched (2026-11-28) | refused loudly, exit 1 (2026-11-28) | refused loudly, exit 0 (2026-11-28); `hasShrinkwrap` before 11-11 |
3333
| `install-strategy=linked` / `nested` / `shallow` 12.2.3 (nested/shallow with a transitive patched copy) | pass (linked 2026-11-28; nested, shallow 2026-12-05) | pass (same) | pass (same) |
34-
| Lock layout CRLF / BOM+CRLF / tab; CRLF-shebang bins (#1756) | n/a | layouts pass 12.2.3 (2026-11-27); bins before 11-11 | layouts pass 12.2.3 (2026-11-27); bins before 11-11 |
34+
| Lock layout CRLF / BOM+CRLF / tab; CRLF-shebang bins (#1756) | bins pass 12.2.3 (2026-12-06: apply, re-apply no-op, `vex`, rollback, bin runs) | layouts pass 12.2.3 (2026-11-27); bins pass 12.2.3 (2026-12-06) | layouts pass 12.2.3 (2026-11-27); bins pass 12.2.3 (2026-12-06) |
3535
| Unreadable vendor ledger (merge conflict in `state.json`) | n/a | **fail #2275** (open; remedy loop vex → vendor → repair; v5.1.0 too) | n/a |
3636
| `vex --grype-config` (#2252) | n/a | n/a | pass 12.2.3 (2026-11-26: created, then removed after rollback) |
3737
| Global `--global-prefix` agent scan + rollback | pass 12.2.3 (2026-11-27) | n/a | n/a |
@@ -47,28 +47,31 @@ Linux unless noted. Every cell is a real npm install. Hosted and agent/vendored
4747
| Mode-less `scan --prune` after `npm uninstall` of a vendored dep, 12.2.3 | n/a | GC reverts entry + artifact correctly (2026-11-30); closing totals miscount, see #2304 comment | n/a |
4848
| npm 12 `allow-remote` from env (`npm_config_allow_remote` / `NPM_CONFIG_ALLOW_REMOTE` none/root) or project `.npmrc` none/root/CRLF over hosted pins | n/a | n/a | pass 12.2.3 (2026-12-01): respected, warning names the env var and `npm ci --allow-remote=all` |
4949
| npm 11.21.3 `npm install --save-exact <dep>` / `npm shrinkwrap` over pins | n/a | pass / known non-bug (2026-12-01; shrinkwrap: `vex_npm_shrinkwrap_only`, rollback refuses with rename hint, exit 1) | pass / known non-bug (2026-12-03; `--save-exact` keeps the pin, `npm ci` patched, `vex` ok; after `npm shrinkwrap` `vex` exit 1 `vex_npm_shrinkwrap_only`, rollback restores the shrinkwrap) |
50-
| Git dep (`github:` spec) beside a registry dep on an npm 10.9.9 v2-mirror lock | untested | pass (2026-12-01; git copy refused `vendor_lock_entry_not_rewritable`) | pass (2026-12-01; git copy warned) |
51-
| v4 `postinstall: socket-patch apply --silent --ecosystems npm` hook under v5 (no manifest, manifest, API unreachable); then switch to hosted + rollback, 12.2.3 | pass (2026-12-01) | untested | pass (2026-12-01) |
50+
| Git dep (`github:` spec) beside a registry dep on an npm 10.9.9 v3 / 8.19.4 v2 lock | pass 10.9.9 / 8.19.4 (2026-12-06; both copies patched, `vex`, rollback) | pass (2026-12-01; git copy refused `vendor_lock_entry_not_rewritable`) | pass (2026-12-01; git copy warned) |
51+
| v4 `postinstall: socket-patch apply --silent --ecosystems npm` hook under v5 (no manifest, manifest, API unreachable); then switch to hosted + rollback, 12.2.3 | pass (2026-12-01) | pass 12.2.3 (2026-12-06; `npm ci` online and API-unreachable, `vex`, `vendor --check`, rollback, `npm ci` upstream) | pass (2026-12-01) |
5252
| `node_modules` is a symlink to a cache dir, 12.2.3 | pass (2026-12-01) | n/a | pass (2026-12-01) |
5353
| Agent-mode file `mode` (#2433): content patch + permissions-only patch, umask 002, 12.2.3 | pass (2026-12-02; `vex` wording says "original content" for a mode-only drift, nit) | n/a | n/a |
5454
| Cleanup beside a relocated manifest (#2390): workspaces `packages/` + `blobs/` user files, `--manifest-path` root / `state/` | pass (2026-12-02) | pass (2026-12-02) | pass (2026-12-02) |
5555
| Aliased git dep (`lp: github:left-pad…`) beside registry `left-pad@1.3.0`, 12.2.3 | pass (both copies patched) | pass (git copy refused, `vex` exit 1) | scan pass; standalone `vex` says "No patches … run scan" exit 2 (#2341 open, yarn-classic issue, npm comment 2026-12-02) |
5656
| Credentials in `.npmrc` (`registry=` userinfo, `_authToken`, `_password`) through hosted warnings (allow-remote, omit-lockfile), `--verbose`, `--json`, `vex`, `rollback`, vendored scan / `--check`, 10.9.9 | n/a | pass (2026-12-04, no leak) | pass (2026-12-04, no leak) |
5757
| Credentials in lock URLs (#2445): token in a git dep `resolved` (npm 10.9.9 / 12.2.3 write it verbatim), userinfo in a registry `resolved` | pass (2026-12-03) | **fail #2476** (open; `vendor --check` prints the git token; `scan` / `vex` / `repair` / `list` / `remove` redact) | pass (2026-12-03; rollback restores the registry URL without its userinfo) |
58+
| Patch mirror on npm 7.24.2 / 8.19.4 v2 locks (packages + legacy `dependencies` pinned under the mirror) | n/a | untested | pass (2026-12-06; `npm ci`, `vex`, re-run no-op, rollback byte-exact) |
59+
| Upper-case legacy name (`JSONStream@1.3.5`), 12.2.3 | pass (2026-12-06) | pass (2026-12-06) | pass (2026-12-06) |
60+
| `dev` / `optional` lock flags kept after rewrite; `npm ci --omit=dev` / `--omit=optional`, 12.2.3 | n/a | pass (2026-12-06) | pass (2026-12-06) |
5861
| `report` (#2193) name / scoped / `%40` purl | pass (2026-11-27; alias name `lp` unmatched, same as `rollback`) | n/a | pass (2026-11-27) |
5962
| macOS / Windows | probes switched off (INSTRUCTIONS step 5); last pass 2026-10 | same | same |
6063

6164
## Backlog
6265

63-
1. Re-check #2502, #2476, #2379, #2358, #2331, #2304 and #2275 when fixed (#2358, #2379 re-run 2026-12-05 on `cd7c5c5`: both still reproduce; next re-triage #2331, #2304).
64-
2. Patch mirror on npm 12 with `allow-remote=root` and a transitive pin; mirror on npm 7 / 8 v2 locks.
65-
3. VEX products (#2243): prove or rule out a Grype / Trivy miss for `pkg:npm/@scope/name` vs `%40scope` (the Grype binary was denied 2026-11-27; try Trivy / Syft).
66-
4. Remaining pre-11-11 cells: npm 12 `allowScripts` (needs a patched package with an install script), `hasShrinkwrap` nested, CRLF-shebang bins.
67-
5. v4 postinstall hook with vendored mode; `vex -g` + `--product` vs global-only packages after #2502 is fixed.
68-
6. Archive limits (#2410) on npm vendored: a large real package (>64 MiB unpacked) vendored and checked.
69-
7. Git dep in agent mode on npm 8 / 10; npm 6 hosted cold cache re-run on the new main.
66+
1. Re-check #2502, #2476, #2379, #2358, #2331, #2304 and #2275 when fixed (#2331, #2304 re-run 2026-12-06 on `cd7c5c5`: both still reproduce; next re-triage #2275, #2476).
67+
2. VEX products (#2243): prove or rule out a Grype / Trivy miss for `pkg:npm/@scope/name` vs `%40scope` (the Grype binary was denied 2026-11-27; try Trivy / Syft).
68+
3. Remaining pre-11-11 cells: `hasShrinkwrap` nested, npm 12 `allow-file=none` / `root` over vendored tarballs.
69+
4. `vex -g` + `--product` vs global-only packages after #2502 is fixed.
70+
5. Archive limits (#2410) on npm vendored: a large real package (>64 MiB unpacked) vendored and checked.
71+
6. npm 6 hosted cold cache re-run on the new main; patch mirror in vendored mode on a v2 lock.
72+
7. Interrupted vendored / hosted scan (SIGINT mid-write) on npm 12, then re-run and `npm ci`.
7073

71-
Mock tip: the 2026-12-05 run's Python mock (batch / view / blob / package / tarball routes, marker patch built from the real npm tarball, gzip mtime=0, `sha512-` prefixed SRI) plus a base-path Basic-auth mirror proxy took ~15 min to rewrite; rebuild the mock from the wiremock fixtures in `crates/socket-patch-cli/tests/e2e_redirect_pnpm_build.rs` (batch, view, blob, package, and the npm version document under `npmRegistryUrl`). The hosted mock must be passed as `--patch-server-url` as well as `--api-url`, or lockfile discovery (`vex`, `rollback`) doesn't recognize the pins ("No patches in this project").
74+
Mock tip: the 2026-12-06 run's Python mock (also serves a `/mirror/` base-path alias and an upstream registry under `/up/` for synthetic packages; patches the shebang-safe second line of `package/index.js`) is like the 2026-12-05 one (batch / view / blob / package / tarball routes, marker patch built from the real npm tarball, gzip mtime=0, `sha512-` prefixed SRI) plus a base-path Basic-auth mirror proxy took ~15 min to rewrite; rebuild the mock from the wiremock fixtures in `crates/socket-patch-cli/tests/e2e_redirect_pnpm_build.rs` (batch, view, blob, package, and the npm version document under `npmRegistryUrl`). The hosted mock must be passed as `--patch-server-url` as well as `--api-url`, or lockfile discovery (`vex`, `rollback`) doesn't recognize the pins ("No patches in this project").
7275

7376
## Known non-bugs
7477

0 commit comments

Comments
 (0)