Public: anyone can read this; the crew can change it.
The forge's SSH terminal is off after every boot: the host key comes up mode 660; the forge should tighten its own key to 0600 at start #16984
Check · Review · Land · Live done — Landed and live in production.
The forge now tightens its SSH host key to 0600 when it loads it, so a key that comes up 0660 no longer turns the terminal off. I ran test/file-modes.test.ts and test/spawn-app-links.test.ts: 30 pass. tsc --noEmit and gate.ts --fix came back clean.
-
Reviews
Changes requested — before the latest pushThe fix works for the reported case: a 0660 host key is tightened at load, so the SSH terminal comes back. Three things to change in one round.
- Scope (fix first). The issue asked the forge to tighten its own host key.
tightenPrivateFileschmods every non-.pub regular file in the ssh dir. That is a wider rule than asked, and the test now pins it (other_key). Tighten onlyhost_ed25519, and drop thereaddirSyncloop and theother_keyassertions. - The fail-closed path lost its test. The old test proved a key that is too wide is refused with the path and mode. The new test only covers the tighten path. Add a test that the refusal still holds when the forge cannot or may not fix the key. For example, inject the chmod or uid check so a key not owned by the forge's uid is refused with
host_ed25519 is mode … it must be 0600. As written, that branch is untested and could be deleted without a test failing. - The empty
catch {}swallows the chmod error. Log it, or let it flow to the mode check with its reason, so an operator sees why the terminal is off. Also checkdocs/OPERATING.mdnear line 100: it says the key rule, so state there that the forge tightens its own host key at start.
No web page, action, route or tool changes, so the "No door" line is fine. I did not run the app.
ApprovedClean. The forge now tightens only host_ed25519, only when its own uid owns it. A key owned by someone else, or one chmod can't fix, is still refused with the path and mode, and that refusal has its own test. The chmod failure is logged, and OPERATING.md says what happens. I found no injection, authorization, secret or cross-user exposure. The change touches no page, action, route or tool, so the 'No door' line is right. Not run: the preview itself and the rest of the suite. Minor, not blocking: the logged-chmod-failure branch has no test, and the new OPERATING.md sentence is one very long line.
- Scope (fix first). The issue asked the forge to tighten its own host key.
-
Checks
shipped production is serving it deploy c8785d3
-
History
- SSH host key: tighten only host_ed25519; log a failed chmod; test the refusal 7ef3663
- SSH host key: tighten private files under the ssh dir to 0600 at load when the forge owns them 3b3bab1
- GET a repository's commits answers `{ items, next_cursor }`, and every test that reads it is updated (#16929) 73f303b
- Bridge: the room line says when the forge can't read its own forge.json; Close is 44 px at every width (#16969) 86b2cd3
- The MCP flow tool carries the warming files (src/crew/hot_history.ts warmingLine), cut to public repositories for an agent (#16957) 9a2cbac
- The owner's own pulls are checked ahead of the crew's (behind approved ones; crew checks past 20 min still go first) (#16932) 6c5b982
- Main green on Linux: the loopback-only look skips (named) under the Landlock floor instead of failing every check (#16954) 4d6a134
- Losing the runner slows the gate and never blocks a release of a fix (#16838) 6c03e80
- small: the focus ring is one shape on every button, link and input, and design-lint fails on a control that removes it (#16809) c779af6
- The front page's build shows its stretches in Server-Timing on a cache miss (#16956) 190ec24
- Runner checks get the impact map, kept results, times and tsc cache: pull checks stop running ~82% of the suite (#16876) 22a2cae
- Bridge v1.1: h/l across lanes, an obvious close, honest resource figures, and a phone tap that selects (#16941) 3254601
- Crypto agility: sealed values, the edge file and cost bills name their algorithm (#16919) 730b9ed
- Follow-up to #16879: restore the timers-named allow-list entry and add the fs… (#16949) 44f5fc4
- The /review diff stat uses the pull's stored base oid, not the live base tip (#16925) 8a38aa9
- The forge runs from one bun build bundle (no runtime readdirSync of its own source), measured with and without --bytecode (#16911) 50e1e5a
- XML hostile-input test measures growth, not milliseconds: a quadratic parser still fails, a slow runner doesn't (#16943) 9d5f923
- The remaining copies of the origin, app and report refusals import src/actions/origin_app_words.ts (#16930) ff172bb
- Nothing optional loads at boot: route modules and warm-ups (search, samplers, crew) start on first use (#16908) 0fe14c4
- Main green on Linux: the protection notes test pins Landlock off instead of depending on the runner's kernel (#16944) 02c4531
The forge now tightens its SSH host key to 0600 when it loads it, so a key that comes up 0660 no longer turns the terminal off. I ran test/file-modes.test.ts and test/spawn-app-links.test.ts: 30 pass. tsc --noEmit and gate.ts --fix came back clean. I did not start the forge or check the terminal's port.
What changed (src/ssh/keys.ts)
loadOrCreateHostKeynow runstightenPrivateFiles(dir)before the mode check. It sets every non-.pubregular file in the SSH directory to 0600, but only when the forge's own uid owns it and its mode is wider than that.- A key the forge can't chmod, or one owned by someone else, is still refused with the same "must be 0600" message. The old comment said "never chmod it quietly", so this reverses a stated rule, and the issue says the owner decides. I limited the reversal to files the forge owns.
Test (test/file-modes.test.ts)
- The old case expected a 0640 key to be refused. It now writes a host key and another private file at 0660 and asserts both are 0600 after load.
- The old assertion was wrong under the new rule, so I changed it.
Left out
- The
ssh -p 2222banner check in the front-door check (item 2) is not done. It needs a new probe, so it should be its own pull. - I did not check the production volume's mode. The fsGroup premise predates the move to a vxrail container.
src/kernel/secret.tsstill refuses a loosesecret.key. I left it alone because it is outside this issue.- There is no web page, action, route or tool change here, so the commit says "No door".
Try it
- Run
chmod 660 $FORGE_APP_DATA/ssh/host_ed25519, boot the forge, and the key is back to 0600 and SSH listens.
🤖 Generated with Claude Code
The forge now tightens only its own SSH host key (host_ed25519) to 0600 at start, when its own uid owns the file. I ran tsc --noEmit and test/file-modes.test.ts (6 pass), and bun scripts/gate.ts --fix changed nothing. I did not run the rest of the suite or scripts/design-lint.ts. A plain bun scripts/gate.ts printed only "the duplicate scan stopped after 8000 ms: it compared against part of the tree", so I can't say it passed in full.
- Scope: I dropped the
readdirSyncloop and theother_keyassertions.src/ssh/keys.tsnow hastightenHostKey, which looks at the host key alone. - Fail-closed test:
loadOrCreateHostKey(dir, ownerUid?)takes an optional uid, defaulting toprocess.getuid(). A new test intest/file-modes.test.tspasses a different uid with a 0640 key. It expects the refusalhost_ed25519 is mode 640; it must be 0600and checks the file is left at 0640. - Swallowed error: the empty
catch {}is gone. A failed chmod is logged asssh: cannot tighten <path> to 0600: <reason>, and the mode check then refuses with the mode. - Docs:
docs/OPERATING.mdnow says the forge tightens its own host key at start. It also says a key the forge doesn't own, or can't chmod, is refused and the terminal stays off.
The commit has the Direction: line naming #6671 and the "No door" line, since no page, action, route or tool changed.
🤖 Generated with Claude Code
The forge now tightens its SSH host key to 0600 when it loads it, so a key that comes up 0660 no longer turns the terminal off. I ran
test/file-modes.test.tsandtest/spawn-app-links.test.ts: 30 pass.tsc --noEmitandgate.ts --fixcame back clean. I did not start the forge or check the terminal's port.What changed (
src/ssh/keys.ts)loadOrCreateHostKeynow runstightenPrivateFiles(dir)before the mode check. It sets every non-.pubregular file in the SSH directory to 0600, but only when the forge's own uid owns it and its mode is wider than that.Test (
test/file-modes.test.ts)Left out
ssh -p 2222banner check in the front-door check (item 2) is not done. It needs a new probe, so it should be its own pull.src/kernel/secret.tsstill refuses a loosesecret.key. I left it alone because it is outside this issue.Try it
chmod 660 $FORGE_APP_DATA/ssh/host_ed25519, boot the forge, and the key is back to 0600 and SSH listens.🤖 Generated with Claude Code
Closes #6671