Skip to content

Commit

Permalink
Merge pull request #439 from splunk/DVPL-10693
Browse files Browse the repository at this point in the history
Modified POST method debug log to not log sensitive body/data
  • Loading branch information
akaila-splunk authored Mar 9, 2022
2 parents f1db833 + 82bff6c commit c163daf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion splunklib/binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,13 @@ def post(self, path_segment, owner=None, app=None, sharing=None, headers=None, *
headers = []

path = self.authority + self._abspath(path_segment, owner=owner, app=app, sharing=sharing)
logger.debug("POST request to %s (body: %s)", path, repr(query))

# To avoid writing sensitive data in debug logs
endpoint_having_sensitive_data = ["/storage/passwords"]
if any(endpoint in path for endpoint in endpoint_having_sensitive_data):
logger.debug("POST request to %s ", path)
else:
logger.debug("POST request to %s (body: %s)", path, repr(query))
all_headers = headers + self.additional_headers + self._auth_headers
response = self.http.post(path, all_headers, **query)
return response
Expand Down

0 comments on commit c163daf

Please sign in to comment.