MaskSensitiveString Mask sensitive strings, showing only first 4 and last 4 characters Used to mask API Key, Secret Key, Private Key and other sensitive information
(s string)
| 5 | // MaskSensitiveString Mask sensitive strings, showing only first 4 and last 4 characters |
| 6 | // Used to mask API Key, Secret Key, Private Key and other sensitive information |
| 7 | func MaskSensitiveString(s string) string { |
| 8 | if s == "" { |
| 9 | return "" |
| 10 | } |
| 11 | length := len(s) |
| 12 | if length <= 8 { |
| 13 | return "****" // String too short, hide everything |
| 14 | } |
| 15 | return s[:4] + "****" + s[length-4:] |
| 16 | } |
| 17 | |
| 18 | // SanitizeModelConfigForLog Sanitize model configuration for log output. |
| 19 | // Takes the same ModelConfigUpdate type used by the request handler so the two |
no outgoing calls