Skip to content

Commit 46bd4cc

Browse files
committed
Update binding.py
- updated keys in SENSITIVE_KEYS list - masked headers data in logger
1 parent 95fa079 commit 46bd4cc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

splunklib/binding.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@
6161
"HTTPError"
6262
]
6363

64-
SENSITIVE_KEYS = ["password", "token", "Authorization"]
64+
SENSITIVE_KEYS = ['Authorization', 'Cookie', 'action.email.auth_password', 'auth', 'auth_password', 'clear_password', 'clientId',
65+
'crc-salt', 'encr_password', 'oldpassword', 'passAuth', 'password', 'session', 'suppressionKey',
66+
'token']
67+
6568
# If you change these, update the docstring
6669
# on _authority as well.
6770
DEFAULT_HOST = "localhost"
@@ -90,7 +93,8 @@ def mask_sensitive_data(data):
9093
except Exception as ex:
9194
return data
9295

93-
if not isinstance(data, dict):
96+
# json.loads will return "123"(str) as 123(int), so return the data
97+
if isinstance(data, int):
9498
return data
9599
mdata = {}
96100
for k, v in data.items():
@@ -863,8 +867,7 @@ def request(self, path_segment, method="GET", headers=None, body={},
863867

864868
all_headers = headers + self.additional_headers + self._auth_headers
865869
logger.debug("%s request to %s (headers: %s, body: %s)",
866-
method, path, str(all_headers), mask_sensitive_data(body))
867-
870+
method, path, str(mask_sensitive_data(dict(all_headers))), mask_sensitive_data(body))
868871
if body:
869872
body = _encode(**body)
870873

0 commit comments

Comments
 (0)