Skip to content

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

fix: make the ignore-scripts guard actually apply to every install path

Adam Eivy3244c0b27aad
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 26cc718c03..65ec68d8b8 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -14,6 +14,12 @@
## Fixed
+- **The `ignore-scripts` supply-chain guard was silently inactive for every workspace install, including CI.** The repo-root `.npmrc` has pinned `ignore-scripts=true` for a while, but npm resolves the project `.npmrc` from the *local prefix* and never walks up the directory tree — so it never applied to `cd client && npm install`, `cd server && npm install`, or `npm ci --prefix server` / `--prefix client`, which is exactly what CI runs and what the documented per-workspace test workflow uses. In those paths every dependency kept an install-time code-execution slot: the same slot the August 2026 keyv/cacheable (Shai-Hulud) worm used, via a `preinstall` hook, to harvest credentials before any application code ran. `client/`, `server/`, and `autofixer/` now each carry their own `.npmrc`, so the guard holds in all six install paths.
+
+ Closing the hole made the trusted-rebuild allowlist load-bearing for the first time, and it had drifted across its four copies (the root `setup` script, `scripts/ensure-deps.js`, `update.sh`, `update.ps1`): the `esbuild` entries were dead — vite 8 dropped that dependency — while `onnxruntime-node` and `protobufjs` were missing entirely, so CI ran install hooks that the local setup skipped. All four now read one allowlist from `scripts/trusted-rebuilds.js`, and CI rebuilds it explicitly after installing server dependencies so `node-pty`'s native binding is still present for the smoke-boot. `scripts/trusted-rebuilds.test.js` fails if any workspace `.npmrc` loses the setting, or if a dependency shows up with an install hook nobody has decided about — the second case being how a missing native build otherwise surfaces much later as a confusing runtime crash.
+
+- **Release notes told fresh-clone users to run `npm install`, which cannot produce a working install.** The fallback release-notes template in `.github/workflows/release.yml` printed a `git clone` + `npm install` + `pm2 start` sequence, but a bare root `npm install` skips the client, server, and Autofixer workspaces, never initializes the bundled submodules, and does no data/database provisioning. It now points at `npm run install:all`, matching the README.
+
- **Replaced a real Tailscale identity with placeholders across tracked files, and added a guard so it can't come back.** A real MagicDNS tailnet suffix, real device names, and a real CGNAT peer IP had been committed across server routes/lib, client lib, several test fixtures, two design-plan docs, and two released changelog entries — ~14 tracked files in a public repo. This violates the repo's own `CLAUDE.md` "Sensitive Data & Privacy" rule, which lists Tailscale node/MagicDNS names and Tailscale/LAN IPs as never-commit categories. Every occurrence is now an obviously-fake placeholder (`example-tailnet.ts.net`, `host-alpha`/`beta`/`gamma`/`delta`, a documented CGNAT test IP), preserving the two-host distinctness some tests relied on. A new `scripts/tailnet-identity-leak.test.js` enumerates *tracked* files via `git grep` and fails the moment a real-looking tailnet host or CGNAT address lands again — whether via a pasted log line, a doc example lifted from a live install, or a copy-pasted test fixture.
These are identifiers, not credentials — Tailscale ACLs still gate all actual network access, and no auth key, token, or secret was ever committed. The historical occurrences remain in git history by deliberate decision (see #3455): a `git filter-repo` rewrite would break every fork and clone of this fork-aware project to remove values that grant no access on their own.
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1e5a001179..35bb9a8746 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -97,6 +97,11 @@ jobs:
- name: Install server dependencies
run: npm ci --prefix server
+ # server/.npmrc pins ignore-scripts=true, so the native deps npm skipped
+ # need the explicit allowlist rebuild to be usable (node-pty et al).
+ - name: Rebuild trusted native dependencies
+ run: node scripts/trusted-rebuilds.js server
+
- name: Check server entry-point syntax
run: node --check server/index.js
@@ -176,6 +181,11 @@ jobs:
- name: Install server dependencies
run: npm ci --prefix server
+ # server/.npmrc pins ignore-scripts=true — the smoke-boot below needs the
+ # native bindings, so run the explicit allowlist rebuild first.
+ - name: Rebuild trusted native dependencies
+ run: node scripts/trusted-rebuilds.js server
+
- name: Provision test database (portos_test)
if: needs.impact.outputs.db == 'true'
run: npm run setup:db:test --prefix server
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 8b3c4a6848..0df71a3e73 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -93,7 +93,7 @@ jobs:
\`\`\`bash
git clone https://github.com/atomantic/PortOS.git
cd PortOS
- npm install
+ npm run install:all
pm2 start ecosystem.config.cjs
\`\`\`"
fi
diff --git a/.npmrc b/.npmrc
index 05d644cf8d..c95b5fbaf5 100644
--- a/.npmrc
+++ b/.npmrc
@@ -1,8 +1,16 @@
-# Block postinstall scripts by default to reduce supply-chain attack surface.
-# Packages with legitimate install scripts are explicitly rebuilt in `npm run install:all`.
+# Block install scripts by default to reduce supply-chain attack surface.
#
-# Trusted packages requiring install scripts:
-# esbuild (client; nested under vite/vitest) — downloads platform-specific binary
-# node-pty (server) — builds native PTY addon
-# sharp (server) — fetches/builds libvips native binding
+# IMPORTANT: this file only covers installs whose *local prefix* is the repo
+# root. npm reads the project config from the local prefix and never walks up
+# the directory tree, so `cd client && npm install` and `npm ci --prefix server`
+# do NOT see this file — each workspace carries its own .npmrc for that reason
+# (client/.npmrc, server/.npmrc, autofixer/.npmrc). Deleting any of those
+# silently reopens an install-time code-execution slot for every dependency in
+# that workspace.
+#
+# Packages with legitimate install scripts are rebuilt explicitly from the
+# allowlist in scripts/trusted-rebuilds.js (shared by `npm run setup`,
+# scripts/ensure-deps.js, update.sh/update.ps1 and CI). Currently only the
+# server needs any: node-pty (native PTY addon), sharp (insurance — ships
+# prebuilt bindings today), and onnxruntime-node / protobufjs (best-effort).
ignore-scripts=true
diff --git a/autofixer/.npmrc b/autofixer/.npmrc
new file mode 100644
index 0000000000..cec2d7f8e6
--- /dev/null
+++ b/autofixer/.npmrc
@@ -0,0 +1,6 @@
+# Block install scripts by default to reduce supply-chain attack surface.
+# See client/.npmrc for why this cannot be inherited from the repo-root .npmrc:
+# npm reads the project config from the local prefix and never walks upward.
+#
+# No autofixer dependency needs an install script.
+ignore-scripts=true
diff --git a/client/.npmrc b/client/.npmrc
new file mode 100644
index 0000000000..2127b9ef18
--- /dev/null
+++ b/client/.npmrc
@@ -0,0 +1,13 @@
+# Block install scripts by default to reduce supply-chain attack surface.
+#
+# This file is NOT redundant with the repo-root .npmrc: npm resolves the project
+# config from the *local prefix* and never walks up the directory tree. So the
+# root .npmrc does not apply to `cd client && npm install`, nor to
+# `npm ci --prefix client` (which is what CI runs) — the local prefix is
+# `client/` in both cases. Without this file the guard silently does not hold
+# here, which is how a preinstall-hook worm (e.g. the Aug 2026 keyv/cacheable
+# compromise) would have gotten a free execution slot.
+#
+# No client dependency currently needs an install script, so there is nothing to
+# rebuild for this workspace (vite 8 dropped the esbuild binary dependency).
+ignore-scripts=true
diff --git a/package.json b/package.json
index 7895787d9e..46b45f1433 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
"pm2:startup": "node ./node_modules/pm2/bin/pm2 startup",
"install:all": "npm run setup",
"migrations": "node scripts/run-migrations.js",
- "setup": "git submodule update --init --recursive && npm install && npm install --prefix client && npm install --prefix server && npm install --prefix autofixer && npm rebuild esbuild --prefix client && (npm rebuild esbuild --prefix server || true) && npm rebuild node-pty sharp --prefix server && node scripts/setup-data.js && node scripts/setup-db.js && node scripts/setup-llm.js && node scripts/setup-browser.js",
+ "setup": "git submodule update --init --recursive && npm install && npm install --prefix client && npm install --prefix server && npm install --prefix autofixer && node scripts/trusted-rebuilds.js server && node scripts/setup-data.js && node scripts/setup-db.js && node scripts/setup-llm.js && node scripts/setup-browser.js",
"setup:data": "node scripts/setup-data.js",
"setup:db": "node scripts/setup-db.js",
"setup:db:test": "npm run setup:db:test --prefix server",
diff --git a/scripts/ensure-deps.js b/scripts/ensure-deps.js
index cdc046c39c..d44a0cd16b 100644
--- a/scripts/ensure-deps.js
+++ b/scripts/ensure-deps.js
@@ -8,6 +8,7 @@ import { execFileSync } from 'child_process';
import { createHash } from 'crypto';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
+import { rebuildTrusted } from './trusted-rebuilds.js';
const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
const NPM = process.platform === 'win32' ? 'npm.cmd' : 'npm';
@@ -97,33 +98,13 @@ function cleanWorkspaceDeps(dir) {
}
}
-// Trusted install scripts skipped by `ignore-scripts=true` in the repo .npmrc,
-// per workspace. Mirrors the explicit `npm rebuild` calls in update.sh / the
-// `setup` script: a plain `npm install` leaves these native/scripted deps
-// unbuilt, so the server crashes on a missing node-pty/sharp binding. Run after
-// every (re)install — not just the clean-reinstall path — so a fresh install
-// into a missing node_modules is equally whole.
-const TRUSTED_REBUILDS = {
- client: [{ pkgs: ['esbuild'], fatal: true }],
- server: [{ pkgs: ['esbuild'], fatal: false }, { pkgs: ['node-pty', 'sharp'], fatal: true }]
-};
-
-function rebuildTrusted(dir, label) {
- const groups = TRUSTED_REBUILDS[label];
- if (!groups) return true;
- for (const { pkgs, fatal } of groups) {
- try {
- execFileSync(NPM, ['rebuild', ...pkgs], { cwd: dir, stdio: 'inherit', windowsHide: true });
- } catch (err) {
- // esbuild on the server is a test-only transitive (fatal: false) — its
- // absence never breaks runtime, matching update.sh's `|| true`. node-pty
- // and sharp are runtime-critical, so a failure there fails the install.
- console.error(`⚠️ npm rebuild ${pkgs.join(' ')} failed for ${label}: ${err.message ?? err}`);
- if (fatal) return false;
- }
- }
- return true;
-}
+// The trusted install-script allowlist lives in scripts/trusted-rebuilds.js —
+// shared with the root `setup` script and CI so the list has exactly one home.
+// Every workspace pins `ignore-scripts=true` in its own .npmrc, so a plain
+// `npm install` leaves these native deps unbuilt and the server crashes on a
+// missing node-pty binding. Run after every (re)install — not just the
+// clean-reinstall path — so a fresh install into a missing node_modules is
+// equally whole.
function install(dir, label) {
try {
diff --git a/scripts/trusted-rebuilds.js b/scripts/trusted-rebuilds.js
new file mode 100644
index 0000000000..3256d658e3
--- /dev/null
+++ b/scripts/trusted-rebuilds.js
@@ -0,0 +1,81 @@
+/**
+ * Single source of truth for the packages allowed to run install scripts.
+ *
+ * Every workspace pins `ignore-scripts=true` in its own .npmrc (npm reads the
+ * project config from the local prefix and never walks upward, so each
+ * workspace needs its own file — see client/.npmrc). That blocks the
+ * preinstall/postinstall hook that supply-chain worms use as their execution
+ * slot, at the cost of also skipping the handful of *legitimate* native builds.
+ * Those are rebuilt explicitly here — an allowlist, so adding a dependency
+ * never silently grants it an install-time code-execution slot.
+ *
+ * Consumed by scripts/ensure-deps.js, the root `setup` script, and CI. Keep the
+ * list here only — a second copy in a workflow file is how it drifts.
+ *
+ * Usage as a CLI (what CI and `npm run setup` call):
+ * node scripts/trusted-rebuilds.js server
+ */
+import { execFileSync } from 'child_process';
+import { join, dirname } from 'path';
+import { fileURLToPath } from 'url';
+
+const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
+const NPM = process.platform === 'win32' ? 'npm.cmd' : 'npm';
+
+/**
+ * `fatal: true` means a failed rebuild fails the install — the package is
+ * required at runtime and a missing binding crashes the server. `fatal: false`
+ * is best-effort: the dependency degrades rather than breaks.
+ *
+ * client / autofixer are intentionally absent: nothing in either needs an
+ * install script (vite 8 dropped the esbuild binary dependency that used to).
+ */
+export const TRUSTED_REBUILDS = {
+ server: [
+ // Builds the native PTY addon. The shell/TUI features hard-require it.
+ { pkgs: ['node-pty'], fatal: true },
+ // Retained as insurance: sharp ships prebuilt bindings via
+ // optionalDependencies today (no lifecycle hook), so this is currently a
+ // no-op — but it is runtime-critical if it ever regains one.
+ { pkgs: ['sharp'], fatal: true },
+ // Transitive, behind optional local-inference features. Its postinstall
+ // fetches platform binaries; absent them the feature is unavailable, not
+ // fatal. protobufjs's postinstall only generates a minimal build.
+ { pkgs: ['onnxruntime-node', 'protobufjs'], fatal: false }
+ ]
+};
+
+/**
+ * Rebuild the trusted packages for one workspace.
+ * Returns true when every fatal group succeeded.
+ */
+export function rebuildTrusted(dir, label) {
+ const groups = TRUSTED_REBUILDS[label];
+ if (!groups) return true;
+ let ok = true;
+ for (const { pkgs, fatal } of groups) {
+ try {
+ execFileSync(NPM, ['rebuild', ...pkgs], { cwd: dir, stdio: 'inherit', windowsHide: true });
+ } catch (err) {
+ console.error(`⚠️ npm rebuild ${pkgs.join(' ')} failed for ${label}: ${err.message ?? err}`);
+ if (fatal) ok = false;
+ }
+ }
+ return ok;
+}
+
+// CLI entry: `node scripts/trusted-rebuilds.js <label> [dir]`
+if (process.argv[1] && import.meta.url === `file://${process.argv[1]}`) {
+ const label = process.argv[2];
+ if (!label) {
+ console.error(`❌ usage: node scripts/trusted-rebuilds.js <${Object.keys(TRUSTED_REBUILDS).join('|')}>`);
+ process.exit(1);
+ }
+ const dir = process.argv[3] ?? (label === 'root' ? ROOT : join(ROOT, label));
+ if (!TRUSTED_REBUILDS[label]) {
+ console.log(`✅ no trusted rebuilds needed for ${label}`);
+ process.exit(0);
+ }
+ console.log(`🔨 Rebuilding trusted install-script packages for ${label}`);
+ process.exit(rebuildTrusted(dir, label) ? 0 : 1);
+}
diff --git a/scripts/trusted-rebuilds.test.js b/scripts/trusted-rebuilds.test.js
new file mode 100644
index 0000000000..47cbc4e339
--- /dev/null
+++ b/scripts/trusted-rebuilds.test.js
@@ -0,0 +1,112 @@
+import { describe, it, expect } from 'vitest';
+import { readFileSync, existsSync, readdirSync } from 'fs';
+import { join, dirname } from 'path';
+import { fileURLToPath } from 'url';
+
+import { TRUSTED_REBUILDS } from './trusted-rebuilds.js';
+
+const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
+
+// Every workspace that npm can install into with that workspace as the *local
+// prefix*. npm resolves the project .npmrc from the local prefix and never walks
+// up the tree, so each of these needs its own file — the repo-root .npmrc does
+// NOT cover `cd client && npm install` or `npm ci --prefix client` (what CI
+// runs). A missing file silently re-grants every dependency in that workspace an
+// install-time code-execution slot, which is exactly the hole a preinstall-hook
+// worm (the Aug 2026 keyv/cacheable compromise) walks through.
+const WORKSPACES = ['.', 'client', 'server', 'autofixer'];
+
+const LIFECYCLE_HOOKS = ['preinstall', 'install', 'postinstall'];
+
+/** Packages in a workspace's installed tree that declare a lifecycle install hook. */
+function packagesWithInstallHooks(workspace) {
+ const modulesDir = join(ROOT, workspace, 'node_modules');
+ if (!existsSync(modulesDir)) return null;
+ const found = new Set();
+ const scanDir = (dir) => {
+ let entries;
+ try {
+ entries = readdirSync(dir, { withFileTypes: true });
+ } catch {
+ return;
+ }
+ for (const entry of entries) {
+ if (!entry.isDirectory()) continue;
+ // Recurse one level into scopes (@scope/pkg) only.
+ if (entry.name.startsWith('@')) {
+ scanDir(join(dir, entry.name));
+ continue;
+ }
+ const manifest = join(dir, entry.name, 'package.json');
+ if (!existsSync(manifest)) continue;
+ let pkg;
+ try {
+ pkg = JSON.parse(readFileSync(manifest, 'utf8'));
+ } catch {
+ continue;
+ }
+ if (LIFECYCLE_HOOKS.some((hook) => pkg?.scripts?.[hook])) {
+ found.add(pkg.name ?? entry.name);
+ }
+ }
+ };
+ scanDir(modulesDir);
+ return found;
+}
+
+describe('ignore-scripts guard', () => {
+ it.each(WORKSPACES)('%s/.npmrc pins ignore-scripts=true', (workspace) => {
+ const npmrc = join(ROOT, workspace, '.npmrc');
+ expect(existsSync(npmrc), `${workspace}/.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, `${workspace}/.npmrc must set ignore-scripts=true`).toContain('ignore-scripts=true');
+ });
+});
+
+describe('trusted rebuild allowlist', () => {
+ it('declares only known workspaces, each with a valid shape', () => {
+ for (const [label, groups] of Object.entries(TRUSTED_REBUILDS)) {
+ expect(WORKSPACES).toContain(label);
+ expect(Array.isArray(groups)).toBe(true);
+ for (const group of groups) {
+ expect(Array.isArray(group.pkgs)).toBe(true);
+ expect(group.pkgs.length).toBeGreaterThan(0);
+ expect(typeof group.fatal).toBe('boolean');
+ }
+ }
+ });
+
+ // The point of the allowlist is that ignore-scripts=true blocks EVERY install
+ // hook, so any package that legitimately needs one must be named explicitly.
+ // If a new dependency shows up with a postinstall and nobody decides about it,
+ // it is silently left unbuilt — which surfaces later as a confusing runtime
+ // crash on a missing native binding. Fail here instead, at the point the
+ // dependency is added, and force the decision: add it to the allowlist, or
+ // confirm its hook is genuinely unnecessary and add it to the ignore list.
+ const DELIBERATELY_UNBUILT = {
+ // No install hook is needed for these to work; their scripts are optional
+ // niceties (codegen / telemetry / prebuild shortcuts).
+ server: []
+ };
+
+ it.each(WORKSPACES)('%s: every installed package with an install hook is accounted for', (workspace) => {
+ const hooked = packagesWithInstallHooks(workspace);
+ if (hooked === null) {
+ // node_modules absent (e.g. the client workspace in the server CI job).
+ return;
+ }
+ const label = workspace === '.' ? 'root' : workspace;
+ const allowed = new Set([
+ ...(TRUSTED_REBUILDS[label] ?? []).flatMap((group) => group.pkgs),
+ ...(DELIBERATELY_UNBUILT[label] ?? [])
+ ]);
+ const unaccounted = [...hooked].filter((name) => !allowed.has(name));
+ expect(
+ unaccounted,
+ `${workspace}: these packages declare an install hook that ignore-scripts=true blocks, but are not in the allowlist in scripts/trusted-rebuilds.js. Either add them (if the build is needed) or list them under DELIBERATELY_UNBUILT: ${unaccounted.join(', ')}`
+ ).toEqual([]);
+ });
+});
diff --git a/server/.npmrc b/server/.npmrc
new file mode 100644
index 0000000000..3aae64f952
--- /dev/null
+++ b/server/.npmrc
@@ -0,0 +1,17 @@
+# Block install scripts by default to reduce supply-chain attack surface.
+#
+# This file is NOT redundant with the repo-root .npmrc: npm resolves the project
+# config from the *local prefix* and never walks up the directory tree. So the
+# root .npmrc does not apply to `cd server && npm install`, nor to
+# `npm ci --prefix server` (which is what CI runs) — the local prefix is
+# `server/` in both cases. Without this file the guard silently does not hold
+# here, which is how a preinstall-hook worm (e.g. the Aug 2026 keyv/cacheable
+# compromise) would have gotten a free execution slot.
+#
+# The server DOES have dependencies with legitimate native builds (node-pty and
+# friends). They are rebuilt explicitly from the allowlist in
+# scripts/trusted-rebuilds.js — run `node scripts/trusted-rebuilds.js server`
+# after any install here, or just use `npm run setup` / `npm start`, which do it
+# for you. Skipping that step leaves node-pty unbuilt and the shell/TUI features
+# will crash on a missing binding.
+ignore-scripts=true
diff --git a/update.ps1 b/update.ps1
index c7b8dd47df..fa9252a801 100644
--- a/update.ps1
+++ b/update.ps1
@@ -261,19 +261,14 @@ Safe-Install -Dir "client" -Label "client"
Safe-Install -Dir "server" -Label "server"
Safe-Install -Dir "autofixer" -Label "autofixer"
-# Run trusted install scripts skipped by ignore-scripts=true in .npmrc.
-# Use `npm rebuild esbuild` rather than a hardcoded node_modules/esbuild/install.js
-# path: esbuild is no longer hoisted to the top of either tree (it nests under
-# vite/vitest), and the server has no direct esbuild dependency at all since
-# vitest 4 → vite 8 dropped it — so the old install.js path 404'd and crashed
-# the update. `npm rebuild` finds esbuild wherever it lives and no-ops cleanly
-# when absent. Server rebuild is non-fatal (esbuild is a test-only transitive
-# there, not needed for runtime or the production build).
-Write-SafeHost "🔧 Rebuilding esbuild, node-pty & sharp..." -ForegroundColor Yellow
-Invoke-Logged npm rebuild esbuild --prefix client
-if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
-Invoke-Logged npm rebuild esbuild --prefix server
-Invoke-Logged npm rebuild node-pty sharp --prefix server
+# Run trusted install scripts skipped by ignore-scripts=true in each workspace's
+# .npmrc. The allowlist lives in scripts/trusted-rebuilds.js — a single home
+# shared with `npm run setup`, scripts/ensure-deps.js and CI, so a package can
+# never be granted an install-time execution slot in one path but not another.
+# Only the server needs rebuilds; client/autofixer have no install-script deps
+# (vite 8 dropped the esbuild binary dependency that used to be the reason).
+Write-SafeHost "🔧 Rebuilding trusted native dependencies..." -ForegroundColor Yellow
+Invoke-Logged node scripts/trusted-rebuilds.js server
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-SafeHost ""
diff --git a/update.sh b/update.sh
index c6aaa32808..2fabccca73 100755
--- a/update.sh
+++ b/update.sh
@@ -187,19 +187,14 @@ safe_install client
safe_install server
safe_install autofixer
-# Run trusted install scripts skipped by ignore-scripts=true in .npmrc.
-# Use `npm rebuild esbuild` rather than a hardcoded node_modules/esbuild/install.js
-# path: esbuild is no longer hoisted to the top of either tree (it nests under
-# vite/vitest), and the server has no direct esbuild dependency at all since
-# vitest 4 → vite 8 dropped it — so the old `node server/node_modules/esbuild/install.js`
-# path 404'd and hard-crashed the whole update under `set -e`. `npm rebuild`
-# finds esbuild wherever it lives, runs its install script, and no-ops cleanly
-# when the package is absent. Server rebuild is fault-tolerant (esbuild is a
-# test-only transitive there, not needed for runtime or the production build).
-log "🔧 Rebuilding esbuild, node-pty & sharp..."
-run npm rebuild esbuild --prefix client
-run npm rebuild esbuild --prefix server || true
-run npm rebuild node-pty sharp --prefix server
+# Run trusted install scripts skipped by ignore-scripts=true in each workspace's
+# .npmrc. The allowlist lives in scripts/trusted-rebuilds.js — a single home
+# shared with `npm run setup`, scripts/ensure-deps.js and CI, so a package can
+# never be granted an install-time execution slot in one path but not another.
+# Only the server needs rebuilds; client/autofixer have no install-script deps
+# (vite 8 dropped the esbuild binary dependency that used to be the reason).
+log "🔧 Rebuilding trusted native dependencies..."
+run node scripts/trusted-rebuilds.js server
log ""
# Verify critical dependencies exist