File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,6 +75,28 @@ func TestConfigPrintDebug(t *testing.T) {
7575 }
7676 ]
7777}
78+ ` ,
79+ },
80+ {
81+ "config selector redacts authorization headers" ,
82+ "config" ,
83+ map [string ]interface {}{
84+ "config" : map [string ]interface {}{
85+ "headers" : map [string ]interface {}{
86+ "Authorization" : "secret1" ,
87+ "authorization" : "secret2" ,
88+ },
89+ },
90+ },
91+ `test:
92+ {
93+ "config": {
94+ "headers": {
95+ "Authorization": "xxxxx",
96+ "authorization": "xxxxx"
97+ }
98+ }
99+ }
78100` ,
79101 },
80102 {
Original file line number Diff line number Diff line change 1717
1818package common
1919
20+ import "strings"
21+
2022var maskList = MakeStringSet (
2123 "password" ,
2224 "passphrase" ,
@@ -27,13 +29,15 @@ var maskList = MakeStringSet(
2729 "urls" ,
2830 "host" ,
2931 "hosts" ,
32+ "authorization" ,
33+ "proxy-authorization" ,
3034)
3135
3236func applyLoggingMask (c interface {}) {
3337 switch cfg := c .(type ) {
3438 case map [string ]interface {}:
3539 for k , v := range cfg {
36- if maskList .Has (k ) {
40+ if maskList .Has (strings . ToLower ( k ) ) {
3741 if arr , ok := v .([]interface {}); ok {
3842 for i := range arr {
3943 arr [i ] = "xxxxx"
You can’t perform that action at this time.
0 commit comments