Repository navigation
refactor(cmd): route STS caller-identity through pkg/aws helpers (#302) - #360
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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
force-pushed
the
refactor/302-sts-getaccountid
branch
from
July 15, 2026 20:46
464650a to
476b8db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the 17 inline
sts.NewFromConfig(cfg).GetCallerIdentity(...)sites incmd/with the existingpkg/awshelpers, which also add an IMDS fallback.What changed
aws.NewClientFromConfig(cfg).GetAccountID(ctx)list-sweeps,team,bot) →GetCallerIdentityInfo(ctx)(returns account + ARN;bot.goregistration needs both)cmd/aws-sdk-import allowlist ([audit] Guardrail: add a test forbidding NEW direct aws-sdk service imports in cmd/ (allowlist) #327 guard) to dropstsfrom files that no longer import itConfig preserved per site (important)
The two compute-account sites (
launch_batchqueue,launch_sweep) keep usingdevCfg; the rest keep their caller/infracfg. The helper binds to whatever config it's handed, so which account is resolved is unchanged.Notes
extend.go) and converted it too.list-sweeps.goactually extracted the ARN (not account) into itsuserID— usedGetCallerIdentityInfoaccordingly.Verification
go build ./...,gofmt,go vet ./cmdcleango test ./cmd -skip TestCatalogValidgreen (incl. the [audit] Guardrail: add a test forbidding NEW direct aws-sdk service imports in cmd/ (allowlist) #327TestNoNewAWSSDKImportsInCmdguard)grep sts.NewFromConfig cmd/→ zero remainingCloses #302.