Merged
Conversation
l00py
reviewed
Jul 10, 2023
| except Exception as ex: | ||
| return data | ||
|
|
||
| if not isinstance(data, dict): |
splunklib/binding.py
Outdated
| "HTTPError" | ||
| ] | ||
|
|
||
| SENSITIVE_KEYS = ["password", "token", "Authorization"] |
There was a problem hiding this comment.
May want to review the request params for the supported endpoints specified here: https://github.com/splunk/splunk-sdk-python/blob/develop/splunklib/client.py#L90-L113
For example:
- apps/local
- auth
- session
- configs/conf
- POST to conf files may contain sensitive information, but we can do a best-effort based on the current conf specs, and what files are normally interacted with. It may be best to provide a different logic for masking sensitive information for that specific endpoint.
splunklib/binding.py
Outdated
| all_headers = headers + self.additional_headers + self._auth_headers | ||
| logger.debug("%s request to %s (headers: %s, body: %s)", | ||
| method, path, str(all_headers), repr(body)) | ||
| method, path, str(all_headers), mask_sensitive_data(body)) |
There was a problem hiding this comment.
The headers can contain sensitive data, specifically the original headers being passed via the handler in https://github.com/splunk/splunk-sdk-python/blob/develop/splunklib/binding.py#L1443-L1444
- updated keys in SENSITIVE_KEYS list - masked headers data in logger
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
added new method to mask sensitive data in logs like password. changes wrt issue #506