Fix UniqueCheck to only validate profiles within the requested SSO#1306
Fix UniqueCheck to only validate profiles within the requested SSO#1306nlang wants to merge 1 commit intosynfinatic:mainfrom
Conversation
UniqueCheck was iterating over all cached SSO instances instead of only
the profiles in the ProfileMap. This caused false duplicate errors when
multiple SSO instances had accounts with the same name/alias and role,
even though the ProfileFormat included {{ .SSO }} which would produce
unique names per SSO instance.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9a04c73 to
ae1e786
Compare
|
Previously, This fix scopes |
|
This PR is stale because it has been open for 30 days with no activity. |
|
Any chance this gets a look? This fixes a real issue that makes aws-sso unusable for people with multiple organizations with repeating account and role names. |
|
This would be a huge fix as I have also ran into this issue before and it was a pain to work arround. |
Summary
ProfileMap.UniqueCheck()was iterating over all cached SSO instances (s.Cache.SSO) instead of only the profiles actually contained in theProfileMapProfileFormatincluded{{ .SSO }}which would produce unique profile names per SSO instanceProfileMaprather than re-deriving them from all cached SSOsReproduction
AWS Organizations commonly have accounts with identical names across different organizations — e.g.
Organisation,Log Archive,Audit, orSecurity. When a user has multiple SSO instances configured and these accounts share the same role (e.g.AdministratorAccessorReadOnly), running:Produces a false duplicate error like:
Even though the
ProfileFormat{{ .SSO }}:...should generate distinct names likesso-a:Organisation:AdministratorAccessvssso-b:Organisation:AdministratorAccess.The root cause is twofold:
UniqueCheckiterated over all cached SSOs, not just the one being generatedRoles.ssoNamewas not set for the other SSO instances,{{ .SSO }}resolved to an empty string, making the profiles appear identicalTest plan
internal/sso/settings_test.goto validate duplicate detection within the ProfileMapinternal/awsconfig/config_test.goto reflect that cross-SSO profiles should not conflictgo test ./internal/...)