diff --git a/libbeat/common/config_test.go b/libbeat/common/config_test.go index 5c579a6e012..f3ccebcc550 100644 --- a/libbeat/common/config_test.go +++ b/libbeat/common/config_test.go @@ -75,6 +75,28 @@ func TestConfigPrintDebug(t *testing.T) { } ] } +`, + }, + { + "config selector redacts authorization headers", + "config", + map[string]interface{}{ + "config": map[string]interface{}{ + "headers": map[string]interface{}{ + "Authorization": "secret1", + "authorization": "secret2", + }, + }, + }, + `test: +{ + "config": { + "headers": { + "Authorization": "xxxxx", + "authorization": "xxxxx" + } + } +} `, }, { diff --git a/libbeat/common/logging.go b/libbeat/common/logging.go index 2c5f656abd4..54a41da0709 100644 --- a/libbeat/common/logging.go +++ b/libbeat/common/logging.go @@ -17,6 +17,8 @@ package common +import "strings" + var maskList = MakeStringSet( "password", "passphrase", @@ -27,13 +29,15 @@ var maskList = MakeStringSet( "urls", "host", "hosts", + "authorization", + "proxy-authorization", ) func applyLoggingMask(c interface{}) { switch cfg := c.(type) { case map[string]interface{}: for k, v := range cfg { - if maskList.Has(k) { + if maskList.Has(strings.ToLower(k)) { if arr, ok := v.([]interface{}); ok { for i := range arr { arr[i] = "xxxxx"