uranusjr commented on code in PR #32309:
URL: https://github.com/apache/airflow/pull/32309#discussion_r1251536749


##########
airflow/www/views.py:
##########
@@ -4819,8 +4835,21 @@ def process_form(self, form, is_created):
                     # value isn't an empty string.
                     if value != "":
                         extra[field_name] = value
-
         if extra.keys():
+            sensitive_unchanged_keys = set()
+            for key, value in extra.items():
+                if value == SENSITIVE_FIELD_PLACEHOLDER:
+                    sensitive_unchanged_keys.add(key)
+            if sensitive_unchanged_keys:
+                try:
+                    conn = BaseHook.get_connection(conn_id)
+                except AirflowNotFoundException:
+                    conn = None
+                for key in sensitive_unchanged_keys:
+                    if conn and conn.extra_dejson.get(key):
+                        extra[key] = conn.extra_dejson.get(key)
+                    else:
+                        del extra[key]

Review Comment:
   ```suggestion
                   def _iter_masked_extra_items():
                       for key, val in extra.items():
                           if key not in sensitive_unchanged_keys:
                               yield key, val
                           elif conn and (conn_val := 
conn.extra_dejson.get(key)):
                               yield key, conn_val
   
                   extra = dict(_iter_masked_extra_items())
   ```
   
   Not entirely sure I got this one right



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