MCPcopy Create free account
hub / github.com/diillson/chatcli / isSensitiveEnvKey

Function isSensitiveEnvKey

utils/utils.go:58–79  ·  view source on GitHub ↗
(key string)

Source from the content-addressed store, hash-verified

56}
57
58func isSensitiveEnvKey(key string) bool {
59 k := strings.ToUpper(key)
60 // lista de padrões comuns
61 sensitiveSubstr := []string{
62 "KEY", "TOKEN", "SECRET", "PASSWORD", "API_KEY", "ACCESS_TOKEN", "REFRESH_TOKEN", "CLIENT_SECRET", "CLIENT_KEY", "AUTH",
63 }
64 for _, s := range sensitiveSubstr {
65 if strings.Contains(k, s) {
66 return true
67 }
68 }
69
70 // nomes exatos conhecidos
71 exact := map[string]bool{
72 "OPENAI_API_KEY": true,
73 "ANTHROPIC_API_KEY": true,
74 "GOOGLEAI_API_KEY": true,
75 "CLIENT_SECRET": true,
76 "CLIENT_KEY": true,
77 }
78 return exact[k]
79}
80
81// SanitizeSensitiveText remove/mascara tokens em qualquer texto antes de ir para histórico/LLM
82func SanitizeSensitiveText(s string) string {

Callers 2

TestIsSensitiveEnvKeyFunction · 0.85
GetEnvVariablesSanitizedFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestIsSensitiveEnvKeyFunction · 0.68