YoannAbriel commented on code in PR #63351:
URL: https://github.com/apache/airflow/pull/63351#discussion_r3035373348


##########
airflow-core/src/airflow/models/connection.py:
##########
@@ -360,7 +360,15 @@ def get_password(self) -> str | None:
                     f"Can't decrypt encrypted password for login={self.login}  
"
                     f"FERNET_KEY configuration is missing"
                 )
-            return fernet.decrypt(bytes(self._password, "utf-8")).decode()
+            try:
+                return fernet.decrypt(bytes(self._password, "utf-8")).decode()
+            except Exception:
+                log.warning(
+                    "Failed to decrypt password for connection %s. "
+                    "This may happen after migrating with a different Fernet 
key.",
+                    self.conn_id,
+                )
+                return None

Review Comment:
   It surfaces the actual error instead of a generic 500 — helps operators 
debug Fernet key rotations without digging through logs.



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