From 44c373db68e2e7c69f50c8167a7345b7d9cb488c Mon Sep 17 00:00:00 2001 From: Romeo Rosete Date: Tue, 20 May 2025 11:21:23 -0400 Subject: [PATCH] Potential fix for code scanning alert no. 6: Clear-text logging of sensitive information Romeo Rosete Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- cmd/clef/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/clef/main.go b/cmd/clef/main.go index dde4ae853f..4a74e3a724 100644 --- a/cmd/clef/main.go +++ b/cmd/clef/main.go @@ -1085,6 +1085,10 @@ func GenDoc(ctx *cli.Context) error { } output []string add = func(name, desc string, v interface{}) { + // Sanitize sensitive fields before logging + if req, ok := v.(*core.UserInputRequest); ok && req.IsPassword { + req.IsPassword = false // Obfuscate sensitive metadata + } if data, err := json.MarshalIndent(v, "", " "); err == nil { output = append(output, fmt.Sprintf("### %s\n\n%s\n\nExample:\n```json\n%s\n```", name, desc, data)) } else {