You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "atul-astronomer (via GitHub)" <gi...@apache.org> on 2025/09/01 13:16:05 UTC

[I] API server crash if user defines external_views plugin as nested list [airflow]

atul-astronomer opened a new issue, #55142:
URL: https://github.com/apache/airflow/issues/55142

   ### Apache Airflow version
   
   main (development)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   ```javascript
   File "/opt/airflow/airflow-core/src/airflow/api_fastapi/main.py", line 27, in <module>
       app = cached_app(apps=os.environ.get("AIRFLOW_API_APPS", "all"))
     File "/opt/airflow/airflow-core/src/airflow/api_fastapi/app.py", line 111, in cached_app
       app = create_app(apps=apps)
     File "/opt/airflow/airflow-core/src/airflow/utils/providers_configuration_loader.py", line 54, in wrapped_function
       return func(*args, **kwargs)
     File "/opt/airflow/airflow-core/src/airflow/api_fastapi/app.py", line 97, in create_app
       init_ui_plugins(app)
     File "/opt/airflow/airflow-core/src/airflow/api_fastapi/core_api/app.py", line 200, in init_ui_plugins
       plugins_manager.initialize_ui_plugins()
     File "/opt/airflow/airflow-core/src/airflow/plugins_manager.py", line 396, in initialize_ui_plugins
       url_route = external_view["url_route"]
   TypeError: list indices must be integers or slices, not str
   ``` 
   
   ### What you think should happen instead?
   
   _No response_
   
   ### How to reproduce
   
   Have the below file in your plugins folder:
   
   ```python
   from airflow.plugins_manager import AirflowPlugin
   
   external_views = [
       {
           "name": "Airflow Croma",
           "href": "https://airflow.apache.org/docs/",
           "destination": "nav",
           "icon": "book",
           "url_route": None,
           "category": "browse"
       },
       {
           "name": "Grafana Dashboards",
           "href": "https://grafana.mycompany.com/",
           "destination": "nav",
           "icon": "activity",
           "url_route": "my_external_view",
           "category": "admin"
       }
   ]
   
   # Defining the plugin class
   class AirflowTestPlugin2(AirflowPlugin):
       name = "test_plugin2"
       external_views = [external_views]
   ``` 
   
   ### Operating System
   
   Linux
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] API server crash if user defines external_views plugin as nested list [airflow]

Posted by "atul-astronomer (via GitHub)" <gi...@apache.org>.
atul-astronomer commented on issue #55142:
URL: https://github.com/apache/airflow/issues/55142#issuecomment-3269145408

   > Indeed, a failure to load plugin should create a displayable plugin `importErrort`, and not crash the entire api server.
   
   Now API server is not crashing but I have a question, should user get some kind of plugin import error on UI for this kind of wrong plugin creation?
   I don't see any as of now


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


Re: [I] API server crash if user defines external_views plugin as nested list [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on issue #55142:
URL: https://github.com/apache/airflow/issues/55142#issuecomment-3275826923

   @atul-astronomer There is a message in the logs. That could be a nice improvement, the only reason why we didn't do it now is because it's a bigger effort to consolidate all validation errors into `importErrors`, and also because `importErrors` in the first place really seems related to the importation process (and not really for data validation of what's in the plugin, because really [any] is allowed). So stuff like `importlib.util.module_from_spec` and such.
   
   So maybe we need an extra field, or to change the `importErrors` into something more generic that would allow 'data validation' errors to be reported there too.


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


Re: [I] API server crash if user defines external_views plugin as nested list [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on issue #55142:
URL: https://github.com/apache/airflow/issues/55142#issuecomment-3248517116

   I wouldn't classify this as 'critical'. it's really an edge case of a bad plugin configuration that could crash the server, but that will never happen if people use plugins correctly. (definitely something to fix though) It's really like we're trying to hack our way to crash the server by submitting an invalid input. (people creating plugins are trusted in our security model)


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


Re: [I] API server crash if user defines external_views plugin as nested list [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on issue #55142:
URL: https://github.com/apache/airflow/issues/55142#issuecomment-3244501846

   Thanks


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


Re: [I] API server crash if user defines external_views plugin as nested list [airflow]

Posted by "vatsrahul1001 (via GitHub)" <gi...@apache.org>.
vatsrahul1001 commented on issue #55142:
URL: https://github.com/apache/airflow/issues/55142#issuecomment-3243898766

   cc: @pierrejeambrun 


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


Re: [I] API server crash if user defines external_views plugin as nested list [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on issue #55142:
URL: https://github.com/apache/airflow/issues/55142#issuecomment-3244504159

   Indeed, a failure to load plugin should create a displayable  plugin `importErrort`, and not crash the entire api server.


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


Re: [I] API server crash if user defines external_views plugin as nested list [airflow]

Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck closed issue #55142: API server crash if user defines external_views plugin as nested list
URL: https://github.com/apache/airflow/issues/55142


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