Repository navigation
fix(bootstrap): install the pinned AWS CLI from the regional spawn-binaries mirror first (#1494) - #1503
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Release-role IAM applied (2026-11-02, owner-approved).
The real PutRolePolicy succeeded. The existing Simulated (custom policy and the live role):
Bucket policy: all 11 |
|
Live-verified on EC2 (2026-11-02) with a CLI built from Mirror: published to Test: a throwaway VPC (10.198.0.0/16) with no IGW and no NAT. The route table held only the local route plus the S3 prefix list via a gateway endpoint, with ec2/ssm/ssmmessages/ec2messages interface endpoints. Ubuntu 24.04 arm64 t4g.small, with Result: PASS.
Teardown: the VPC, endpoints, SG, route table and subnet were deleted. The leak check is clean (only the owner's and a concurrent EFA test's instances remain); cost under $0.05. |
c903c95 to
b755fd4
Compare
Fixes #1494
What
An Ubuntu instance in a private subnet (only VPC endpoints, the
--no-public-ipcase) cannot reachawscli.amazonaws.com, so since #1490 its bootstrap fails closed installing the pinned AWS CLI. This PR has the release mirror the two pinned zips into everyspawn-binaries-<region>bucket, and has the bootstrap try that mirror first.Design
pkg/launcher/bootstrap.go).spawn_need_aws REGIONtrieshttps://spawn-binaries-$region.s3.$region.amazonaws.com/spawn/awscli/awscli-exe-linux-<arch>-<version>.zipfirst. That is the regional S3 name (bootstrap: fetch spored from the regional S3 name so an S3 interface endpoint serves a private-only instance #1436), which gateway and interface endpoints both serve. It then trieshttps://awscli.amazonaws.com/.... Each source's bytes must match the pinned sha256 before anything is unpacked. A mirror zip that fails the check is reported (AWS CLI zip from <url>: sha256 mismatch) and the origin is tried. The two callers pass the region they already have:"$REGION"in the body, and"$SPAWN_ST_REGION"(the launch-region staging bucket) in the staged-files fetch, which runs before the body reads$REGION.spawn/awscli/, not a new top-levelawscli/. Instances already readspawn/...anonymously. The file name is AWS's own, so only the base URL differs between the two sources.launcher.AWSCLIPins()(exported, soapi/public-surface.txtis regenerated) and a hiddenspawn awscli-pinprint<arch> <version> <sha256> <mirror key>. The release mirrors exactly what the tagged build fetches.scripts/mirror-awscli.sh, two new steps inrelease.yaml, after the versioned-spored verify and before GoReleaser).publishimportsscripts/awsclipin/aws-cli-team.ascinto a throwaway GNUPGHOME and requires exactly one primary key,FB5DB77FD5C118B80511ADA8A6310ACC4672475C..sigfromawscli.amazonaws.com, requiresgpg --verifyto pass, requires aVALIDSIGwhose primary fingerprint is the pinned one, and requires the pinned sha256. Only then does it upload, to all buckets inSPAWN_BINARY_BUCKETS.bump-awscli-pin.sh.verifyfetches every copy over anonymous HTTPS at the regional name, the way an instance does, and requires the pinned sha256 and the bytes publish verified. So it also proves the bucket policy servesspawn/awscli/publicly.publishkeeps, per bucket, the pinned version and the two newest other versions underspawn/awscli/, andaws s3 rms older ones. Keys not of the mirror's own name form are never touched.--no-public-ippre-flight (pkg/aws/private_network.go): it already requires an S3 endpoint and refuses regions with no bucket, so no new check is needed. Only the S3 reason text now mentions the AWS CLI.Before tagging v0.156.0: IAM on the hand-managed release role (not verifiable here)
GitHubActions-spore-host-release(inlineSpawnBinariesS3Upload) allowed only specific keys at v0.143.0. The mirror step needs:s3:PutObjectands3:DeleteObjectonarn:aws:s3:::spawn-binaries-*/spawn/awscli/*s3:ListBucketonarn:aws:s3:::spawn-binaries-*withs3:prefixspawn/awscli/*Without them the release stops at the mirror step, before GoReleaser, so nothing broken is published. The bucket policy must also allow anonymous
GetObjectunderspawn/awscli/; the verify step fails if it does not.Bootstrap body
63421a2d…3d23(v0.155.0) to73d1876b92ed94d9ae07904ff70dd7b3d736ef635321d01609dc79e72b04c049, so deploy the sweep orchestrator from the release.Gates and revert evidence
Every revert below kept
go vetclean, and the named gate failed against it:TestAWSCLIMirrorTriedFirstAndShaChecked(boot sandbox, 7 cases)mirror … fetched 0 times, want 1,awscli.amazonaws.com was fetched 1 times, want 0installed "evil\n", want "good\n",a zip that is not the pinned one was unpacked and installed, bad-mirror cases exit 0TestEverySpawnNeedAWSCallNamesItsRegion(discovers calls in all rendered bootstraps)"$SPAWN_ST_REGION"spawn_need_aws called with 0 argsin 4 staged variantsTestReleaseMirrorRefusesAnUnverifiedAWSCLI(runs the real step, real gpg, throwaway key)signed by another key:the mirror step succeededkey file holds a second key: succeededvalidly signed but not the pinned sha256: succeededTestReleaseMirrorRequiresThePinnedSigner(rule 2: disables the key-count check in the sandbox copy, signs with a second imported key)&& $NF == fprremoved)a zip signed by a key other than the pinned one was mirroredTestReleaseMirrorsExactlyThePinnedAWSCLI(buckets fromsporedinstall.PublishedRegions(); a newer 2.99.0 zip at the origin must not be mirrored)awscli/insteadholds [].sigholds [… .sig …], want exactly the pinnedspawn-binaries-us-east-1 holds []TestReleaseMirrorDeletesOldVersionsKEEP=100TestReleaseMirrorVerifyCatchesABadCopyaltered: verify passedmissing: verify passedTestReleaseMirrorsTheAWSCLIBeforeTheCLImirror 13, verify 14, GoReleaser 10TestMirrorScriptPinsTheAWSCLITeamKeypins FB5DB77E…, want … FB5DB77F…TestAWSCLIPinCommandPrintsThePinsprinted 1 lines for 2 pinsgpg tests use a GNUPGHOME under /tmp and
gpgconf --kill allon cleanup; the script's own trap does the same. They skip without gpg or on Windows.Checks
These pass:
make check, from /private/tmp.make lint: 0 issues in all 10 modules.semgrep scan --config=auto --error .: rc 0.actionlint: release.yaml is clean. The only finding repo-wide is the existing SC2001 atci.yml:98, which is also on main.shellcheck scripts/mirror-awscli.shmake check-docs: the new command is hidden, so there is no docs drift.Not verified here
There were no AWS calls. Still unverified: the release role's permissions, anonymous read of
spawn/awscli/, and a real Ubuntu--no-public-iplaunch.