jedcunningham commented on code in PR #38166:
URL: https://github.com/apache/airflow/pull/38166#discussion_r1529417066


##########
airflow/www/decorators.py:
##########
@@ -94,35 +94,54 @@ def wrapper(*args, **kwargs):
                     user = get_auth_manager().get_user_name()
                     user_display = get_auth_manager().get_user_display_name()
 
-                fields_skip_logging = {"csrf_token", "_csrf_token", 
"is_paused"}
-                extra_fields = [
-                    (k, secrets_masker.redact(v, k))
+                isAPIRequest = request.blueprint == "/api/v1"
+                hasJsonBody = request.headers.get("content-type") == 
"application/json" and request.json
+
+                fields_skip_logging = {
+                    "csrf_token",
+                    "_csrf_token",
+                    "is_paused",
+                    "dag_id",
+                    "task_id",
+                    "dag_run_id",
+                    "run_id",
+                    "execution_date",
+                }
+                extra_fields = {
+                    k: secrets_masker.redact(v, k)
                     for k, v in 
itertools.chain(request.values.items(multi=True), request.view_args.items())
                     if k not in fields_skip_logging
-                ]
+                }
                 if event and event.startswith("variable."):
-                    extra_fields = _mask_variable_fields(extra_fields)
-                if event and event.startswith("connection."):
-                    extra_fields = _mask_connection_fields(extra_fields)
+                    extra_fields = _mask_variable_fields(
+                        request.json if isAPIRequest and hasJsonBody else 
extra_fields
+                    )
+                elif event and event.startswith("connection."):
+                    extra_fields = _mask_connection_fields(
+                        request.json if isAPIRequest and hasJsonBody else 
extra_fields
+                    )
+                elif hasJsonBody:
+                    extra_fields = {**extra_fields, **request.json}

Review Comment:
   Do we need to mask `request.json`?



-- 
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