MCPcopy Create free account
hub / github.com/NoFxAiOS/nofx / MaskSensitiveString

Function MaskSensitiveString

api/utils.go:7–16  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
7func 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

Callers 3

TestMaskSensitiveStringFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestMaskSensitiveStringFunction · 0.68