Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: stop npm's inline audit from stalling every install path
Adam Eivy7aa71f527b1a
diff --git a/.npmrc b/.npmrcindex e2b20841e5..e371dff8c7 100644--- a/.npmrc+++ b/.npmrc@@ -27,3 +27,15 @@ ignore-scripts=true# root `setup` / `start` / `dev` scripts instead — a check that gates on this# project's floor and nothing else. `engines` stays for the npm warning and as# the machine-readable declaration.++# Skip the advisory lookup `npm install` runs AFTER it has already resolved and+# written node_modules. It only prints a summary, but npm BLOCKS on it — a+# stalled request costs `fetch-timeout` (300s) times `fetch-retries` (2) before+# npm moves on. On 2026-09-03 that endpoint began completing the TLS handshake+# and never answering, and a 0.15s warm install took 153s; every managed install+# path runs four of them in sequence. Set here rather than as `--no-audit` on a+# dozen call sites for the same reason `ignore-scripts` is: npm reads config from+# the local prefix only, so a flag one path forgets is a silent regression.+# Rationale and what enforces dependency safety instead: docs/DEPS.md+# "Inline Audit Policy".+audit=falsediff --git a/autofixer/.npmrc b/autofixer/.npmrcindex 8c5481f990..45d2a962f4 100644--- a/autofixer/.npmrc+++ b/autofixer/.npmrc@@ -17,3 +17,10 @@ ignore-scripts=true# root `setup` / `start` / `dev` scripts instead — a check that gates on this# project's floor and nothing else. `engines` stays for the npm warning and as# the machine-readable declaration.++# Skip the post-install advisory lookup. npm BLOCKS on it (`fetch-timeout` 300s+# times `fetch-retries` 2), so an endpoint that stalls hangs this workspace's+# install for minutes to print a summary. Same local-prefix rule as above — the+# repo-root file does not cover this workspace's install path.+# Rationale: docs/DEPS.md "Inline Audit Policy".+audit=falsediff --git a/browser/.npmrc b/browser/.npmrcindex dab1a7db8c..437334a363 100644--- a/browser/.npmrc+++ b/browser/.npmrc@@ -6,3 +6,11 @@# it means the guard is already in place if any are ever added, rather than the# addition silently arriving with an install-time execution slot.ignore-scripts=true++# Skip the post-install advisory lookup. npm BLOCKS on it (`fetch-timeout` 300s+# times `fetch-retries` 2), so an endpoint that stalls hangs an install for+# minutes to print a summary. Pre-emptive here for the same reason as the setting+# above — this workspace has no dependencies today, so the guard is in place+# before any arrive rather than added afterwards.+# Rationale: docs/DEPS.md "Inline Audit Policy".+audit=falsediff --git a/client/.npmrc b/client/.npmrcindex c6bb7f64fd..6c59005cd0 100644--- a/client/.npmrc+++ b/client/.npmrc@@ -24,3 +24,10 @@ ignore-scripts=true# root `setup` / `start` / `dev` scripts instead — a check that gates on this# project's floor and nothing else. `engines` stays for the npm warning and as# the machine-readable declaration.++# Skip the post-install advisory lookup. npm BLOCKS on it (`fetch-timeout` 300s+# times `fetch-retries` 2), so an endpoint that stalls hangs this workspace's+# install for minutes to print a summary. Same local-prefix rule as above — the+# repo-root file does not cover this workspace's install path.+# Rationale: docs/DEPS.md "Inline Audit Policy".+audit=falsediff --git a/docs/DEPS.md b/docs/DEPS.mdindex 9cdb7ade4d..968e7b27c7 100644--- a/docs/DEPS.md+++ b/docs/DEPS.md@@ -181,3 +181,11 @@ These exist purely to force-bump transitive deps; revisit if `npm audit` flags n`ignore-scripts=true` is pinned in **every** workspace's own `.npmrc` (root, `client/`, `server/`, `autofixer/`, `browser/`) — not just the repo root. The list is not maintained by hand: `discoverWorkspaces()` in `scripts/trusted-rebuilds.js` globs every top-level directory carrying a `package.json`, and the test asserts each discovered one has the setting — so a workspace added later is caught rather than silently unguarded. npm resolves the project `.npmrc` from the *local prefix* and never walks up the directory tree, so a root-only setting does not cover `cd client && npm install` or `npm ci --prefix server` (what CI runs). Deleting any workspace `.npmrc` silently re-grants every dependency in that workspace an install-time code-execution slot — the vector the Shai-Hulud worm used.Packages that legitimately need an install script are named explicitly in the allowlist in `scripts/trusted-rebuilds.js`, the single source consumed by `npm run setup`, `scripts/ensure-deps.js`, `setup.ps1`, `update.sh` / `update.ps1`, and CI. `scripts/trusted-rebuilds.test.js` fails if a workspace `.npmrc` loses the setting, or if a dependency appears with an install hook that nobody has explicitly decided about. Because CI caches `server/node_modules` between jobs, `scripts/trusted-rebuild-stamp.js` writes a mark into the tree in the same step that rebuilds it and checks that mark after a cache restore — a tree cached before the rebuild is otherwise indistinguishable from a good one, since the allowlisted packages all ship prebuilt bindings and import fine either way.++## Inline Audit Policy++`audit=false` is pinned in the same five `.npmrc` files, enforced by the same discovered-workspace test. This turns off only the advisory lookup `npm install` performs *after* it has already resolved and written `node_modules` — it does not change what gets installed.++It is off because it is a hang risk on the path that matters least. The lookup only prints a summary, but npm **blocks** on it, and a request that stalls costs `fetch-timeout` (300s by default) times `fetch-retries` (2) before npm gives up. On 2026-09-03 the endpoint began completing the TLS handshake and then never sending a byte; a warm root install that takes 0.15s took **153.88s**, of which 0.22s was CPU and the rest was a socket wait. Every managed install path runs four workspace installs in sequence (`update.sh`, `update.ps1`, `setup.ps1`, `npm run setup`, `scripts/ensure-deps.js`), so a self-update stalled for roughly ten minutes on a report written to `data/update.log`. PortOS is distributed software that self-updates on machines nobody is watching, so a third-party endpoint must not be able to wedge the update path for something advisory.++Nothing is lost. Dependency safety here is enforced statically rather than by a live network call: direct dependencies are pinned to exact versions and the `overrides` blocks are pinned too, both asserted by `server/dependency-overrides.test.js` — which deliberately replaced an `npm audit` shell-out because "audit needs the network and its output drifts". CI never ran `npm audit` either. Run `npm audit` directly when you want the report; the periodic dependency audits recorded in this document are where it belongs.diff --git a/scripts/trusted-rebuilds.test.js b/scripts/trusted-rebuilds.test.jsindex 659cfb379e..219b5d9b31 100644--- a/scripts/trusted-rebuilds.test.js+++ b/scripts/trusted-rebuilds.test.js@@ -87,7 +87,17 @@ function packagesWithInstallHooks(label) {return found;}-describe('ignore-scripts guard', () => {+/** A workspace's .npmrc settings, comments and blank lines stripped. */+function npmrcSettings(label) {+ const npmrc = join(workspaceDir(label), '.npmrc');+ expect(existsSync(npmrc), `${label}/.npmrc is missing — npm does not inherit the root .npmrc for this workspace's install path`).toBe(true);+ return readFileSync(npmrc, 'utf8')+ .split('\n')+ .map((line) => line.trim())+ .filter((line) => line && !line.startsWith('#'));+}++describe('workspace .npmrc guards', () => {it('discovers every installable workspace', () => {// Sanity-check the discovery itself: if it silently returned only the root,// every per-workspace assertion below would vacuously pass.@@ -103,13 +113,19 @@ describe('ignore-scripts guard', () => {// re-grants every dependency in it an install-time code-execution slot — the// vector the Aug 2026 keyv/cacheable worm used via a preinstall hook.it.each(WORKSPACES)('%s/.npmrc pins ignore-scripts=true', (label) => {- const npmrc = join(workspaceDir(label), '.npmrc');- expect(existsSync(npmrc), `${label}/.npmrc is missing — npm does not inherit the root .npmrc for this workspace's install path`).toBe(true);- const lines = readFileSync(npmrc, 'utf8')- .split('\n')- .map((line) => line.trim())- .filter((line) => line && !line.startsWith('#'));- expect(lines, `${label}/.npmrc must set ignore-scripts=true`).toContain('ignore-scripts=true');+ expect(npmrcSettings(label), `${label}/.npmrc must set ignore-scripts=true`).toContain('ignore-scripts=true');+ });++ // `npm install` performs an advisory lookup AFTER it has finished writing+ // node_modules, and BLOCKS on it: a stalled request costs fetch-timeout (300s)+ // times fetch-retries (2) before npm moves on. On 2026-09-03 that endpoint began+ // accepting the TLS handshake and never answering, which cost a measured 153s per+ // workspace — four workspaces per managed install path — for a summary that goes+ // to a log file. Same local-prefix rule as above: the root file does not cover+ // `cd client && npm install`, so a workspace missing this line silently reopens+ // the stall for every install path at once.+ it.each(WORKSPACES)('%s/.npmrc pins audit=false', (label) => {+ expect(npmrcSettings(label), `${label}/.npmrc must set audit=false`).toContain('audit=false');});});diff --git a/server/.npmrc b/server/.npmrcindex 409f7dbe81..6102bf1863 100644--- a/server/.npmrc+++ b/server/.npmrc@@ -28,3 +28,10 @@ ignore-scripts=true# root `setup` / `start` / `dev` scripts instead — a check that gates on this# project's floor and nothing else. `engines` stays for the npm warning and as# the machine-readable declaration.++# Skip the post-install advisory lookup. npm BLOCKS on it (`fetch-timeout` 300s+# times `fetch-retries` 2), so an endpoint that stalls hangs this workspace's+# install for minutes to print a summary. Same local-prefix rule as above — the+# repo-root file does not cover this workspace's install path.+# Rationale: docs/DEPS.md "Inline Audit Policy".+audit=false