Skip to content

Commit c163daf

Browse files
Merge pull request #439 from splunk/DVPL-10693
Modified POST method debug log to not log sensitive body/data
2 parents f1db833 + 82bff6c commit c163daf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

splunklib/binding.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,13 @@ def post(self, path_segment, owner=None, app=None, sharing=None, headers=None, *
758758
headers = []
759759

760760
path = self.authority + self._abspath(path_segment, owner=owner, app=app, sharing=sharing)
761-
logger.debug("POST request to %s (body: %s)", path, repr(query))
761+
762+
# To avoid writing sensitive data in debug logs
763+
endpoint_having_sensitive_data = ["/storage/passwords"]
764+
if any(endpoint in path for endpoint in endpoint_having_sensitive_data):
765+
logger.debug("POST request to %s ", path)
766+
else:
767+
logger.debug("POST request to %s (body: %s)", path, repr(query))
762768
all_headers = headers + self.additional_headers + self._auth_headers
763769
response = self.http.post(path, all_headers, **query)
764770
return response

0 commit comments

Comments
 (0)