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


##########
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:
   I also think having error is better. Even if we want to returen clearer 
error - it should still be raised to the caller, not "hidden in 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