MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / HideAPIKey

Function HideAPIKey

internal/util/provider.go:181–190  ·  view source on GitHub ↗

HideAPIKey obscures an API key for logging purposes, showing only the first and last few characters. Parameters: - apiKey: The API key to hide. Returns: - string: The obscured API key.

(apiKey string)

Source from the content-addressed store, hash-verified

179// Returns:
180// - string: The obscured API key.
181func HideAPIKey(apiKey string) string {
182 if len(apiKey) > 8 {
183 return apiKey[:4] + "..." + apiKey[len(apiKey)-4:]
184 } else if len(apiKey) > 4 {
185 return apiKey[:2] + "..." + apiKey[len(apiKey)-2:]
186 } else if len(apiKey) > 2 {
187 return apiKey[:1] + "..." + apiKey[len(apiKey)-1:]
188 }
189 return apiKey
190}
191
192// maskAuthorizationHeader masks the Authorization header value while preserving the auth type prefix.
193// Common formats: "Bearer <token>", "Basic <credentials>", "ApiKey <key>", etc.

Callers 8

OnboardUserMethod · 0.92
formatAuthInfoFunction · 0.92
debugLogAuthSelectionFunction · 0.92
LoginMethod · 0.92
MaskAuthorizationHeaderFunction · 0.85
MaskSensitiveHeaderValueFunction · 0.85
MaskSensitiveQueryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected