File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -294,9 +294,19 @@ func (a *Analyzer) Log(msg string, args ...interface{}) {
294294 if a != nil && a .Debug {
295295 if len (a .contextStack ) > 0 {
296296 ctx := strings .Join (a .contextStack , "/" )
297- log .Infof ("%s: " + msg , append ([]interface {}{ctx }, sanitizeArguments (args )... )... )
297+ sanitizedArgs := sanitizeArguments (args )
298+ if containsSensitiveData (sanitizedArgs ) {
299+ log .Warnf ("Sensitive data detected in log arguments. Logging suppressed." )
300+ return
301+ }
302+ log .Infof ("%s: " + msg , append ([]interface {}{ctx }, sanitizedArgs ... )... )
298303 } else {
299- log .Infof (msg , sanitizeArguments (args )... )
304+ sanitizedArgs := sanitizeArguments (args )
305+ if containsSensitiveData (sanitizedArgs ) {
306+ log .Warnf ("Sensitive data detected in log arguments. Logging suppressed." )
307+ return
308+ }
309+ log .Infof (msg , sanitizedArgs ... )
300310 }
301311 }
302312}
@@ -346,7 +356,10 @@ func sanitizeArguments(args []interface{}) []interface{} {
346356 }
347357 args [i ] = mapSanitized
348358 } else {
349- args [i ] = "[REDACTED]"
359+ // Catch-all for unhandled types
360+ if isSensitive (fmt .Sprintf ("%v" , arg )) {
361+ args [i ] = "[REDACTED]"
362+ }
350363 }
351364 }
352365 }
You can’t perform that action at this time.
0 commit comments