Settings: Redact token keyword (#97395)

* Settings: Redact token keyword

* Be more specific

* Given section is part of key, be more specific

* Fix test
pull/97418/head
Gabriel MABILLE 8 months ago committed by GitHub
parent f78cd0761b
commit ef79450065
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      pkg/setting/setting.go
  2. 6
      pkg/setting/setting_test.go

@ -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…
Cancel
Save