From 4d2db2e8ff50c9ef1933aa07d4802c3418ea1486 Mon Sep 17 00:00:00 2001 From: Sumit Maheshwari Date: Tue, 22 Jun 2021 14:40:45 +0530 Subject: [PATCH] Redact conn secrets in webserver logs (#16579) (cherry picked from commit 2a59de3e558e3b60caad876dee8fa4b43a7a17cf) --- airflow/hooks/base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/airflow/hooks/base.py b/airflow/hooks/base.py index f286a6f2ce3d3..3531bf3800d0b 100644 --- a/airflow/hooks/base.py +++ b/airflow/hooks/base.py @@ -22,6 +22,7 @@ from airflow.typing_compat import Protocol from airflow.utils.log.logging_mixin import LoggingMixin +from airflow.utils.log.secrets_masker import redact if TYPE_CHECKING: from airflow.models.connection import Connection # Avoid circular imports. @@ -74,8 +75,8 @@ def get_connection(cls, conn_id: str) -> "Connection": conn.port, conn.schema, conn.login, - conn.password, - conn.extra_dejson, + redact(conn.password), + redact(conn.extra_dejson), ) return conn