Skip to content

Conversation

sfc-gh-fpawlowski
Copy link
Contributor

Please answer these questions before submitting your pull requests. Thanks!

  1. What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes #NNNN

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am modifying authorization mechanisms
    • I am adding new credentials
    • I am modifying OCSP code
    • I am adding a new dependency
  3. Please describe how your code solves the related issue.

    Please write a short description of how your code change solves the related issue.

  4. (Optional) PR for stored-proc connector:

@sfc-gh-fpawlowski sfc-gh-fpawlowski self-assigned this Apr 4, 2025
@sfc-gh-fpawlowski sfc-gh-fpawlowski added the DO_NOT_PORT_CHANGES_TO_SP Add this label when changes in this PR do not need to be port to SP connector label Apr 4, 2025
@sfc-gh-fpawlowski sfc-gh-fpawlowski marked this pull request as ready for review April 8, 2025 09:55
@sfc-gh-fpawlowski sfc-gh-fpawlowski changed the title Snow 2011595 snowflake connector for python logging presigned ur ls Snow 2011595 Masking filter introduced on library levels Apr 10, 2025
"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:
Copy link
Contributor

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.

Copy link
Contributor Author

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(
Copy link
Contributor

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?

Copy link
Contributor Author

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}'"
Copy link
Contributor

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?

Copy link
Contributor Author

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

@sfc-gh-mmishchenko sfc-gh-mmishchenko merged commit 84b2d5d into main Apr 15, 2025
94 of 95 checks passed
@sfc-gh-mmishchenko sfc-gh-mmishchenko deleted the SNOW-2011595-snowflake-connector-for-python-logging-presigned-ur-ls branch April 15, 2025 17:59
@github-actions github-actions bot locked and limited conversation to collaborators Apr 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
DO_NOT_PORT_CHANGES_TO_SP Add this label when changes in this PR do not need to be port to SP connector
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants