Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Commit

Permalink
Set O_TRUNC when re-writing credentials file (#292)
Browse files Browse the repository at this point in the history
This should keep old crud from being included at the end of the file if it shrinks.
  • Loading branch information
ashanbrown authored Jul 7, 2020
1 parent 9787e7c commit 3ab9dff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/write-to-credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func writeToCredentialsRun(cmd *cobra.Command, args []string) error {
section.Key("aws_session_token").SetValue(creds.SessionToken)
section.Key("aws_security_token").SetValue(creds.SessionToken)

credFile, err := os.OpenFile(credFilePath, os.O_WRONLY, 0600)
credFile, err := os.OpenFile(credFilePath, os.O_WRONLY|os.O_TRUNC, 0600)
if err != nil {
return err
}
Expand Down

0 comments on commit 3ab9dff

Please sign in to comment.