Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not support "." (dots) in profile names #1163

Closed
PhilLavoie opened this issue Feb 13, 2024 · 4 comments · Fixed by #1173
Closed

Does not support "." (dots) in profile names #1163

PhilLavoie opened this issue Feb 13, 2024 · 4 comments · Fixed by #1173
Labels
feature-request A feature should be added or improved.

Comments

@PhilLavoie
Copy link

Given this ~/.aws/config INI:

[profile my.big.profile]
region = us-east-1
sso_session = my.sso
sso_account_id = 123456789
sso_role_name = BigRole

[sso-session my.sso]
sso_region = us-east-1
sso_start_url = https://magic-app.awsapps.com/start
sso_registration_scopes = sso:account:access

The loadSsoSessionData returns an object where the key is my instead of my.sso. This breaks the fromSso function which tries to get the session data using my.sso, literally.

This is a limitation of the AWS SDK for JS v3, as the aws CLI and the golang SDK support SSO sessions with dots in their names just fine.

@PhilLavoie
Copy link
Author

It seems like the fix would be to change that line for:

.reduce((acc, [key, value]) => ({ ...acc, [key.split(CONFIG_PREFIX_SEPARATOR).slice(1).join(CONFIG_PREFIX_SEPARATOR)]: value }), {});

@kuhe
Copy link
Contributor

kuhe commented Feb 27, 2024

@trivikr says the fix was released in @smithy/[email protected]

@kuhe kuhe added the closing-soon This issue will automatically close in 2 days unless further comments are made. label Feb 27, 2024
@trivikr
Copy link
Contributor

trivikr commented Feb 27, 2024

fix was released in @smithy/[email protected]

The feature request was implemented in parseIni in #1067
However, it was not moved to other utilities which consume parseIni, like loadSsoSessionData.

We'll have to get a minimal repro, and investigate what role CONFIG_PREFIX_SEPARATOR plays.

@trivikr
Copy link
Contributor

trivikr commented Feb 27, 2024

Reproduction code

$ cat test.mjs
import { loadSsoSessionData } from "@smithy/shared-ini-file-loader"; // v2.3.3
console.log(await loadSsoSessionData());

$ cat ~/.aws/config
[profile my.big.profile]
region = us-east-1
sso_session = my.sso
sso_account_id = 123456789
sso_role_name = BigRole

[sso-session my.sso]
sso_region = us-east-1
sso_start_url = https://magic-app.awsapps.com/start
sso_registration_scopes = sso:account:access

$ node test.mjs
{
  my: {
    sso_region: 'us-east-1',
    sso_start_url: 'https://magic-app.awsapps.com/start',
    sso_registration_scopes: 'sso:account:access'
  }
}

The change requested is for output to be:

$ node test.mjs
{
  'my.sso': {
    sso_region: 'us-east-1',
    sso_start_url: 'https://magic-app.awsapps.com/start',
    sso_registration_scopes: 'sso:account:access'
  }
}

@trivikr trivikr added feature-request A feature should be added or improved. and removed closing-soon This issue will automatically close in 2 days unless further comments are made. labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants