Repository navigation
Open
Labels
Milestone
Description
Idea
The 11 regional spawn-binaries-* buckets currently grant public read on spored-*:
{ "Sid": "PublicReadForBinaries", "Effect": "Allow",
"Principal": "*", "Action": "s3:GetObject",
"Resource": "arn:aws:s3:::spawn-binaries-<region>/spored-*" }So anyone on the internet can download the spored binary. It would be better if the binaries (and the buckets generally) were reachable only from real spawn-launched EC2 instances.
Why it matters
- spored is the lifecycle agent that runs on every launched instance with permissions to self-terminate/stop and read instance tags. Keeping its binary public is unnecessary attack surface (supply-chain recon, tampering analysis, hotlinking).
- spawn already provisions a per-instance IAM role (
spored-instance-rolein the compute account435415984226) and the buckets already have a cross-account statement formpi-keys/*using it — so the IAM plumbing to do this the right way mostly exists.
Design options
- IAM-only access (preferred). Drop the
PublicReadForBinariesPrincipal: "*"statement. Grants3:GetObjectonspored-*to the instance role(s) spawn attaches (spored-instance-role/SetupSporedIAMRoleoutput), and have the boot userdata fetch viaaws s3 cp(authenticated by the instance profile) instead of a public HTTPS URL. Requires: confirm the userdata install path usesaws s3 cpwith the instance role in every launch mode (single, sweep, batch, MPI), and that the role's policy covers all regions (spawn-binaries-*). - VPC-endpoint / aws:SourceVpce condition. Restrict
GetObjectto requests coming through an S3 gateway VPC endpoint. Tighter network boundary but more moving parts (every launch VPC needs the endpoint). - aws:PrincipalOrgID condition. Limit to principals in the AWS Org. Coarse but simple; blocks the open internet while allowing any org account.
Option 1 is the cleanest fit since the instance role already exists.
Migration care (don't break launches)
- The bucket policy and the boot-time fetch must change together — if we drop public read before userdata switches to authenticated
aws s3 cp, every new instance fails to install spored. - Verify the instance role's S3 policy already allows
spawn-binaries-*(it referencesarn:aws:s3:::spawn-binaries-*/*inpkg/aws/client.go/iam.go— confirm it's attached at launch). - Roll out: update userdata fetch → confirm authenticated fetch works on a test launch in each region → then tighten the bucket policy.
Acceptance
curl https://spawn-binaries-us-east-1.s3.amazonaws.com/spored-linux-amd64returns AccessDenied (no longer public).- A real
spawn launchin every supported region still installs spored successfully (authenticated fetch). mpi-keys/*cross-account access preserved.
Context
Surfaced while fixing the release pipeline (#13): the OIDC trust was repaired and 3 missing regional buckets (eu-west-2, ap-southeast-1, ap-northeast-1) were created — all currently with the same public-read policy. Good time to revisit the access model before more regions are added.
Activity