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

Unexpected empty space is added to credentials profile name #2650

Closed
forkercat opened this issue Aug 30, 2023 · 6 comments
Closed

Unexpected empty space is added to credentials profile name #2650

forkercat opened this issue Aug 30, 2023 · 6 comments
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue pending-release This issue will be fixed by an approved PR that hasn't been released yet.

Comments

@forkercat
Copy link
Contributor

Describe the bug

An empty space is added to a credentials profile name when I used AWSConfigFileProfileConfigLoader to load and save all credentials profiles to ~/.aws/credentials. For example, the profile name line in the file should be [default], but it is [ default].

This does not cause any issue in code when I used the loader to load the credentials file. However, the AWS CLI cannot recognize this format:

Unable to locate credentials. You can configure credentials by running "aws configure".

Expected Behavior

No empty space before the profile name after saving to ~/.aws/credentials:

[default]
aws_access_key_id=123
aws_secret_access_key=w123
region=us-west-2

[error_profile]
aws_access_key_id=123123
aws_secret_access_key=123123213213
region=eu-west-1

Current Behavior

An empty space is added before the profile name after saving to ~/.aws/credentials:

[ default]
aws_access_key_id=123
aws_secret_access_key=w123
region=us-west-2

[ error_profile]
aws_access_key_id=123123
aws_secret_access_key=123123213213
region=eu-west-1

Reproduction Steps

  1. Build and import AWS SDK as instructed
  2. Use AWSConfigFileProfileConfigLoader to load and save credentials configurations
  3. See the output in ~/.aws/credentials

Possible Solution

Did some investigation. Looks like the issue is caused by this line in AWSConfigFileProfileConfigLoader.cpp#L567.

outputFile << LEFT_BRACKET << prefix << " " << profile.second.GetName() << RIGHT_BRACKET << std::endl;

It should be changed to:

outputFile << LEFT_BRACKET << prefix << (m_useProfilePrefix ? " " : "") << profile.second.GetName() << RIGHT_BRACKET << std::endl;

m_useProfilePrefix is on when we use the loader to load and save non-credentials profile (e.g. [profile default]).

Tested locally and it worked. Putting up a PR...

Additional Information/Context

No response

AWS CPP SDK version used

1.11.136

Compiler and Version used

Visual Studio 2022

Operating System and version

Windows 11

@forkercat forkercat added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 30, 2023
@yasminetalby yasminetalby self-assigned this Aug 30, 2023
@forkercat
Copy link
Contributor Author

PR: #2651

@yasminetalby yasminetalby added p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Aug 30, 2023
@yasminetalby
Copy link
Contributor

Hello @forkercat ,

Thank you very much for your submission and contribution.
We'll test your PR and update you here.

Best regards,

Yasmine

@forkercat
Copy link
Contributor Author

^Cut a ticket to AWS CLI to fix the read issue.

@yasminetalby yasminetalby added the pending-release This issue will be fixed by an approved PR that hasn't been released yet. label Sep 12, 2023
@forkercat
Copy link
Contributor Author

Checked that the changes are released in 1.11.162

@yasminetalby
Copy link
Contributor

Hello @forkercat ,

Thank you very much for your collaboration.

This issue has indeed been fixed in v1.11.162 of the SDK. I am therefore closing this submission.

Let me know if you have any further inquiries regarding the AWS CPP SDK.

Best regards,

Yasmine

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

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 pending-release This issue will be fixed by an approved PR that hasn't been released yet.
Projects
None yet
Development

No branches or pull requests

2 participants