Skip to content

Commit 04e80a1

Browse files
fix secret redaction error logs
1 parent d5848d3 commit 04e80a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/pkg/diagnostics/diagnostics.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,13 +602,15 @@ func RedactSecretPaths(mapStr map[string]any, errOut io.Writer) map[string]any {
602602
continue
603603
}
604604

605-
if ok, err := cfg.Has(key, -1, ucfg.PathSep(".")); ok {
605+
if ok, err := cfg.Has(key, -1, ucfg.PathSep(".")); err != nil {
606+
fmt.Fprintf(errOut, "Error redacting secret path %q: %v.\n", key, err)
607+
} else if ok {
606608
err := cfg.SetString(key, -1, REDACTED, ucfg.PathSep("."))
607609
if err != nil {
608610
fmt.Fprintf(errOut, "No output redaction for %q: %v.\n", key, err)
609611
}
610612
} else {
611-
fmt.Fprintf(errOut, "Unable to find secret path %q for redaction: %v.\n", key, err)
613+
fmt.Fprintf(errOut, "Unable to find secret path %q for redaction.\n", key)
612614
}
613615
}
614616
result, err := config.MustNewConfigFrom(cfg).ToMapStr()

0 commit comments

Comments
 (0)