mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Settings: Redact token keyword (#97395)
* Settings: Redact token keyword * Be more specific * Given section is part of key, be more specific * Fix test
This commit is contained in:
parent
f78cd0761b
commit
ef79450065
@ -599,6 +599,13 @@ func RedactedValue(key, value string) string {
|
||||
"CLIENT_SECRET",
|
||||
"ENTERPRISE_LICENSE",
|
||||
"GF_ENTITY_API_DB_PASS",
|
||||
"ID_FORWARDING_TOKEN$",
|
||||
"AUTHENTICATION_TOKEN$",
|
||||
"AUTH_TOKEN$",
|
||||
"RENDERER_TOKEN$",
|
||||
"API_TOKEN$",
|
||||
"WEBHOOK_TOKEN$",
|
||||
"INSTALL_TOKEN$",
|
||||
} {
|
||||
if match, err := regexp.MatchString(pattern, uppercased); match && err == nil {
|
||||
return RedactedPassword
|
||||
|
@ -528,6 +528,12 @@ func TestRedactedValue(t *testing.T) {
|
||||
value: "",
|
||||
expected: "",
|
||||
},
|
||||
{
|
||||
desc: "authentication_token",
|
||||
key: "my_authentication_token",
|
||||
value: "test",
|
||||
expected: RedactedPassword,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
Loading…
Reference in New Issue
Block a user