-
Notifications
You must be signed in to change notification settings - Fork 516
Snow 2011595 Masking filter introduced on library levels #2253
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
Snow 2011595 Masking filter introduced on library levels #2253
Conversation
…logging-presigned-ur-ls # Conflicts: # DESCRIPTION.md
…logging-presigned-ur-ls
…ts for large resultset masking
…for-python-logging-presigned-ur-ls
…logging-presigned-ur-ls
…-for-python-logging-presigned-ur-ls' into SNOW-2011595-snowflake-connector-for-python-logging-presigned-ur-ls
…logging-presigned-ur-ls
…logging-presigned-ur-ls
"botocore", | ||
"boto3", | ||
] | ||
# TODO: after migration to the external urllib3 from the vendored one, we should change filters here immediately to the below module's 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.
Do we have some task for moving from vendored to pypi one? Can we add this line reference to the jira or maybe add some test that would try importing the vendored lib and fail if it's not available? We would remove the test along with switching the filters here.
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.
That's correct. Added 👍
base_logger.addFilter(filter_instance) | ||
|
||
all_loggers_dict = logging.root.manager.loggerDict.items() | ||
child_loggers_gen = filter( |
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.
Do we need to filter first and then iterate over filtered results? Why not iterate over all_loggers_dict
, check the name and add filter in one loop?
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.
I agree it will be cleaner this way. Interestingly enough, no significant computational differences were noticed between those 2 approaches
@@ -48,21 +55,32 @@ class SecretDetector(logging.Formatter): | |||
flags=re.IGNORECASE, | |||
) | |||
|
|||
SECRET_STARRED_MASK_STR = "****" | |||
SECRET_STARRED_MASK_QUOTED_STR = f"'{SECRET_STARRED_MASK_STR}'" |
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.
Why do we need that and why is it only used in mask_aws_keys
?
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.
Left over - removed. Thank youu
…logging-presigned-ur-ls
…logging-presigned-ur-ls
…logging-presigned-ur-ls
…-for-python-logging-presigned-ur-ls' into SNOW-2011595-snowflake-connector-for-python-logging-presigned-ur-ls
…logging-presigned-ur-ls
Please answer these questions before submitting your pull requests. Thanks!
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes #NNNN
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
Please write a short description of how your code change solves the related issue.
(Optional) PR for stored-proc connector: