diff --git a/internal/cmd/root.go b/internal/cmd/root.go index 576601e3..51f9101a 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -19,6 +19,7 @@ import ( "github.com/github/gh-aw-mcpg/internal/config" "github.com/github/gh-aw-mcpg/internal/difc" "github.com/github/gh-aw-mcpg/internal/logger" + "github.com/github/gh-aw-mcpg/internal/logger/sanitize" "github.com/github/gh-aw-mcpg/internal/server" "github.com/github/gh-aw-mcpg/internal/tracing" "github.com/github/gh-aw-mcpg/internal/version" @@ -603,11 +604,7 @@ func loadEnvFile(path string) error { } // Log loaded variable (hide sensitive values) - displayValue := value - if len(value) > 0 { - displayValue = value[:min(10, len(value))] + "..." - } - log.Printf(" Loaded: %s=%s", key, displayValue) + log.Printf(" Loaded: %s=%s", key, sanitize.TruncateSecret(value)) loadedVars++ } diff --git a/internal/logger/rpc_helpers.go b/internal/logger/rpc_helpers.go index e65ce4a9..0463445f 100644 --- a/internal/logger/rpc_helpers.go +++ b/internal/logger/rpc_helpers.go @@ -130,7 +130,7 @@ func ExtractErrorMessage(line string) string { // If the line is too long (>200 chars), truncate it if len(cleanedLine) > 200 { - cleanedLine = cleanedLine[:197] + "..." + cleanedLine = strutil.Truncate(cleanedLine, 197) } return cleanedLine