ashb commented on code in PR #48614:
URL: https://github.com/apache/airflow/pull/48614#discussion_r2022559350


##########
task-sdk/src/airflow/sdk/log.py:
##########
@@ -90,9 +91,10 @@ def logger_name(logger: Any, method_name: Any, event_dict: 
EventDict) -> EventDi
 
 
 def redact_jwt(logger: Any, method_name: str, event_dict: EventDict) -> 
EventDict:
+    jwt_pattern = r"eyJ[\.A-Za-z0-9-_]*"
     for k, v in event_dict.items():
-        if isinstance(v, str) and v.startswith("eyJ"):
-            event_dict[k] = "eyJ***"
+        if isinstance(v, str):
+            event_dict[k] = re.sub(jwt_pattern, "eyJ***", v)

Review Comment:
   This is called often enough that we should pre-compile the regex globally/at 
module scope



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to