Repository navigation
feat(security): sign spored binaries + verify at boot - #427
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The review's #1 security finding: spored's boot-time integrity was a same-bucket sha256 (corruption detection, not publisher authentication). Move the trust root out of the S3 bucket. - pkg/launcher/spored_pubkey.go: embedded spore.host signing PUBLIC key (var, for rotation/tests) + signatureVerificationEnabled(). Empty until the KMS key is provisioned → verification stays off (honest sha256-only), no false claim. - pkg/launcher/bootstrap.go: when a key is compiled in, the generated bootstrap writes it to /etc/spawn and, after the sha256 check, downloads the detached .sig and verifies it with against the embedded key BEFORE exec — fail closed on mismatch or missing sig. Trust root = the spawn binary (Homebrew/GitHub-release trusted), not the bucket. - .github/workflows/release.yaml: sign each spored binary with the infra KMS asymmetric key (ECDSA_SHA_256, kms:Sign — private key never leaves KMS) and publish base64-DER .sig alongside the binary at every path the bootstrap reads. Gated on repo var SPORED_SIGNING_KEY_ID; unset → sha256-only (rollout-safe). - Tests: disabled-path (SPORED_SIG_VERIFY=0, no key written) + enabled-path (embeds key, openssl verify, fail-closed). Crypto round-trip validated locally: base64-DER ECDSA_SHA_256 sig verifies with openssl; tampered binary rejected. Flips SECURITY.md's interim honest wording to signature-verified once released with the key. Refs #440. GATED FOLLOW-UPS (need approval / infra): provision the KMS key + grant the release role kms:Sign + set SPORED_SIGNING_KEY_ID + embed the real pubkey; then a real-AWS boot smoke (verify sig → spored runs; tamper negative).
scttfrdmn
force-pushed
the
feat/ws2-spored-signing
branch
from
July 21, 2026 18:15
cbcaa0c to
10f76ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #440 — the review's #1 security finding. spored's boot-time integrity was a
.sha256fetched from the same S3 bucket as the binary: that detects corruption but can't authenticate the publisher (an attacker who rewrites the bucket rewrites the checksum too). This moves the trust root out of the bucket.How
pkg/launcher/spored_pubkey.go). The trust root becomes the spawn binary — already trusted via the Homebrew tap / signed GitHub release — not the S3 bucket.pkg/launcher/bootstrap.go): when a key is compiled in, the generated user-data writes it to/etc/spawn, and after the sha256 check downloads a detached.sigand runsopenssl dgst -sha256 -verifyagainst the embedded key before executing spored. Fail closed on mismatch or a missing signature. The sha256 stays as a cheap corruption guard..github/workflows/release.yaml): each spored binary is signed with an infra-account KMS asymmetric key (ECDSA_SHA_256viakms:Sign— the private key never leaves KMS); base64-DER.sigfiles are published alongside the binary at every path the bootstrap reads.SPORED_SIGNING_KEY_ID. Until the key is provisioned, signing is skipped and the bootstrap stays sha256-only with an honest log line (no false "verified" claim) — matching a spawn build with no key compiled in. This is the real fix behind the interim honest wording already merged in SECURITY.md (feat(dashboard-api): move Slack secrets to Secrets Manager #446).Verification
SPORED_SIG_VERIFY=0, no key written) + enabled path (embeds key, emits the openssl verify + fail-closed).ECDSA_SHA_256signature (exactly KMS'ssign --output textformat) verifies withopenssl dgst -sha256 -verify pub.pem; a tampered binary is rejected. So the bootstrap logic matches KMS output.kms:Signon it; set repo varSPORED_SIGNING_KEY_ID.spored_pubkey.go.Merging this PR is safe before those (signing stays off until the key/var exist). Refs #440.