Repository navigation
fix(security): pipeline stage instances install spored through the verified installer (#1173) - #1185
Merged
Merged
Conversation
…rified installer (#1173) The pipeline orchestrator's stage user data installed spored with its own inline curl straight into /usr/local/bin and a sha256 from the same bucket, never verifying the signature. It now embeds the signing key and calls pkg/sporedinstall's fail-closed installer, like every other path. TestEverySporedDownloaderUsesTheVerifiedInstaller now discovers every .go file in the repo (it only walked cmd/ and pkg/), matches an invocation of the installer rather than its name, and requires KeySetupScript so the install cannot silently degrade to sha256-only. Fixes #1173
scttfrdmn
force-pushed
the
fix/1173-orchestrator-verified-install
branch
from
October 19, 2026 07:52
9048bd3 to
d601d48
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
Security fix. The pipeline orchestrator Lambda builds the user data for every pipeline stage instance (
generatePipelineUserData, called fromlaunchStage). That user data installed spored with its own inline snippet:curl -f -o /usr/local/bin/spored …straight into the destination,chmod +x.It never fetched a
.sigor ranopenssl dgst -verify. The sha256 proves the download wasn't corrupted. It does not prove the binary is authentic. So anyone who could write to aspawn-binaries-*bucket could run code as root on every pipeline stage instance. This is the class GHSA-3x4q-99gh-fxhx (#819) closed for the other install paths.The fix:
sporedinstall.KeySetupScript() + sporedinstall.VerifiedInstallFunc()and callsspore_install_verified_spored "$BINARY" <bases>, the same aspkg/launcher/bootstrap.go.%sargument, not spliced into thefmt.Sprintfformat, because the generated shell contains%.The orchestrator also gets the installer's EL8 curl and SELinux relabel fixes (#1056, #1052, from #1174) for free.
Two smaller defects in the old snippet, moot now:
/usr/local/bin/spored, so a failed checksum left the unverified binary in place.$(cat spored.sha256)against the bare hash.pkg/sporedinstalltakesawk '{print $1}'. If the published.sha256is insha256sumformat (hash filename), the old comparison could never pass. I have not checked the published format, because that needs an S3 fetch.Module note.
lambda/pipeline-orchestratorhas nogo.mod. It is part of the root module, not a nested one, so there was nogo mod tidyto run. It already importedpkg/aws.The gate, widened
TestEverySporedDownloaderUsesTheVerifiedInstallerwalked onlycmd/andpkg/, so it never saw this file. Its discovery is nowdiscoverSporedDownloaders, which walks every.gofile in the repository, including the nested lambda modules andscripts/. It skips only.git,node_modulesandvendor, and fails if it finds nothing.Watched failing on the unmodified orchestrator before the fix. The only finding was:
Two tightenings in the same gate:
^\s*(if ! )?spore_install_verified_spored ". The oldstrings.Contains(FuncName)was satisfied by a comment. Tried: the old orchestrator plus a Go comment namingspore_install_verified_sporedandsporedinstall.KeySetupScript(). The old check would pass that. The new one fails it.sporedinstall.KeySetupScript()call. Without one,SPORED_SIG_VERIFYis unset and the installer silently checks only the sha256. That is the fail-open variant of this exact fix.TestNoCallSiteSwallowsTheInstallerFailureused a hard-coded list of three files. It now iterates the discovered set, with a floor of 3.Behaviour tests (orchestrator, executed)
execUserDatanow runs the verified installer for real:sporedinstall.SigningKeyPEMfor the render.opensslverifies it./etc/spawnis rooted in the temp dir, andsystemctlis faked.New tests in
verified_install_test.go:TestUserData_InstallsASporedSignedByTheEmbeddedKey: the positive control. It installs and runsspored run-pipeline-stage.TestUserData_RefusesASporedSignedByAnotherKey: the checksum matches but the signer is foreign. spored is never run, FAILED is written, and the instance self-terminates.TestUserData_RefusesAnUnsignedSpored: no.sigat any base. Refused the same way.TestUserData_EmbedsTheSporeHostSigningKey: the production render carriesSPORED_SIG_VERIFY=1and the real key, and stays under the 16 KB user-data cap.Reverts tried. Both compile (
go vetclean) and both fail:main.gorestored fromorigin/mainKeySetupScript()dropped, onlyVerifiedInstallFunc()All existing orchestrator tests pass against the new harness, including the stage-runner end-to-end ones.
Checks
GOTOOLCHAIN=go1.26.9 make check: fmt, vet (all GOOS), staticcheck, hermetic tests, the 9 nested modules and tidy all pass.check-build-tagsfails with the same file list as unmodifiedorigin/mainon this machine (diffed; it's the/private/tmppath issue), so it's local-only.make check-docs: clean, no help text changed.semgrep scan --config=auto --error .: clean.Deployment and advisory
Not covered
.sha256format was not checked (see above).Fixes #1173