This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 3aa105685e4739f913973097031ac8e77adf1a26
Author: Pierre Jeambrun <[email protected]>
AuthorDate: Tue Sep 9 18:48:37 2025 +0200

    Add guards for registering middlewares from plugins (#55399)
---
 airflow-core/src/airflow/api_fastapi/app.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/airflow-core/src/airflow/api_fastapi/app.py 
b/airflow-core/src/airflow/api_fastapi/app.py
index f515be6992c..417bf792265 100644
--- a/airflow-core/src/airflow/api_fastapi/app.py
+++ b/airflow-core/src/airflow/api_fastapi/app.py
@@ -200,5 +200,9 @@ def init_plugins(app: FastAPI) -> None:
             log.error("'middleware' key is missing for the fastapi middleware: 
%s", name)
             continue
 
+        if not callable(middleware):
+            log.error("'middleware' value for %s is should be callable: %s", 
name, middleware)
+            continue
+
         log.debug("Adding root middleware %s", name)
         app.add_middleware(middleware, *args, **kwargs)

Reply via email to