Skip to content

Harden spawn-binaries buckets: restrict spored download to spawn-launched instances (drop public read) #19

Open

Description

@scttfrdmn

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-role in the compute account 435415984226) and the buckets already have a cross-account statement for mpi-keys/* using it — so the IAM plumbing to do this the right way mostly exists.

Design options

  1. IAM-only access (preferred). Drop the PublicReadForBinaries Principal: "*" statement. Grant s3:GetObject on spored-* to the instance role(s) spawn attaches (spored-instance-role / SetupSporedIAMRole output), and have the boot userdata fetch via aws s3 cp (authenticated by the instance profile) instead of a public HTTPS URL. Requires: confirm the userdata install path uses aws s3 cp with the instance role in every launch mode (single, sweep, batch, MPI), and that the role's policy covers all regions (spawn-binaries-*).
  2. VPC-endpoint / aws:SourceVpce condition. Restrict GetObject to requests coming through an S3 gateway VPC endpoint. Tighter network boundary but more moving parts (every launch VPC needs the endpoint).
  3. 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 references arn:aws:s3:::spawn-binaries-*/* in pkg/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-amd64 returns AccessDenied (no longer public).
  • A real spawn launch in 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

  1. added
    enhancement
    on May 31, 2026
  2. added
    area:infra
    on Jun 12, 2026
  3. added this to the Later milestone on Oct 19, 2026
  4. modified the milestones: Later, Post-1.0 on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:infraenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions