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/13 22:21:13 UTC

[GitHub] [airflow] SamWheating opened a new pull request #22227: Masking extras in GET /connections/ endpoint

SamWheating opened a new pull request #22227:
URL: https://github.com/apache/airflow/pull/22227


   Applying secrets masking when reading the `extras` field of a connection via the REST API.
   
   Users can still update the extras with the `patch` or `post` endpoints, but when reading them they will be recursively redacted.
   
   Also adding some commonly used sensitive `extras` keys to the default sensitive values so that they will be properly redacted.
   


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



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

Posted by GitBox <gi...@apache.org>.
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



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

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #22227:
URL: https://github.com/apache/airflow/pull/22227#issuecomment-1068292558


   rebased to rebuild


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



[GitHub] [airflow] potiuk merged pull request #22227: Masking extras in GET /connections/ endpoint

Posted by GitBox <gi...@apache.org>.
potiuk merged pull request #22227:
URL: https://github.com/apache/airflow/pull/22227


   


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