Skip to content

Commit

Permalink
internal/credhelper/set.go: obfuscate by default, add password only f…
Browse files Browse the repository at this point in the history
…or cmd execution
  • Loading branch information
VonC committed Oct 6, 2022
1 parent ac6a7fa commit 322dbb8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/credhelper/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func (ch *credHelper) Set(username, password, servername string) error {
if password == "" {
return fmt.Errorf("set: password is mandatory")
}
cmd := fmt.Sprintf("printf \"host=%s\\nprotocol=https\\nusername=%s\\npassword=%s\"|\"%s\" store", servername, username, password, ch.exe)
obfuscatedCmd := rePassword.ReplaceAllString(cmd, `password=xxxx"`)
obfuscatedCmd := fmt.Sprintf("printf \"host=%s\\nprotocol=https\\nusername=%s\\npassword=xxxx\"|\"%s\" store", servername, username, ch.exe)
cmd := rePassword.ReplaceAllString(obfuscatedCmd, fmt.Sprintf(`password=%s"`, password))
fmt.Println(obfuscatedCmd)
_, _, err := syscall.ExecCmd(cmd)

Expand Down

0 comments on commit 322dbb8

Please sign in to comment.