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

Hosted child forges on a host with Landlock and no bubblewrap are not held by the floor #17133

Merged opened this

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

Merged

A forge started on a machine (FORGEMACHINES) is now held by the Landlock floor when no bubblewrap cell can be made and the kernel has Landlock. This was the unconfined path: processMachine in src/spawn/machines.ts ran the forge with no confinement at all.

Notes

opened this

A forge started on a machine (FORGE_MACHINES) is now held by the Landlock floor when no bubblewrap cell can be made and the kernel has Landlock. This was the unconfined path: processMachine in src/spawn/machines.ts ran the forge with no confinement at all.

The new tests, tsc, the spawn-argv test and all 32 gate rules pass. The three machine suites that already used processMachine (machine-load, machine-beats, move-machine) passed too, but I ran them before adding the spawn-list entry and did not re-run them. I did not run the dead-code, "builds the real input", timed-job or process-wide-state tests by name. The gate and the type check cover that code and show nothing, and I added no module-level state.

What changed

  • src/spawn/machine_floor.ts (new) builds the floor as plain data. The forge's own directory is keep and writable. The parent's data directory and the machine's whole root (sibling forges, spawn records, pids) are hide. The forge's code tree stays readable.
  • machineFloor and floorHome in that file are called from machines.ts start. When the cell probe says no and Landlock is available, the forge runs behind landlockArgv, with HOME and TMPDIR pointed at .home and .tmp inside its own directory.
  • If Landlock is unavailable the forge still runs unrestricted, and the log says why.
  • machinesOf passes the parent's data directory and a warn logger to the machine.
  • The existing Bun.spawn(argv) in machines.ts needed an entry in scripts/spawn-argv-allow.json, with a reason, to pass the spawn-argv test.
  • docs/features/landlock-floor.md no longer says hosted forges are unheld.
  • test/machine-floor.test.ts checks the floor and the plan it produces. It also starts a real forge process and shows it is denied reads of the parent's and a sibling's files, while it can still write and answer on its port.

Not done

  • TCP stays open for these forges, and the log says so. They reach the parent and the network, so confining connects would need the proxy-port design the doc already names.
  • A forge's HOME is now inside its own directory. Anything it expects in the forge user's real home, such as a model login, is not readable there.

Reused landlockPlan, landlockArgv, probeLandlock, cellsAvailable and READS_PARTLY (checkFloor was the pattern). I did not run similar.ts.

No page, action or MCP tool changed, so there is no terminal side or review block.

Try it bun test test/machine-floor.test.ts. It runs the real-process case on a Landlock kernel and skips it otherwise.

🤖 Generated with Claude Code

Closes #16963

commented

A forge started on a machine (FORGE_MACHINES) is now held by the Landlock floor when no bubblewrap cell can be made and the kernel has Landlock. This was the unconfined path: processMachine in src/spawn/machines.ts ran the forge with no confinement at all.

The new tests, tsc, the spawn-argv test and all 32 gate rules pass. The three machine suites that already used processMachine (machine-load, machine-beats, move-machine) passed too, but I ran them before adding the spawn-list entry and did not re-run them. I did not run the dead-code, "builds the real input", timed-job or process-wide-state tests by name. The gate and the type check cover that code and show nothing, and I added no module-level state.

What changed

  • src/spawn/machine_floor.ts (new) builds the floor as plain data. The forge's own directory is keep and writable. The parent's data directory and the machine's whole root (sibling forges, spawn records, pids) are hide. The forge's code tree stays readable.
  • machineFloor and floorHome in that file are called from machines.ts start. When the cell probe says no and Landlock is available, the forge runs behind landlockArgv, with HOME and TMPDIR pointed at .home and .tmp inside its own directory.
  • If Landlock is unavailable the forge still runs unrestricted, and the log says why.
  • machinesOf passes the parent's data directory and a warn logger to the machine.
  • The existing Bun.spawn(argv) in machines.ts needed an entry in scripts/spawn-argv-allow.json, with a reason, to pass the spawn-argv test.
  • docs/features/landlock-floor.md no longer says hosted forges are unheld.
  • test/machine-floor.test.ts checks the floor and the plan it produces. It also starts a real forge process and shows it is denied reads of the parent's and a sibling's files, while it can still write and answer on its port.

Not done

  • TCP stays open for these forges, and the log says so. They reach the parent and the network, so confining connects would need the proxy-port design the doc already names.
  • A forge's HOME is now inside its own directory. Anything it expects in the forge user's real home, such as a model login, is not readable there.

Reused landlockPlan, landlockArgv, probeLandlock, cellsAvailable and READS_PARTLY (checkFloor was the pattern). I did not run similar.ts.

No page, action or MCP tool changed, so there is no terminal side or review block.

Try it bun test test/machine-floor.test.ts. It runs the real-process case on a Landlock kernel and skips it otherwise.

🤖 Generated with Claude Code

commented

I fixed the duplicate-import failure and pushed. test/dup-imports.test.ts and test/machine-floor.test.ts pass locally (9 tests). I haven't seen the forge's re-run of the check.

  • Cause: the child script inside test/machine-floor.test.ts had its own import … from "node:fs" line. The dup-import scan counted it as a second import of node:fs in that file.
  • Change: that script now gets readFileSync and writeFileSync with require("node:fs"). Only the test file changed.
  • Not fixed: "every screen that binds r…" in test/keymap-terminal.test.ts fails the same way on main (6be5e30), and the check already excluded it from this pull's count. I left it alone.
Sign in to join this conversation.

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

Keyboard shortcuts

Docs