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

write: update config file section with same name if no cred process flag #453

Merged
merged 3 commits into from
Jun 19, 2024

Conversation

gord5500
Copy link
Contributor

@gord5500 gord5500 commented Jun 17, 2024

Why

Default credentials file takes priority over the default config which is where we store profiles using credential_process. If someone had an existing profile in config file and then runs bmx write, creds will be stored into the default credentials file making the existing one useless. We should remove the existing key in the config file so there is no confusion.

credential_process is the better way for majority of people but there are some scenarios where it's not supported. So we are leaving some information to the user that it is no longer being used. Just in case they unintentionally ran write without the flag. Not going with a prompt to confirm because that could break existing scripts

Ticket

VUL-385

@gord5500 gord5500 marked this pull request as ready for review June 17, 2024 11:51
@gord5500 gord5500 requested a review from a team as a code owner June 17, 2024 11:51
src/D2L.Bmx/WriteHandler.cs Outdated Show resolved Hide resolved
@@ -85,6 +85,27 @@ bool useCredentialProcess
+ $" --role {awsCredsInfo.Role}"
+ $" --duration {awsCredsInfo.Duration}";
} else {
if( File.Exists( SharedCredentialsFile.DefaultConfigFilePath ) ) {
string profileName = $"profile {profile}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it's really the section name rather than profile name

Suggested change
string profileName = $"profile {profile}";
string sectionName = $"profile {profile}";

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like there's an opportunity to refactor and dedupe some logic and declarations in this whole "write" area. It's getting a bit messy now. But we can do it another time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically the section removing part or something else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything about handling AWS creds and config files

@gord5500 gord5500 merged commit a494d89 into main Jun 19, 2024
9 checks passed
@gord5500 gord5500 deleted the write/clear_config_file_if_no_cred_process_flag branch June 19, 2024 13:38
cfbao added a commit that referenced this pull request Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants