Handle invalid parameters (including missing object) in webserver
See original GitHub issueDescription
Hi. The webserver code is very optimistic and negative paths are not checked. For example: We have the following code: https://github.com/apache/airflow/blob/0dafdd0b9d635b4513b1413007337b19c3d96b17/airflow/www/views.py#L595-L597
It is not checked here whether the DAG object exists. Condition dag == None
should be added and when it is met, error 404 should be reported.
Use case / motivation
Improving the experience of using the webserver and reducing the number of nukulars.
I hope that a thorough review of the entire web server code and completing the tests with negative paths will improve the overall health of the webserver.
If this is done by the Polidea team, it will be an opportunity to get to know the webserver better. My team has not focused on the webserver yet.
it will be an opportunity to find other health problems (e.g. side-effect, missing tests).
Related Issues
N/A
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:11 (9 by maintainers)
Top GitHub Comments
I also invite you to read our guides: https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst https://github.com/apache/airflow/blob/master/BREEZE.rst https://github.com/apache/airflow/blob/master/LOCAL_VIRTUALENV.rst https://github.com/apache/airflow/blob/master/STATIC_CODE_CHECKS.rst https://github.com/apache/airflow/blob/master/TESTING.rst There is a lot of information about our work environment and community
I wonder if type checks can be used to catch these kinds of issues. There are a lot of
current_app.dag_bag
,current_app.appbuilder
, etc., which are not covered by Mypy due to the dynamic nature offlask.current_app
(basically any attributes on it isAny
). Since we “know” what attributes to expect on thecurrent_app
instance within Airflow, maybe we can introduce a typing shim around it? Something likeAnd then all code can import this instead of directly from Flask to be type checked.
We can alternatively supply a type stub
flask.pyi
to “lie to” Mypyflask.current_app
is_CurrentApp
.