Skip to content

Commit

Permalink
Change log redaction logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnestoLoma committed Dec 31, 2024
1 parent 2c4811d commit 63639e9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions pyatlan/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,16 @@ class AuthorizationFilter(logging.Filter):
"""

def filter(self, record: logging.LogRecord) -> bool:
if record.args and hasattr(record.args, "__iter__"):
if isinstance(record.args, dict) and "access_token" in record.args:
record.args["access_token"] = "***REDACTED***" # noqa: S105
elif record.args and hasattr(record.args, "__iter__"):
for arg in record.args:
if isinstance(arg, dict):
if "headers" in arg and "authorization" in arg["headers"]:
arg["headers"]["authorization"] = "***REDACTED***"
elif "access_token" in arg:
arg["access_token"] = "***REDACTED***" # noqa: S105
if (
isinstance(arg, dict)
and "headers" in arg
and "authorization" in arg["headers"]
):
arg["headers"]["authorization"] = "***REDACTED***"

return True

Expand Down

0 comments on commit 63639e9

Please sign in to comment.