File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -56,21 +56,23 @@ def mask_sensitive_data(data, mask_api_parameters=False):
56
56
instead iterate over sensitive_keys and remove them from an api
57
57
URL string.
58
58
"""
59
-
60
- if type (data ) != dict :
61
- if mask_api_parameters and type (data ) == str :
59
+ if type (data ) is not dict :
60
+ if mask_api_parameters and type (data ) is str :
62
61
for sensitive_key in SENSITIVE_KEYS :
63
- data = re .sub ('({}=)(.*?)($|&)' .format (sensitive_key ), '\g<1>***FILTERED***\g<3>' .format (sensitive_key .upper ()), data )
62
+ data = re .sub ('({}=)(.*?)($|&)' .format (sensitive_key ),
63
+ '\g<1>***FILTERED***\g<3>' .format (sensitive_key .upper ()), data )
64
+ # new code
65
+ if type (data ) is list :
66
+ data = [mask_sensitive_data (item ) for item in data ]
64
67
return data
65
-
66
68
for key , value in data .items ():
67
69
if key in SENSITIVE_KEYS :
68
70
data [key ] = "***FILTERED***"
69
71
70
- if type (value ) == dict :
72
+ if type (value ) is dict :
71
73
data [key ] = mask_sensitive_data (data [key ])
72
74
73
- if type (value ) == list :
75
+ if type (value ) is list :
74
76
data [key ] = [mask_sensitive_data (item ) for item in data [key ]]
75
77
76
78
return data
You can’t perform that action at this time.
0 commit comments