sshkey: a degraded entropy source mints a corrupt key and reports success #287
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#287
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?
internal/sshkey/sshkey.go:101—_, _ = io.ReadFull(random, check). A failed/short read yields zeroed check-ints in the openssh-key-v1 blob, written 0600 and reported as a successful mint; the helper then bakes the public half into the guest's boot config as trusted.Acceptance
ReadFullerror propagates and no key file is written on failure.Filed from the 2026-08-05 fail-loud audit (three-agent pre-production sweep; findings verified against code).
Blocked — the code this issue targets does not exist in the repository.
I attempted to fix
internal/sshkey/sshkey.go:101(_, _ = io.ReadFull(random, check)) and found:internal/sshkeypackage — not in the current worktree, not onorigin/main, and not anywhere in git history (git log --all --diff-filter=A -- 'internal/sshkey/**'is empty).internal/contains nosshkeydirectory.sshkey.Ensureminter (grep 'func Ensure'across the repo returns nothing), despite sibling issue #281 describing it as "already used by the helper".io.ReadFull(_, _ = io.ReadFull) anywhere in the tree.SSHHostKeyin the codebase is still a raw literal placeholder:agent/cmd/agent/main.go:231,290("skeleton-ssh-host-key"),internal/founding/standuprented.go:122("rented-gateway-ssh-host-key"),internal/founding/privatepath.go:199("private-gateway-vm-ssh-host-key").This issue (and #281/#282, which reference the same non-existent
sshkey.Ensureand amintPrivateVMKeyatprivatepath.go:164that is also absent) appears to have been filed by the 2026-08-05 audit against a codebase state that includes aninternal/sshkeypackage that never landed on this branch. The acceptance ("theReadFullerror propagates and no key file is written on failure") presupposes an existing mint routine there is nothing to amend.To re-arm, a human must decide:
internal/sshkey(the real host-key minter withEnsure), then re-addready-for-agenthere — this fix is a one-line error-propagation on top of that; orsshkeyminter from scratch (a new surface, overlapping #281/#282's wiring), if that is the intended deliverable.I did not create the package, as that would invent a surface this bug-fix issue does not define and overlap the sibling issues' scope. No code changed.
Ben ruled (2026-08-06, ready-for-human sweep): fix as specced — propagate the
ReadFullerror, no key file written on failure, failing-reader test. Flippedready-for-agentfor the swarm.Fixed in
39a149d(pushed to origin/main).The
internal/sshkeypackage landed via #281 in ed25519 form (raw private key, no openssh-key-v1 check-ints), so the literalio.ReadFull(random, check)line the audit cited no longer exists — but the underlying hazard (a degraded entropy source minting a corrupt key and reporting success) applies to the seed read insideed25519.GenerateKey. Fixed as Ben ruled:generateFrom(path, random io.Reader);generatepassesrand.Reader.ed25519.GenerateKeyreads the seed viaio.ReadFull, so a short/failed read surfaces the error BEFOREMkdirAll/WriteFile— the error propagates and no key file is written on failure.TestEnsureFailsLoudOnDeadEntropydrives afailingReaderand asserts the loud error plusos.IsNotExiston the key path.Evidence:
internal/sshkey/sshkey.go,internal/sshkey/sshkey_test.go;go test ./internal/sshkey/green, full pre-push gate green.