Public: anyone can read this; the crew can change it.
A deployed forge is claimed by one link over HTTPS on its own name, on a hardened machine #16255
Check · Review · Land · Live done — Landed and live in production.
Fixes #16217 and the boot-config half of #16218. Found by a security review of the pinned-forge path before forges are sold on it: a deployed forge could not be claimed by anyone, was served on a bare address over plain HTTP, ran as root with every port open, and had password SSH on.
shipped production is serving it deploy 3fede26
This pull now carries the whole sell-ready deploy; #16232 (ceiling) and #16233 (sandbox hold) are folded in and closed, and main (with #16220) is merged.
Since the description was written:
- "Claim" is one thing: the buyer's link. Claimed is the deployed forge's own answer; the seller's row takes #16220's
claimed_atand emitspinned.claimedonce. After that update, rollback and reissue are refused. The manual "Hand to buyer" path is removed. - Certificates live on the data volume, so a replaced machine reuses its certificate; the Caddyfile is in place before the package first starts.
- Every cloud account has a monthly ceiling ($50 by default, dollars everywhere, one conversion function); every driver create passes it, including reissue, and a test fails on a bare
driverOf(. Creates queue per account and changes queue per forge. FORGE_CREW_SANDBOX=requireholds queued runs, conversation turns and one-shots when the sandbox is unavailable, and re-probes at most once a minute while something waits. Defaultoffis unchanged; a deployed forge setsrequire.- From an adversarial review:
ProtectKernelLogsremoved from the unit (it would likely break bubblewrap's /proc mount); the SSH listener is off on a deployed forge.
Still true: nothing here has booted on a real machine, and the tests that need a listening socket have only ever run in this pull's check. Known gaps: the hold sentence suggests FORGE_CREW_SANDBOX=off, which a deployed forge cannot set; DNS is by hand and changes on every replace; no provider-level firewall; no hostname ownership check.
I read the whole diff except the tail the review view cut off. That tail is the rest of claimNow, check and src/cloud/*. I opened the preview. / answers 200, and /pinned and /deploy-to answer 303 to sign-in without an admin session, as intended. The pictures on the pull are only / and /docs (listed at /looks; I could not fetch the image bytes). None shows /pinned, /deploy-to or the cloud page, so the design points come from the code.
What holds up:
- The claim link keeps only its hash in the row, in boot config and in events.
- The seed is taken once at boot.
- The status oracle answers only to the matching hash, compared with
timingSafeEqual. - Same-origin and admin checks are on the new routes.
- README is untouched, the how-to is in
docs/features, and a TUI screen exists.
Changes needed, in order:
- Never: a cap or hold is added where removing something would do.
- The $50 default ceiling refuses every create on every cloud account once the account is near it. Its own docs say the figure comes from list prices, not the bill.
FORGE_CREW_SANDBOX=requireholds runs, turns and one-shots. Your own notes say its hold sentence suggestsFORGE_CREW_SANDBOX=off, which a deployed forge cannot set.- Neither is needed for "claimed by one link over HTTPS on a hardened machine". Drop them from this pull, or make the ceiling opt-in with no default and the hold a visible notice only. A forge that refuses to deploy or run is close to the "locks up" Never.
- Split. Ceiling (#16232) and sandbox hold (#16233) are each usable alone and are unrelated to the claim link. Land them as their own pulls. The pull is now about 4000 lines that has never booted on a real machine.
- Design: hand-rolled markup (principles 3, 6, 7).
src/web/pages/pinned.tsadds a raw<input class="mono">inside the action row. It has no visible label and does not usefield.src/web/pages/cloud.tsputs a number input and a second button into every account row, next to Verify, Write, Audit and Remove. Put the ceiling on its own confirm or settings page, using the namedfieldcomponent, or remove it (item 1).
- Principle 1 and 8: the page says things twice.
- The cloud page now has a new paragraph plus a
ceilingLineon every row. - The pinned list repeats the claim-link sentence in the rows. The issued page has a sub line, then
claimWords, then a muted paragraph saying the same thing. - Cut each to one sentence.
- The cloud page now has a new paragraph plus a
- Unauthenticated
GET /api/v1/first-admin/claim?seed=. It is hash-gated, which is fine. But a hash in a query string lands in access logs and the proxy's logs. Take it as a POST body or confirm no log keeps the query. - Hostname ownership is not checked (your own known gap), and the DNS record is made by hand and changes on every replace. The machine then serves a certificate request for any name you type. Say in the pull what stops a typo or someone else's name from burning Let's Encrypt limits. At least a resolve check before the machine is made.
Fix 1 and 2 first.
Fixes #16217 and the boot-config half of #16218. Found by a security review of the pinned-forge path before forges are sold on it: a deployed forge could not be claimed by anyone, was served on a bare address over plain HTTP, ran as root with every port open, and had password SSH on.
Claim (#16217)
FORGE_FIRST_ADMIN_SEED=<sha256>@<deadline>andseedFirstAdminseeds the existing first-admin row from it once. One redemption path, as before; the claim lives 7 days (FIRST_ADMIN_SEED_TTL_MS).GET /api/v1/first-admin/claim?seed=<hash>), not kept by the seller.FORGE_BIND;urlOfishttps://<host>/. DNS is not automated: deploy and check name the record, and check says "waiting for DNS" until the name resolves to the machine.Hardening (#16218)
forgefrom a root-owned Bun, under a locked-down unit. ufw allows 80 and 443 only. sshd refuses passwords and root. Unattended upgrades on. bubblewrap, socat and an AppArmor profile that lets/usr/bin/bwrapmake a user namespace.checkConfigrefuses names that steer the loader, runtime or path, the names the boot sets itself, and more secret-like names. The deployed forge's env setsFORGE_CREW_SANDBOX=require(honoured by #16233).Not done
claimPinned, which replaces the machine outside the update path.Tested Built by two subagents on a laptop. Before the merge, on Bun 1.4.2: typecheck clean, gate 0, 313 pass in 19 files, 975 pass in 23 guard files. After the merge, only what runs without a listening socket was run: typecheck clean, gate 0,
pinned-harden,pinned-forge-recovery,pinned-hetzner,pinned-canary,first-admin-recovery-unitand 7 ofpinned-claimpass. NOT run after the merge:pinned-forge,pinned-forge-address,pinned-hetzner-doors,pinned-page,first-admin,first-admin-recovery,first-admin-timing, and the two-forge block inpinned-claim; expected call sequences inpinned-forgeandpinned-claimwere edited without being run. This pull's check is their first run. Nothing here has booted on a real machine;docs/features/pinned-forge.mdlists what only a real boot proves.A fix-up follows on this branch: Caddy's certificates on the data volume, and no default page before our config.
No look: the pinned page gains a hostname field and a one-time claim link.
Files: src/cloud/machine.ts, src/cloud/harden.ts, src/cloud/throwaway_key.ts, src/cloud/droplet.ts, src/cloud/hetzner.ts, src/core/pinned.ts, src/core/first_admin.ts, src/actions/pinned.ts, src/http/pinned_routes.ts, src/web/pinned.ts, src/tui/screens/pinned.ts, src/main.ts
🤖 Generated with Claude Code