Skip to content

refactor(cmd): route STS caller-identity through pkg/aws helpers (#302) - #360

Merged
scttfrdmn merged 1 commit into
mainfrom
refactor/302-sts-getaccountid
Jul 15, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
refactor/302-sts-getaccountid

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Replaces the 17 inline sts.NewFromConfig(cfg).GetCallerIdentity(...) sites in cmd/ with the existing pkg/aws helpers, which also add an IMDS fallback.

What changed

Config preserved per site (important)

The two compute-account sites (launch_batchqueue, launch_sweep) keep using devCfg; the rest keep their caller/infra cfg. The helper binds to whatever config it's handed, so which account is resolved is unchanged.

Notes

  • Found a 17th site the issue didn't list (extend.go) and converted it too.
  • list-sweeps.go actually extracted the ARN (not account) into its userID — used GetCallerIdentityInfo accordingly.

Verification

Closes #302.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

The 17 inline sts.NewFromConfig(cfg).GetCallerIdentity(...) sites across cmd/
now call the existing pkg/aws helpers instead: GetAccountID for account-ID sites
and GetCallerIdentityInfo for ARN sites (list-sweeps/team/bot). Both add an IMDS
fallback for free when STS is unavailable.

Each site keeps its original config variable — the two compute-account sites
(launch_batchqueue, launch_sweep) still use devCfg, the rest use their
caller/infra cfg — so which account is resolved is unchanged. bot.go registration
needed both account ID and ARN, which GetCallerIdentityInfo returns together.

Tightened the cmd/ aws-sdk-import allowlist guard (#327) to drop sts from the
files that no longer import it.

Closes #302.
@scttfrdmn
scttfrdmn force-pushed the refactor/302-sts-getaccountid branch from 464650a to 476b8db Compare July 15, 2026 20:46
@scttfrdmn
scttfrdmn merged commit 434218a into main Jul 15, 2026
6 checks passed
@scttfrdmn
scttfrdmn deleted the refactor/302-sts-getaccountid branch July 15, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[audit] Dup: 18 inline sts.NewFromConfig+GetCallerIdentity sites bypass the existing GetAccountID helper

1 participant