@@ -291,15 +291,35 @@ func NewDefault(provider sql.DatabaseProvider) *Analyzer {
291291// if the analyzer is in debug mode.
292292func (a * Analyzer ) Log (msg string , args ... interface {}) {
293293 if a != nil && a .Debug {
294+ sanitizedArgs := sanitizeArguments (args )
294295 if len (a .contextStack ) > 0 {
295296 ctx := strings .Join (a .contextStack , "/" )
296- log .Infof ("%s: " + msg , append ([]interface {}{ctx }, args ... )... )
297+ log .Infof ("%s: " + msg , append ([]interface {}{ctx }, sanitizedArgs ... )... )
297298 } else {
298- log .Infof (msg , args ... )
299+ log .Infof (msg , sanitizedArgs ... )
299300 }
300301 }
301302}
302303
304+ func sanitizeArguments (args []interface {}) []interface {} {
305+ for i , arg := range args {
306+ // Example sanitization logic: replace sensitive data with placeholder
307+ if isSensitive (arg ) {
308+ args [i ] = "[REDACTED]"
309+ }
310+ }
311+ return args
312+ }
313+
314+ func isSensitive (arg interface {}) bool {
315+ // Add logic to identify sensitive data (e.g., passwords)
316+ // This may involve checking types or specific fields
317+ if str , ok := arg .(string ); ok && strings .Contains (strings .ToLower (str ), "password" ) {
318+ return true
319+ }
320+ return false
321+ }
322+
303323// LogNode prints the node given if Verbose logging is enabled.
304324func (a * Analyzer ) LogNode (n sql.Node ) {
305325 if a != nil && n != nil && a .Verbose {
0 commit comments