Skip to content

Commit 496022b

Browse files
committed
npm bughunt run 70: file:/git dep cells, #2379
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aePr3eJc9uxEf6czmWE
1 parent c35339b commit 496022b

3 files changed

Lines changed: 38 additions & 5 deletions

File tree

‎entries/npm/20261130T065228Z.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[agent] 2026-11-30: npm bug-hunt run
2+
3+
Run 70. I tested main `cfc870f` (unchanged since run 66) and v5.1.0 (from npm) on Linux with Node 22.23.5 and npm 12.2.3, 8.19.4 and 6.14.18. A local Python mock of the patch API (org routes) served marker patches for the real `left-pad@1.3.0` and `is-number@7.0.0`. No new npm release since the last run (latest 12.2.3).
4+
5+
**Re-triage**
6+
- #2379 (new), #2358, #2331, #2304, #2275: main hasn't changed since they were filed, so I didn't re-run them.
7+
8+
**Cells** (real npm installs, cold `npm ci` after each rewrite, then `vex` and `rollback`)
9+
- `npm update` and `npm audit fix` over vendored pins (12.2.3): npm puts both entries back on the registry. Known non-bug. `vex` omits them (`vendor_unwired`), `vendor --check` reports drift, and a bare re-scan rewires.
10+
- A direct `github:` dependency (npm 12 needs `allow-git=all`) beside a registry dependency: **pass** in hosted, vendored and agent. The git copy is refused loudly, and the registry dependency is pinned, installed patched and rolled back cleanly.
11+
- A `file:./libs/a` directory dependency whose own `left-pad@1.3.0` nests at `libs/a/node_modules/left-pad` (the root has 1.2.0): **pass** on 12.2.3 (v3) in all three modes. On 8.19.4 (v2) hosted and vendored rewrite the nested legacy-mirror node too, and a cold `npm ci` by npm 8 and by npm 6 installs the patched bytes. `rollback` leaves git clean.
12+
- A mode-less `scan --prune` after `npm uninstall` of a vendored dependency: the GC is correct (it reverts the entry, the artifact and the lock), but the closing totals say "1 vulnerability left to patch" for the still-vendored package. That's the same root cause as #2304; I commented there.
13+
- `.npmrc` `package-lock=false` with no lock (12.2.3 / 8.19.4): **fail**, filed below.
14+
15+
**Issues**
16+
- Filed #2379 (https://github.com/SocketDev/socket-patch/issues/2379). Vendored scan fails `vendor_lockfile_missing` with "run your package manager's install first", which never writes a lock under `package-lock=false`, so the user loops. Hosted warns `redirect_npm_no_lockfile` and doesn't mention the setting. The pnpm counterpart already has `redirect_pnpm_lockfile_disabled`. Same on v5.1.0. This is friction, not harm.
17+
- Commented on #2304 (https://github.com/SocketDev/socket-patch/issues/2304#issuecomment-7271031999): the mode-less `scan --prune` path shows the same miscount.
18+
19+
**False positives ruled out**
20+
- `npm update` / `npm audit fix` dropping vendored pins is npm behaviour (already in known-non-bugs).
21+
- Hosted `rollback` keeping `allow-remote=all` in a pre-existing `.npmrc` (`npm_allow_remote_left`) is documented.
22+
23+
**Next**
24+
1. `allow-remote` from the environment or a user `~/.npmrc` overriding the project's `allow-remote=all`.
25+
2. Git dependencies on npm 8 / 10 v2 locks; the patch-mirror backlog items.

‎known-non-bugs/npm.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,5 @@ One line each. Moved from state/npm.md on 2026-11-26; search with git grep.
157157
- Mock tip (2026-11-28): with a hosted mock on `--api-url` only, `vex` / `rollback` say "No patches in this project" because the pinned host isn't the patch server. Pass `--patch-server-url <mock>` too.
158158
- A dependency's bundled copy (`inBundle: true` under a `file:` tarball parent): hosted warns and exits 0 with "Switched 0", vendored fails `vendor_lock_entry_not_rewritable` (exit 1), agent patches in place. Same exit asymmetry as the other hosted-warn / vendored-refuse cases (2026-11-28, npm 12.2.3).
159159
- 2026-11-29: a bare `scan` after `rollback` of a vendored project re-pins it in hosted mode. That's v5's documented default for a project with no patch state, not a rollback failure.
160+
- 2026-11-30: `npm update` / `npm audit fix` re-resolve vendored pins to the registry even when the version doesn't change (12.2.3). `vex` omits `vendor_unwired`, `vendor --check` reports "wiring drifted", and a bare re-scan rewires (bumping only `vendoredAt`). npm behaviour, same as the hosted entry.
161+
- 2026-11-30: a mode-less `scan --prune` is report-only (CLI_CONTRACT `--mode` row), so it skips a vendored package with "run `scan --mode vendored`". Only its closing "left to patch" line is wrong, and that's #2304.

‎state/npm.md‎

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

3-
Last run: 2026-11-29, main `cfc870f`, release v5.1.0, newest npm 12.2.3 (next-11 11.21.3, next-10 10.9.11).
3+
Last run: 2026-11-30, main `cfc870f`, release v5.1.0, newest npm 12.2.3 (next-11 11.21.3, next-10 10.9.11).
44

5-
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. Every `#N` below is closed unless marked open.
5+
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. Every `#N` below is closed unless marked open.
66

77
## Coverage matrix
88

@@ -37,17 +37,23 @@ Linux unless noted. Every cell is a real npm install. Hosted and agent/vendored
3737
| Mode switching hosted → vendored → agent → hosted → vendored → rollback (12.2.3); vendored → agent → vendored (10.9.9); workspaces hosted → vendored → agent → hosted (8.19.4 / 12.2.3) | **fail #2304** (open; vendored → agent totals say "left to patch"; same on 10 / 8 / workspaces) | pass (2026-11-28) | pass (2026-11-28) |
3838
| Lock-rewriting npm commands over pins: `dedupe`, `prune`, `install --package-lock-only`, `--install-links` (12.2.3); `dedupe`, `--lockfile-version=3` (8.19.4) | n/a | pass (2026-11-29) | pass (2026-11-29) |
3939
| v3 lock rewritten as v2 after pinning (npm 7.24.2 `npm install`; 12.2.3 `--lockfile-version=2`), then `rollback` | n/a | **fail #2358** (open; re-scan → rollback loops; no re-scan → silent half-revert of the mirror; v5.1.0 too). Vendored at v2 from the start: pass (2026-11-29) | pass 12.2.3 (2026-11-29) |
40+
| Direct git dep (`github:` spec, npm 12 `allow-git=all`) beside a registry dep, 12.2.3 | pass (2026-11-30; git copy skipped) | registry dep pass, git copy refused loudly `vendor_lock_entry_not_rewritable` (2026-11-30) | registry dep pass, git copy warned (2026-11-30) |
41+
| `file:./libs/a` dir dep whose own dep nests at `libs/a/node_modules/left-pad` (12.2.3 v3; 8.19.4 v2 mirror, npm 6 cold `npm ci` of it) | pass 12.2.3 (2026-11-30) | pass 12.2.3 / 8.19.4 / npm 6 consumer (2026-11-30) | pass 12.2.3 / 8.19.4 (2026-11-30) |
42+
| No lock at all (`.npmrc` `package-lock=false`), 12.2.3 / 8.19.4 | n/a | **fail #2379** (open; `vendor_lockfile_missing` remedy "run install" loops; v5.1.0 too) | `redirect_npm_no_lockfile`, no hint at the setting (#2379) |
43+
| `npm update` / `npm audit fix` over vendored pins, 12.2.3 | n/a | npm drops the pins (known non-bug); `vex` / `vendor --check` fail closed, a bare re-scan rewires (2026-11-30) | known non-bug |
44+
| 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 |
4045
| `report` (#2193) name / scoped / `%40` purl | pass (2026-11-27; alias name `lp` unmatched, same as `rollback`) | n/a | pass (2026-11-27) |
4146
| macOS / Windows | probes switched off (INSTRUCTIONS step 5); last pass 2026-10 | same | same |
4247

4348
## Backlog
4449

45-
1. Re-check #2358, #2331, #2304 and #2275 when fixed.
50+
1. Re-check #2379, #2358, #2331, #2304 and #2275 when fixed.
4651
2. VEX products (#2243): prove or rule out a Grype / Trivy miss for `pkg:npm/@scope/name` vs `%40scope`. The sandbox policy denied running the Grype binary (2026-11-27). Try Trivy / Syft from npm or pip, or hand over.
47-
3. Other lock re-saves over vendored and hosted pins: `npm update`, `save-exact` installs of a new dep, `npm audit fix`, and `npm shrinkwrap` converting package-lock.json to a shrinkwrap after pinning.
52+
3. `allow-remote` set outside the project (`npm_config_allow_remote=root` env, user `~/.npmrc`) over a hosted project's `allow-remote=all`: does scan warn, and does `npm ci` fail EALLOWREMOTE?
4853
4. Remaining pre-11-11 cells: npm 12 `allowScripts` (needs a patched package with an install script), `hasShrinkwrap` nested, CRLF-shebang bins, `install-strategy=nested/shallow`.
4954
5. Patch mirror on npm: vendored eject over mirrored pins, `allow-remote=root` with a mirror host, `SOCKET_PATCH_MIRROR_AUTHORIZATION` with `.npmrc` `_auth`.
50-
6. `scan --prune` vendored revert reporting (#2246) on npm.
55+
6. `npm install --save-exact <new dep>` and `npm shrinkwrap` on npm 11.21.3 over vendored pins (npm 12 shrinkwrap-only is EUSAGE, known).
56+
7. Git dep on npm 8 / 10 (v2 mirror `version: git+...`) beside pins; aliased git dep (`lp@github:...`).
5157

5258
Mock tip: 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").
5359

0 commit comments

Comments
 (0)