-
Notifications
You must be signed in to change notification settings - Fork 378
masked sensitive data in logs #507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comments for review
except Exception as ex: | ||
return data | ||
|
||
if not isinstance(data, dict): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate to lines 87-91?
splunklib/binding.py
Outdated
@@ -60,12 +61,14 @@ | |||
"HTTPError" | |||
] | |||
|
|||
SENSITIVE_KEYS = ["password", "token", "Authorization"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -844,7 +863,7 @@ def request(self, path_segment, method="GET", headers=None, body={}, | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
added new method to mask sensitive data in logs like password. changes wrt issue #506