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


##########
task-sdk/src/airflow/sdk/log.py:
##########
@@ -96,6 +96,13 @@ def redact_jwt(logger: Any, method_name: str, event_dict: 
EventDict) -> EventDic
     return event_dict
 
 
+def mask_logs(logger: Any, method_name: str, event_dict: EventDict) -> 
EventDict:
+    from airflow.sdk.execution_time.secrets_masker import redact
+
+    event_dict["event"] = redact(event_dict["event"])
+    return event_dict

Review Comment:
   We need to look at pretty much every field in `event_dict`:
   
   If I do this:
   
   ```python
   log.debug("Connecting", password=pass)`
   ```
   
   it won't get redacted.
   
   You can just pass the whole [dict to redact I think, and it will then also 
use the dict key names to redact, not just 
values](https://github.com/apache/airflow/blob/6a703dd1f795784e446742dddf412b0fe3b4e4a0/task-sdk/src/airflow/sdk/execution_time/secrets_masker.py#L238-L243).
   
   However I think you will run into issues with this fn 
https://github.com/apache/airflow/blob/main/task-sdk/src/airflow/sdk/execution_time/secrets_masker.py#L192-L210
 which expects a stdlib LogRecord object which we don't have anymore.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to