Public: anyone can read this; the crew can change it.

Install scripts off for unreviewed repositories (bun install --ignore-scripts) #16886

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Deploy and check installs now run with --ignore-scripts for a repository whose review hasn't passed. Once the review passes or the owner overrides, they run as before, scripts included. The crew brief for such a repository now says install scripts are off.

Notes

opened this

Deploy and check installs now run with --ignore-scripts for a repository whose review hasn't passed. Once the review passes or the owner overrides, they run as before, scripts included. The crew brief for such a repository now says install scripts are off.

The new test, test/install-scripts-off.test.ts, passes. The quarantine and install suites I ran pass too (44 tests), and bun x tsc --noEmit is clean. I did not run the whole suite: scripts/fast.ts named 3,257 files for this diff. The forge's check runs it on the push.

  • Deploy and check: withoutScripts() in src/checks/install.ts adds --ignore-scripts to every bun install in an app's install command. It is applied in src/apps/process.ts, fed by the new scriptsOff input that runtime_bringup.ts sets, and in src/checks/tier_install.ts. Both use isQuarantined from #3969, read live.
  • Crew: the crew's host-side install already always used --ignore-scripts (INSTALL_ARGV), so I left it alone. Making it run scripts after a review would be a security regression. The brief line is SCRIPTS_OFF_LINE, added to the system prompt when scriptsOff is set in src/crew/runner.ts.
  • Marker test: a fixture package whose postinstall writes a marker file. With withoutScripts no marker is written. With the plain install the marker is written. The test exercises the install command directly, not a full deploy.

What I left out:

  • Remote runner jobs: src/runner/main.ts is unchanged, so remote runner jobs still use the command as written.
  • Quarantine gates: #3969 already refuses deploy, check and builder runs for these repositories, so this is a second guard behind it. The brief line applies only if a repository becomes unreviewed while a run is in flight.
  • Brief test: there is no test that the line actually reaches systemPrompt. The one brief test only checks the constant's text.
  • Doors: no web page, action or API route changed, so there is no TUI or feature-doc change.

I reused the copying() pattern for rewriting bun install in a command, and isQuarantined.

Closes #3970

5 earlier comments
commented

Deploy and check installs now run with --ignore-scripts for a repository whose review hasn't passed. Once the review passes or the owner overrides, they run as before, scripts included. The crew brief for such a repository now says install scripts are off.

The new test, test/install-scripts-off.test.ts, passes. The quarantine and install suites I ran pass too (44 tests), and bun x tsc --noEmit is clean. I did not run the whole suite: scripts/fast.ts named 3,257 files for this diff. The forge's check runs it on the push.

  • Deploy and check: withoutScripts() in src/checks/install.ts adds --ignore-scripts to every bun install in an app's install command. It is applied in src/apps/process.ts, fed by the new scriptsOff input that runtime_bringup.ts sets, and in src/checks/tier_install.ts. Both use isQuarantined from #3969, read live.
  • Crew: the crew's host-side install already always used --ignore-scripts (INSTALL_ARGV), so I left it alone. Making it run scripts after a review would be a security regression. The brief line is SCRIPTS_OFF_LINE, added to the system prompt when scriptsOff is set in src/crew/runner.ts.
  • Marker test: a fixture package whose postinstall writes a marker file. With withoutScripts no marker is written. With the plain install the marker is written. The test exercises the install command directly, not a full deploy.

What I left out:

  • Remote runner jobs: src/runner/main.ts is unchanged, so remote runner jobs still use the command as written.
  • Quarantine gates: #3969 already refuses deploy, check and builder runs for these repositories, so this is a second guard behind it. The brief line applies only if a repository becomes unreviewed while a run is in flight.
  • Brief test: there is no test that the line actually reaches systemPrompt. The one brief test only checks the constant's text.
  • Doors: no web page, action or API route changed, so there is no TUI or feature-doc change.

I reused the copying() pattern for rewriting bun install in a command, and isQuarantined.

commented

This revision closes the install-script holes; I disagreed with one review point and dropped that line instead. tsc --noEmit, bun scripts/gate.ts --fix and the two covering suites (install-scripts-off, app-install-cache) pass. I did not run the full suite.

Changes

  • Package managers (point 2): withoutScripts in src/checks/install.ts now covers bun, npm, pnpm and yarn. It adds --ignore-scripts to install/add/ci forms, including yarn with no subcommand and CI=1 npm ci. It leaves a command alone if the flag is already there.
  • Unrecognised commands (point 2): it returns undefined for anything it can't rewrite, and the install is refused instead of run. That covers bunx, npx, bun run, npm run, scripts, make, $(…), backticks, parentheses and redirects. Only cd, mkdir, echo, true, export and : may sit beside an install.
  • Where it applies (point 2): the check (tier_install.ts) and the deploy (process.ts) use one shared helper, installCommand(command, scriptsOff). A refusal fails the install stage with a plain message.
  • Remote runners (point 1): tier_runner.ts puts the already-rewritten install command into the job, so src/runner/main.ts needed no change. If the command can't be rewritten, the job stays on the forge, where the install is refused.
  • Tests (point 3): the new tests assert the wiring:
    • A fake npm on PATH records its arguments. They are ci --ignore-scripts when quarantined and ci when not, through both runInstall and startProcess (scriptsOff true and false).
    • tryRunner sends the rewritten command for a pending repository and the original for a passed one. It sends nothing for make deps.
    • There are unit tests for each package-manager form and for the refusals.
    • The bun install postinstall-marker test stays.
  • Tidy (point 4): the process.ts line is split, the tier_install.ts imports are reordered, and the gate rewrap is committed.
  • Duplicate read (point 5): I dropped the crew brief line and the isQuarantined read in src/crew/runner.ts. #3969 already refuses crew runs for an unreviewed repository, so the line could only show up if the review state changed mid-run. The live read stays for deploy, check and runner installs.

Left out

  • The check step, the app's run command and the repository's test command are not touched. They only run after review, and #3969 already blocks them before then.
  • The unrecognised-command refusal is strict. A repository with a custom install like make deps has to pass review before it installs.

Try it

  • bun test test/install-scripts-off.test.ts
commented

I fixed the failing gate rule and pushed (ce95f4840). test/install-scripts-off.test.ts no longer uses as never; it builds typed InstallStep, RunnerCheck, Execution, StartInput and CheckManifest records, plus shared lane, repo, manifestOf and step helpers. I didn't open or merge anything.

Where I checked:

  • Run locally: bun x tsc --noEmit is clean, the 9 tests in this file pass, and bun scripts/gate.ts no longer reports the as never rule. I didn't re-run the other test files.
  • Not yet confirmed: the forge's check on this push hasn't reported.

Two casts remain, in places I couldn't build a full record cheaply:

  • The lane helper (LaneState) uses as unknown as LaneState. This matches how test/check-runner-base-gate.test.ts builds its lane.
  • The Database stub and the Repo fixture are cast too, and the StartInput manifest and the runner job's tree are narrowed with as.

The gate still prints a non-failing note that the fixture helper in this test resembles told in test/plan-line-cap.test.ts. It's a different job (a package.json directory versus a billing notice), so I left it. The src/apps/process.ts long-comment note was already there and isn't mine.

commented

<!-- look-pages 412fd06b649c --> Look pages for 412fd06, from the gate:

  • look pages (inferred): this pull changes src/web/pages/home_figures.ts, src/web/pages/home_flow_style.ts; the forge pictures / (src/web/pages/home_figures.ts), /docs (src/web/pages/home_figures.ts), /explore (src/web/pages/home_figures.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

This pull now turns install scripts off for repositories whose review has not passed. It covers the deploy and the check install, and the runner install too, for every package manager. An install command the forge can't recognise is refused rather than run with scripts on. I've pushed the changes that answer your feedback; the last commit is adc61da24.

  • Dead code: withoutScripts was exported only for its test, which tripped the "every export has a caller" test. It is now private in src/checks/install.ts, and the test reaches it through installCommand(…, true). test/unused-exports.test.ts and test/install-scripts-off.test.ts pass (12 tests), and tsc is clean.
  • Name the issue: the commit says Direction: … (#3970).
  • Typed records: the earlier commit ce95f4840 replaced the as never casts in test/install-scripts-off.test.ts with typed records. I added no new casts.
  • Both doors: nothing here is a page, action, API route or MCP tool. The change is the install flag on the deploy, check and runner paths. The commit line says No door: ….
  • Look pages: I disagree with this one. The note names src/web/pages/home_figures.ts and home_flow_style.ts, and this pull touches neither. The commit says No look: … with that reason. The note may refer to a commit from another branch.
  • Duplicate-function note: the gate still says fixture in test/install-scripts-off.test.ts resembles told in test/plan-line-cap.test.ts. It is only a note, and I left it because the two helpers build different records.

To try it, run bun test test/install-scripts-off.test.ts.

commented

When a repository's review has not passed, its install now runs without lifecycle scripts. The forge rewrites every bun, npm, pnpm and yarn install in manifest.install to add --ignore-scripts. This applies on the deploy path (src/apps/process.ts), the check install (src/checks/tier_install.ts) and the runner job (src/checks/tier_runner.ts). An install command the forge does not recognise is refused instead of run. The tests for this file pass and tsc is clean.

This push closes the two gaps in the rewrite (src/checks/install.ts, withoutScripts):

  • A single & now splits the command. bun install & ./evil.sh becomes two parts, and the second part is refused.
  • A flag already in the command can no longer turn scripts back on. Any --ignore-scripts=… or --no-ignore-scripts is removed first, then the bare --ignore-scripts is always added. Removing them across the whole part also covers the non-blocking note about flags elsewhere in the command.

test/install-scripts-off.test.ts adds cases for =false, =0 and --no-ignore-scripts. It also adds bun install & make, bun install & ./evil.sh and bun install &./evil.sh to the list of refused commands.

Left as is:

  • The look-pages note names files this pull does not touch.
  • The gate's duplicate-function note on the test's fixture helper is advisory, and the two helpers build different records.
  • A trailing & alone (bun install &) is allowed and only runs the protected install in the background.
  • Passing --ignore-scripts on the command line still overrides an npm_config_ignore_scripts=false set in the environment.

To try it: bun test test/install-scripts-off.test.ts.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs