Skip to content

Commit bb16cf8

Browse files
committed
npm: run 19 ledger (#828, #812 comment)
1 parent 8355eeb commit bb16cf8

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

‎entries/npm/20261005T062142Z.md‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[agent] 2026-10-05 06Z: npm bug-hunt run
2+
3+
**Tested:** main `045d7ec` (unchanged), latest release v4.0.0. Linux sandbox: npm 8.19.4 and 10.9.4 on Node 22.22, npm 12.2.0 on Node 24.21. I wrote a fresh Python mock of the public patch proxy (`SOCKET_PROXY_URL` + `--patch-server-url`; routes `/patch/batch`, `/patch/by-package`, `/patch/view`, `/patch/blob`, `/patch/package`, plus a hosted `ms-2.1.3.tgz`).
4+
5+
## Re-triage
6+
Main hasn't moved and no human has commented on #302, so I skipped re-triage.
7+
8+
## Cells (Linux)
9+
- **Baseline hosted cycle, npm 10.9.4: pass.**
10+
- **#812 variants:** `replace-registry-host=always` in the **user** `.npmrc` fails: cold-cache `npm ci` gives E404 and the scan says nothing. A **warm cache hides it** (`npm ci` succeeds patched). A hostname value that isn't the hosted origin passes. I commented on #812.
11+
- **Hosted → vendored takeover with a bundled copy plus a root registry copy of the same `name@version`: fail, filed #828** (npm 8.19.4 v2, 10.9.4 v3 twice, 12.2.0 v3). The takeover skips the upstream restore (no `vendor_takeover_reverted_redirect`), the vendor ledger records the hosted URL as `original`, `.npmrc` `allow-remote=all` stays, and `vendor --revert` lands back on hosted. Hosted `rollback` / `remove` refuse the pin (`patched_ref_unattributable`) with a remedy ("re-run scan --mode hosted") that loops. The control (no bundled copy) passes: restore note, `.npmrc` deleted.
12+
- **Vendored with a bundled copy (from a hosted start): pass.** The skip warning, `npm ci` patches the root copy, and `vex` refuses `patched_ref_unattributable`.
13+
14+
## Issues
15+
- Filed **#828** (https://github.com/SocketDev/socket-patch/issues/828).
16+
- Commented on **#812** (user-config scope, warm-cache masking).
17+
18+
## False positives ruled out
19+
- The first user-config `replace-registry-host` attempt "passed" because the sandbox sets `NPM_CONFIG_USERCONFIG=/root/.npmrc`, so `$HOME/.npmrc` wasn't read. Once I pointed `NPM_CONFIG_USERCONFIG` at it, it reproduced.
20+
- The first `npm ci` "passed" because of a warm cache. Use `--cache <fresh dir>` for #812 checks.
21+
- `vex -o` is `--org`, not output (`-O`). That was a harness typo.
22+
- v4.0.0 has no like-for-like cell for #828 (its hosted `rollback` needs `.socket/manifest.json`), so it isn't bisected.
23+
24+
## Probe branches
25+
None. Still paused, and the 10 stale branches are still there.
26+
27+
## Next
28+
1. #828 follow-ups: `get --mode vendored` takeover (same code path?), the real-world `npm` bundle (`ansi-regex`) shape, and a dual lock where only one lock carries the bundle.
29+
2. Other `ContestedWiring` shapes reaching the takeover silently, e.g. a #798 stale twin: does `scan --mode vendored` skip the restore there too?
30+
3. #711 follow-ups (nested / workspace `npm patch` copies; agent `--strict`).
31+
4. #626 follow-ups (`apply --check` / `repair` over a link).
32+
5. Re-check #798 / #325 / #432 when #799 / #669 / #813 land.

‎state/npm.md‎

Lines changed: 7 additions & 4 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 updated: 2026-10-05 (run 18 with a ledger), main `045d7ec` (re-run 2026-10-05T00Z, unchanged; v5 + the #324/#326/#359/#403/#434/#454/#490/#516/#541 fixes and #570 API timeouts; the binary still reports 4.0.0), latest release v4.0.0 (previous v3.3.0, both from npm `@socketsecurity/socket-patch`). v5 makes hosted the default, removes `setup`, and makes hosted `rollback` re-resolve upstream registry entries. Cells marked (v4) were last verified on `f6b7fb9`.
3+
Last updated: 2026-10-05T06Z (run 19 with a ledger), main `045d7ec` (re-run 2026-10-05T06Z, unchanged; v5 + the #324/#326/#359/#403/#434/#454/#490/#516/#541 fixes and #570 API timeouts; the binary still reports 4.0.0), latest release v4.0.0 (previous v3.3.0, both from npm `@socketsecurity/socket-patch`). v5 makes hosted the default, removes `setup`, and makes hosted `rollback` re-resolve upstream registry entries. Cells marked (v4) were last verified on `f6b7fb9`.
44

55
## Coverage matrix
66

@@ -13,7 +13,7 @@ Cells are "pass", "fail #N" or "untested". Every cell uses a real npm install. H
1313
| Linux | 8.19.4 | fail #356 (v4). #403 / #516 closed by fixes | fail #432, **#588** (same-lock unwired copy), **#665**, **#688**. pass: alias takeover (with the #432 warning), cycle + `--omit=dev`, workspaces, takeovers, rescan no-op | pass: `peer: true` lock-entry cycle, nested v2 cycle, shrinkwrap-only, workspaces, takeovers, rescan no-op, `overrides` (flat, alias, nested). fail #432 (alias mirror, npm 6 consumer), #490 (override over a git spec; closed by #491, not re-checked), **#588** (`--no-verify`), **#753** (`hasShrinkwrap` nested copy) | pass: all four (custom prefix) |
1414
| Linux | 9.2.0 / 9.9.4 | pass: 9.2.0 `install-links=true` `file:` dir dep cycle; `-g` (v4); Node 18 cycle | pass: 9.2.0 `install-links` `file:` dep cycle, cycle + `--omit=dev` (main), Node 18 cycle | pass: 9.2.0 `install-links` `file:` dep cycle, cycle (alias, nested, dev), Node 18 cycle. fail **#753** | pass (v4) |
1515
| Linux | 10.9.9 | pass: plain cycle (alias still #356) | pass: cycle, `overrides` + `file:` dependent | pass: cycle, `overrides`, shrinkwrapped `file:` tarball dep | untested |
16-
| Linux | 10.8.2 (Node 18) / 10.9.x | fail **#732** (human `scan --mode agent` / `--sync` after `npm ci`: exit 0, unpatched; `--json` re-applies). pass: Node 18 cycle. fail **#554** (re-checked on `203e092`), **#356** (re-checked on `203e092`; alias-only scan now exits 0). pass: agent vex refuses a reverted nested copy (#516 fixed), bundled copy (both copies patched + vex) | fail **#753** (`hasShrinkwrap` nested copy: `vex` exit 0 not_affected, `vendor --check` passes, npm installs unpatched; 8.19.4 too). pass: CRLF / BOM / tab layout cycle (#324 fixed), `--omit=dev`, agent↔vendored takeovers, rescan after a version bump (#541 fixed), hosted→vendored takeover over a dual lock and an alias. fail **#588** (same-lock unwired copy), **#665** (`npm uninstall` of a vendored dep: rollback exit 1 forever), **#688** (`file:` dir named like the package: refused, and the takeover un-hosts), **#687** (a failed eject rewrites every root file), **#798** (stale package-lock twin without the entry: lockfile-only `vex` attests), #725 (`vendor --check` ignores wiring). pass: `peer: true` lock entry | pass: `peer: true` and `devOptional` lock entries (`--omit=peer/dev/optional`), cycles (plain, alias, nested), `file:` dependency's own dependency (`install-links` true / false), self-referential `file:.` link, rollback → in-place `npm install` / `npm ci` restores upstream, `npm ci --omit=dev` + vex, shrinkwrapped `file:` dep, `JSONStream`, agent↔hosted takeovers, stale tree, lockfile-only, dry-run, rescan no-op, nested project (loud), `registry=` mirror, `.npmrc` variants, `overrides` (incl. `$ref`, nested object), policy (`--package`, `maxNewPatches`, `ignorePackages`, `minSeverity`), CRLF / BOM / tab / no-newline layout cycle. fail **#798** (stale twin), #325 (in-run `--vex` only, reopened), **#588** (`--no-verify` only; default `vex` refuses), **#753** (`hasShrinkwrap` nested copy: `npm ci` unpatched, lockfile-only `vex` attests) | pass: all four, `--global-prefix`, `SOCKET_GLOBAL`, `--mode hosted` refused. fail #464 (report-only hint has no `-g`) |
16+
| Linux | 10.8.2 (Node 18) / 10.9.x | fail **#732** (human `scan --mode agent` / `--sync` after `npm ci`: exit 0, unpatched; `--json` re-applies). pass: Node 18 cycle. fail **#554** (re-checked on `203e092`), **#356** (re-checked on `203e092`; alias-only scan now exits 0). pass: agent vex refuses a reverted nested copy (#516 fixed), bundled copy (both copies patched + vex) | fail **#753** (`hasShrinkwrap` nested copy: `vex` exit 0 not_affected, `vendor --check` passes, npm installs unpatched; 8.19.4 too). pass: CRLF / BOM / tab layout cycle (#324 fixed), `--omit=dev`, agent↔vendored takeovers, rescan after a version bump (#541 fixed), hosted→vendored takeover over a dual lock and an alias. fail **#588** (same-lock unwired copy), **#665** (`npm uninstall` of a vendored dep: rollback exit 1 forever), **#688** (`file:` dir named like the package: refused, and the takeover un-hosts), **#687** (a failed eject rewrites every root file), **#798** (stale package-lock twin without the entry: lockfile-only `vex` attests), #725 (`vendor --check` ignores wiring). pass: `peer: true` lock entry. fail **#828** (hosted→vendored takeover over a pin with a bundled copy alongside: restore skipped, ledger records the hosted URL, `.npmrc` kept, revert lands on hosted; 8.19.4 / 12.2.0 too) | fail **#828** (`rollback` / `remove` refuse a pin with a bundled copy alongside, and the remedy loops; 8.19.4 / 12.2.0 too). pass: `peer: true` and `devOptional` lock entries (`--omit=peer/dev/optional`), cycles (plain, alias, nested), `file:` dependency's own dependency (`install-links` true / false), self-referential `file:.` link, rollback → in-place `npm install` / `npm ci` restores upstream, `npm ci --omit=dev` + vex, shrinkwrapped `file:` dep, `JSONStream`, agent↔hosted takeovers, stale tree, lockfile-only, dry-run, rescan no-op, nested project (loud), `registry=` mirror, `.npmrc` variants, `overrides` (incl. `$ref`, nested object), policy (`--package`, `maxNewPatches`, `ignorePackages`, `minSeverity`), CRLF / BOM / tab / no-newline layout cycle. fail **#798** (stale twin), #325 (in-run `--vex` only, reopened), **#588** (`--no-verify` only; default `vex` refuses), **#753** (`hasShrinkwrap` nested copy: `npm ci` unpatched, lockfile-only `vex` attests) | pass: all four, `--global-prefix`, `SOCKET_GLOBAL`, `--mode hosted` refused. fail #464 (report-only hint has no `-g`) |
1717
| Linux | 11.20 / 11.21 / 11.6.2 | pass (v4); linked `.store` scoped transitive (11.21, #359 fixed). fail #403 (v4) | pass (v4). #490 (11.21; closed by #491, not re-checked). fail **#753** (11.6.2: `vex` attests a `hasShrinkwrap` nested copy npm installs unpatched) | pass: scoped, duplicate nested workspace copies, dual-lock drift, `omit-lockfile-registry-resolved`, `overrides`, `install-strategy=linked/nested/shallow`. fail **#753** (11.6.2) | pass: all four (11.6.2, custom prefix) |
1818
| Linux | 12.1 / 12.2.0 | fail #356, **#554** (12.2.0), **#732** (12.2.0). `npm patch` user patch overwritten (documented non-strict fallback; see #711) | fail **#588** (12.2.0), **#665**, **#688** (12.2.0 / Node 24). pass: hosted→vendored takeover + rollback, `--omit=dev`, workspaces, `remove` in a workspace, Node 26, `repair`, BOM+CRLF / tab cycle (12.2.0), `install-strategy=linked`, `overrides`. fail **#711** (lockfileVersion 4 refused with wrong advice), **#659** (takeover over a v4 lock un-hosts, then refuses) | fail **#588** (`--no-verify`, 12.2.0), **#798** (npm 12 installs unpatched from a stale package-lock twin that `vex` ignores). pass: `peer: true` lock entry, `install-strategy=linked`, Node 26, `remove` in a workspace, `allow-remote=all` from env / user config still persisted, BOM+CRLF / tab cycle (12.2.0), workspace + alias cycle, dual-lock, drift, `npm install <pkg>` keeps the pin, path-scoped rollback, remove, `registry=` mirror, CRLF / spaced `.npmrc`, `min-release-age`, `strict-npmrc`, `hasShrinkwrap` nested copy (#753 doesn't apply on npm 12), lockfileVersion 4 + non-overlapping `npm patch`: cycle, `rollback` / `remove` byte-exact, `repair` no-op (12.2.0). fail #433, **#711** (`patchedDependencies` / lockfileVersion 4: exit 0, then EPATCHFAILED or `vex` hash_mismatch; 12.1.0 + 12.2.0) | pass: all four |
1919
| macOS | 10.9.7 | pass: linked `.store` apply/vex/rollback (main, #359 fixed). fail #356, #403 (v4) | pass: cycle + `--omit=dev`, revert (main) | pass: cycle, linked cycle (probe) | pass: all four (custom prefix) |
@@ -24,7 +24,7 @@ Cells are "pass", "fail #N" or "untested". Every cell uses a real npm install. H
2424

2525
## npm config that rewrites hosted pins (#812)
2626

27-
`replace-registry-host=always` (npm ≥ 8) rewrites the hosted pin's origin to the configured registry, so `npm ci` / `npm install` fail E404. The hosted scan exits 0 with no warning. **fail #812** on Linux npm 8.19.4 / 10.9.4 / 12.2.0 (project `.npmrc` and env). Vendored isn't affected; npm 6 / 7 don't have the setting.
27+
`replace-registry-host=always` (npm ≥ 8) rewrites the hosted pin's origin to the configured registry, so `npm ci` / `npm install` fail E404. The hosted scan exits 0 with no warning. **fail #812** on Linux npm 8.19.4 / 10.9.4 / 12.2.0 (project `.npmrc`, env, and user `.npmrc` via `NPM_CONFIG_USERCONFIG`). A warm npm cache masks it; test with `npm ci --cache <fresh>`. A hostname value that isn't the hosted origin passes. Vendored isn't affected; npm 6 / 7 don't have the setting.
2828

2929
Other 2026-10-05 passes (Linux): prerelease version (`ms@3.0.0-canary.1`) hosted / vendored / agent cycles (npm 10.9.4); #798 follow-up (npm 12 `npm install` regenerates the twin → `vex` refuses → re-scan wires both → patched); a real `file:` link cycle crawl (npm 10.9.4).
3030

@@ -34,7 +34,8 @@ Agent mode follows a `node_modules` link into a workspace member, a `file:` dir
3434

3535
## Backlog
3636

37-
- **#812 variants:** `replace-registry-host=always` in `~/.npmrc` / global npmrc; a hostname value; a `registry=` mirror + `always`. macOS / Windows once probe branches are allowed again.
37+
- **#828 follow-ups:** `get --mode vendored` takeover; the real `npm` bundle (`ansi-regex`) shape; a dual lock where only one lock carries the bundle; other `ContestedWiring` shapes (#798 stale twin) reaching the vendored takeover silently.
38+
- **#812 variants:** global npmrc; a `registry=` mirror + `always`. macOS / Windows once probe branches are allowed again. (User `.npmrc` and hostname value done 2026-10-05T06Z.)
3839
- (#798 re-scan follow-up done 2026-10-05T00Z: pass. Re-check when #799 lands.)
3940
- (#753 follow-ups done 2026-10-04T12Z: npm 12 `npm install` pass, workspace member same as #753 on 10/11 and pass on 12, agent mode pass, hosted→vendored takeover on npm 12 pass.)
4041
- (Bun handover done 2026-10-04T12Z: after hosted `rollback` / `vendor --revert`, `npm install` and `npm ci` restore upstream bytes on npm 7/10/11/12.)
@@ -107,4 +108,6 @@ Agent mode follows a `node_modules` link into a workspace member, a `file:` dir
107108
- `rollback` / `remove` delete a user-authored project `.npmrc` that is exactly `allow-remote=all\n`, even when it existed before the hosted scan. That's documented (CLI_CONTRACT: a file that is exactly hosted mode's own is deleted, because v5 keeps no provenance).
108109
- npm 12.2.0 installs a copy nested under a `hasShrinkwrap` dependency from the root lock, so hosted / vendored rewrites of it work there. #753 covers npm 6–11 only.
109110
- A dual lock whose shrinkwrap lacks the package and whose package-lock twin has it: lockfile-only discovery reads the shrinkwrap, so `scan` finds nothing and writes nothing (loud; no claim made).
111+
- The sandbox sets `NPM_CONFIG_USERCONFIG=/root/.npmrc`, so a scratch `$HOME/.npmrc` is ignored unless you repoint that variable (a harness artifact).
112+
- `vex -o` is `--org`; the output flag is `-O` / `--output`.
110113
- `vendor --check` verifying only the artifact (not the lock wiring) for npm is tracked in #725 (generic root cause, draft fix #730). Don't re-file it per npm shape.

0 commit comments

Comments
 (0)