Skip to content

Sweep orchestrator: bind the record's writer to its target account (rest of #1584) #1631

Open

Description

@scttfrdmn

This is the part of #1584 (pre-1.0 audit input-3) that the orchestrator cannot fix in its own code. The record names the target account, and nothing binds the record's writer to that account.

State after the #1584 PR: before every AssumeRole, the orchestrator refuses an aws_account_id that is not a 12-digit ID, is forbidden (pkg/trustboundary), or is its own control-plane account. It still acts in any other account whose SpawnSweepCrossAccountRole trusts it, chosen by whoever writes the spawn-sweep-orchestration item. #1586 already limits the blast radius there: CreateTags only at create, Terminate only spawn:managed=true. But RunInstances with a chosen user data and the spored role is still possible in any such account.

Why it cannot be checked at runtime today: every field of the record (aws_account_id, user_id, s3_params_key) comes from the writer. CreateSweepRecord (pkg/sweep/detached.go) writes user_id as the infra caller's ARN, and scheduler-handler copies schedule records written the same way. A Lambda Invoke carries no caller identity. There is no ExternalId, by owner decision.

Options, each with an infra change:

  1. A SigV4 front door (Function URL, AuthType: AWS_IAM, like dns-updater). The CLI calls it with the compute-account credentials it already holds for the sweep role, and the door writes the record with aws_account_id = the verified caller account. PutItem on spawn-sweep-orchestration and spawn-schedules is then removed from every operator or CLI principal, leaving only the door and scheduler-handler. Schedules get the same door, so scheduled sweeps inherit a verified account.
  2. An orchestrator-only MAC: a KMS HMAC key only the orchestrator and the door can use, GenerateMacing (sweep_id, aws_account_id, s3_params_key) at creation. The orchestrator verifies it on every invocation. This is still a front door, because something must verify the account before minting the MAC.
  3. An attestation in the target account: the CLI writes a per-sweep marker in the compute account (an SSM parameter /spawn/sweeps/<sweep_id> holding the params hash), and the orchestrator reads it with the sweep role before launching. This needs a sweep-role grant and a schema bump, and it does not cover scheduled sweeps unless schedules are attested the same way.

Deployed-state check (owner), from the original finding: who holds dynamodb:PutItem/UpdateItem on spawn-sweep-orchestration, s3:PutObject on the params bucket, and lambda:InvokeFunction on spawn-sweep-orchestrator in 966362334030. If those are only operators who also own every compute account, nothing crosses a trust boundary today and this is hardening.

Activity

  1. added this to the Hardening milestone on Nov 14, 2026
  2. added
    type:security
    on Nov 14, 2026
  3. scttfrdmn commented on Nov 14, 2026

    @scttfrdmn
    ContributorAuthor

    One more residual from the #1584 finding: SpawnSweepCrossAccountRole still grants ec2:CancelSpotInstanceRequests on * with no condition (pkg/aws/sweep_role.go, the first Allow). A writer-chosen target account therefore also lets the orchestrator cancel any spot request there, not only its members'. Conditioning it on a tag needs the members' spot requests to be tagged at RunInstances (TagSpecifications with ResourceType: spot-instances-request). Worth doing together with the binding above.

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

    type:security

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions