specgen SSM resolver: stale static keys in ~/.aws/credentials shadow SSO profile #137

Closed
opened 2026-06-12 05:00:57 +00:00 by coilysiren · 0 comments
Owner

The generated consumer's ssmTokenResolver loads the aws-sdk-go-v2 default config chain, which prefers static keys in ~/.aws/credentials over an SSO profile of the same name in ~/.aws/config. A stale static [default] silently shadows SSO: the API rejects the dead key while the aws CLI (which resolves SSO) keeps working, so only the SDK path breaks and the failure is confusing.

Fix: retry the SSM fetch once with the credentials file excluded (WithSharedCredentialsFiles([]string{}) - non-nil empty slice means "read no credentials file") so the config-file SSO profile can resolve, and print a one-line note naming the shadowing file. Static-only users never reach the retry.

The generated consumer's `ssmTokenResolver` loads the aws-sdk-go-v2 default config chain, which prefers static keys in `~/.aws/credentials` over an SSO profile of the same name in `~/.aws/config`. A stale static `[default]` silently shadows SSO: the API rejects the dead key while the aws CLI (which resolves SSO) keeps working, so only the SDK path breaks and the failure is confusing. Fix: retry the SSM fetch once with the credentials file excluded (`WithSharedCredentialsFiles([]string{})` - non-nil empty slice means "read no credentials file") so the config-file SSO profile can resolve, and print a one-line note naming the shadowing file. Static-only users never reach the retry.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/cli-guard#137
No description provided.