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

'sso-session' name is not compatible with awscli_v2 #2315

Open
pznamensky opened this issue Oct 16, 2023 · 1 comment
Open

'sso-session' name is not compatible with awscli_v2 #2315

pznamensky opened this issue Oct 16, 2023 · 1 comment
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue queued This issues is on the AWS team's backlog

Comments

@pznamensky
Copy link

Describe the bug

When there is a whitespace in sso session name, aws configure sso generates ~/.aws/config where sso-session section include session name with apostrophes, which is not recognised by aws sdk.

Expected Behavior

aws sdk is compatible with the config which aws configure sso generates

Current Behavior

aws sdk can't parse the config file with this error:
"failed to find SSO session section"

Reproduction Steps

  • invoke aws configure sso and type session name with whitespace
  • use aws sdk with newly created profile

Possible Solution

No response

Additional Information/Context

aws configure sso generates the following ~/.aws/config config:

[profile AdministratorAccessLimited-123]
sso_session = My Corp Ltd
sso_account_id = 123
sso_role_name = AdministratorAccessLimited
region = eu-west-1
[sso-session 'My Corp Ltd']
sso_start_url = https://some-url.awsapps.com/start#/
sso_region = eu-west-2
sso_registration_scopes = sso:account:access

If we remove apostrophes in sso-session section, everything will work fine:

...
[sso-session My Corp Ltd]
...

It looks like the fix is to add optional checking for apostrophes here:

section, ok := sections.GetSection(ssoSectionPrefix + strings.TrimSpace(c.SSOSessionName))

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go-v2 v1.21.0
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.83
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.21.1
github.com/aws/aws-sdk-go-v2/service/s3 v1.38.5
github.com/aws/smithy-go v1.14.2

Compiler and Version used

1.21.1

Operating System and version

ubuntu 22.04

@pznamensky pznamensky added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 16, 2023
@RanVaknin RanVaknin self-assigned this Oct 16, 2023
@RanVaknin RanVaknin added p2 This is a standard priority issue queued This issues is on the AWS team's backlog and removed needs-triage This issue or PR still needs to be triaged. labels Oct 16, 2023
@lucix-aws
Copy link
Contributor

Checking with the CLI folks on this -- the quoting of the profile they generate is technically out of spec to my understanding, but my guess is they're not going to be able to get away with changing that behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue queued This issues is on the AWS team's backlog
Projects
None yet
Development

No branches or pull requests

3 participants