make sure we filter the ui as well as the logs

This commit is contained in:
Megan Marsh 2019-04-03 10:43:41 -07:00
parent e4842b69b4
commit a358b174a4
1 changed files with 14 additions and 0 deletions

View File

@ -247,6 +247,13 @@ func (rw *BasicUi) Message(message string) {
rw.l.Lock()
defer rw.l.Unlock()
// Use LogSecretFilter to scrub out sensitive variables
for s := range LogSecretFilter.s {
if s != "" {
message = strings.Replace(message, s, "<sensitive>", -1)
}
}
log.Printf("ui: %s", message)
_, err := fmt.Fprint(rw.Writer, message+"\n")
if err != nil {
@ -263,6 +270,13 @@ func (rw *BasicUi) Error(message string) {
writer = rw.Writer
}
// Use LogSecretFilter to scrub out sensitive variables
for s := range LogSecretFilter.s {
if s != "" {
message = strings.Replace(message, s, "<sensitive>", -1)
}
}
log.Printf("ui error: %s", message)
_, err := fmt.Fprint(writer, message+"\n")
if err != nil {