You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/03/14 00:35:35 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #22227: Masking extras in GET /connections/ endpoint

uranusjr commented on a change in pull request #22227:
URL: https://github.com/apache/airflow/pull/22227#discussion_r825528294



##########
File path: airflow/api_connexion/schemas/connection_schema.py
##########
@@ -44,7 +46,30 @@ class ConnectionSchema(ConnectionCollectionItemSchema):
     """Connection schema"""
 
     password = auto_field(load_only=True)
-    extra = auto_field()
+    extra = fields.Method('get_extra', deserialize='set_extra')
+
+    @staticmethod
+    def get_extra(obj: Connection):
+        if obj.extra is None:
+            return
+        from airflow.utils.log.secrets_masker import redact
+
+        try:
+            extra = json.loads(obj.extra)
+            return str(redact(extra))

Review comment:
       Should this use `json.dumps`?




-- 
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-unsubscribe@airflow.apache.org

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