Skip to content

--account / SPORE_ACCOUNT is accepted but never checked (only spawn doctor reads it) #1118

Closed

Description

@scttfrdmn

Found in the documentation audit (spore-host/spore-host#585). truffle has the same bug as truffle#206; this is spawn's.

The promise:

  • The root flag reads --account string Expected AWS account ID (optional guard).
  • docs/guides/aws-auth.md (~66, ~91) and docs/reference/environment-variables.md (~29) say a tool "refuses to act if your credentials resolve to a different account" when --account or SPORE_ACCOUNT is set.

The code (main):

  • cmd/root.go:139 passes the flag to spawnconfig.SetSharedFlags, and pkg/config/shared.go stores it.
  • The only reader of SharedConfig().Account is pkg/doctor/aws_prober.go:90.
  • pkg/aws/client.go (NewClientWithRegion) uses the shared profile and region, never the account.

So spawn --account 111111111111 launch … with credentials for another account launches anyway.

Why it matters: this is a safety guard people set precisely because spawn creates billable resources. A guard that silently does nothing is worse than none: it's counted on.

Fix: after loading the AWS config in NewClientWithRegion, if an expected account is set, call STS GetCallerIdentity once (cached per process) and refuse with both account IDs on a mismatch. Doctor already has the comparison logic. The docs will describe current behaviour until this lands.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions