gateway-image build.sh still creates its build droplet with EVERY DO account key — narrow it to the executor's own (#744 defence in depth) #860
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#860
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Defence in depth left over from #744 (which fixed the leak itself — the golden snapshot no longer carries the build box's
/root/.ssh/authorized_keys, proven live onidss-gateway-d49ece2b7e0c).scripts/gateway-image/build.shstill creates its throwaway build droplet with every key on the DigitalOcean account:Only ONE of those keys is ever used: the executor host's own, the one
nixos-anywhereandwait_sshSSH in with. The other ten-plus ride along for no reason — and they are what made #744 possible in the first place (nixos-anywherecopies the installer environment'sauthorized_keysinto the installed system). #744 closed the escape route; this closes the source.Worth noting the account key set is not static: the #744 probe caught a stale
idss-guest-trustline — another rental's app-minted operator key — baked into the snapshot, because the broker registers each rental's key at DO and the build happened to run while one was registered. Narrowing the create to the executor's own key removes that whole class.Suggested fix
scripts/gateway-image/preflight-ssh-key.sh(#856) already resolves exactly the right fingerprint — the executor host's registered keypair — and dies loud when there isn't one. Have it print that fingerprint and havebuild.shpass only that to--ssh-keys, instead of the account-widepaste -sd,. The preflight's existing seam test (scripts/gateway-image/tests/preflight-ssh-key-test.sh) extends to cover the new output; #744'sscripts/gateway-image/tests/gateway-image-generic-test.shkeeps proving the belt-and-braces scrub still runs.Two-way door: a one-line revertible change to a script, provable by the existing offline seam tests plus one live build. Confirmation is a rebuild — so
ready-for-session, same standing #744 used.Also noted, deliberately not done
The three pre-fix snapshots (
idss-gateway-28d0dff9c0de,-3e75735dc9d0,-f086c9cac29c) still carry the 12 baked keys. They are left in place on purpose: they are #744's one-command revert path. They are also a footgun — anything that pins an older snapshot by id gets the door back.scripts/lib/gateway-image-rebuild-lib.shalready keeps a bounded snapshot window; whether that reaper should be trusted to age these out, or they should be deleted by hand once the new image has driven green a few times, is a call for whoever picks this up.Filed by the #744 session under ADR 0174 rule 1 (file follow-ups, don't widen the ticket).
workflow_runevent here, and all 4 broker-deploy runs in history were manual #874Close report — landed under ADR 0174 (two-way door)
Commit:
487a2df6onmain— session: #860 — narrow the gateway-image build droplet to the executor's own DO key, not the whole account.What landed
scripts/gateway-image/build.shno longer rents its throwaway build droplet with the account-wide key set. The lineis gone. Instead,
scripts/gateway-image/preflight-ssh-key.sh(#856) — which already resolves and dies loud on exactly the executor host's own DO-registered keypair — now prints that one fingerprint on stdout (the confirm line stays on stderr), andbuild.shcaptures it at the same fail-fast call site:The assignment is plain (not
local), soset -estill propagates a non-zero preflight exit — the build still refuses at second 0 when this host holds no registered key, and no droplet is rented. The oldpaste -sd,line is replaced by a belt-and-braces[ -n "$ssh_keys" ]guard. The droplet is now created with--ssh-keys "$ssh_keys"= the executor's own fingerprint alone.This closes the source #744 named: nixos-anywhere copies the installer environment's
authorized_keysinto the installed system, so the account-wide set is what baked a dozen keys — including a staleidss-guest-trust(another rental's app-minted operator key) — into the golden snapshot. #744 closed the escape route (scrubs the leaked file); #860 removes what rides in.The #744 belt-and-braces scrub + generic-image assertion (step 4) are untouched — even the single remaining key is the build host's, so the scrub still drops the file. Its comment block was updated to reflect the narrowing.
Proof (offline seam tests, red before / green after)
scripts/gateway-image/tests/preflight-ssh-key-test.sh— 6 checks pass (was 4). Two new:--ssh-keys);build.shcaptures the preflight fingerprint intossh_keys, passes it to--ssh-keys, and no longer carriespaste -sd,.green path must print ONLY the matched fingerprint on stdout, got: '').scripts/gateway-image/tests/gateway-image-generic-test.sh(#744) — 5 checks pass, the scrub + assertion still pinned.bash -nclean on all three touched scripts;set -e-through-assignment fail-fast verified with a fake preflight.Live confirmation is a rebuild — a two-way door, the same standing #744 used. Not run in this session (no rebuild is in scope here); the next
scripts/gateway-image/build.shrun proves it end to end.Deliberately not done (residue, per the ticket)
The three pre-fix snapshots (
idss-gateway-28d0dff9c0de,-3e75735dc9d0,-f086c9cac29c) still carry the 12 baked keys and are left in place — they are #744's one-command revert path. Whether the bounded snapshot reaper (scripts/lib/gateway-image-rebuild-lib.sh) should be trusted to age them out, or they should be deleted by hand once the new image has driven green a few times, is a call for a follow-up — a one-way door (data destruction), not smuggled in here.Ruled by agent under ADR 0174 — veto anytime.