mirror of
https://github.com/ko-build/ko.git
synced 2025-03-17 20:47:51 +02:00
Don't log the value of --password if given (#458)
This commit is contained in:
parent
688ca47675
commit
b9cd759f25
@ -90,7 +90,7 @@ func addCreate(topLevel *cobra.Command) {
|
||||
// remaining flags passed after '--'.
|
||||
argv := []string{"apply", "-f", "-"}
|
||||
if kflags := kf.Values(); len(kflags) != 0 {
|
||||
skflags := strings.Join(kflags, " ")
|
||||
skflags := strings.Join(stripPassword(kflags), " ")
|
||||
log.Printf(kubectlFlagsWarningTemplate,
|
||||
"create", skflags,
|
||||
"create", skflags)
|
||||
@ -147,3 +147,14 @@ func addCreate(topLevel *cobra.Command) {
|
||||
|
||||
topLevel.AddCommand(create)
|
||||
}
|
||||
|
||||
func stripPassword(flags []string) []string {
|
||||
cp := make([]string, len(flags))
|
||||
for _, f := range flags {
|
||||
if strings.HasPrefix(f, "--password=") {
|
||||
f = "--password=REDACTED"
|
||||
}
|
||||
cp = append(cp, f)
|
||||
}
|
||||
return cp
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user