From 23e971600a7530bf787eac59e652ccd8062445b0 Mon Sep 17 00:00:00 2001 From: Jens Scheffler <95105677+jscheffl@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:25:32 +0200 Subject: [PATCH] Remove RAW HTML support from Trigger Form UI (#40029) * Remove RAW HTML support from Trigger Form UI * Updates since main branch changed to 3.0.0 * Force really no HTML in code, fix unit tests * Fix version in deprecation message --- airflow/config_templates/config.yml | 15 ----- airflow/www/templates/airflow/trigger.html | 4 +- airflow/www/utils.py | 3 +- airflow/www/views.py | 43 -------------- docs/apache-airflow/core-concepts/params.rst | 12 ++-- newsfragments/40029.significant.rst | 1 + tests/www/test_utils.py | 59 ++++---------------- tests/www/views/test_views_trigger_dag.py | 51 +---------------- 8 files changed, 20 insertions(+), 168 deletions(-) create mode 100644 newsfragments/40029.significant.rst diff --git a/airflow/config_templates/config.yml b/airflow/config_templates/config.yml index 007ceadd6788b..621589d2a5877 100644 --- a/airflow/config_templates/config.yml +++ b/airflow/config_templates/config.yml @@ -2042,21 +2042,6 @@ webserver: type: integer example: "10" default: "5" - allow_raw_html_descriptions: - description: | - A DAG author is able to provide any raw HTML into ``doc_md`` or params description in - ``description_md`` for text formatting. This is including potentially unsafe javascript. - Displaying the DAG or trigger form in web UI provides the DAG author the potential to - inject malicious code into clients browsers. To ensure the web UI is safe by default, - raw HTML is disabled by default. If you trust your DAG authors, you can enable HTML - support in markdown by setting this option to ``True``. - - This parameter also enables the deprecated fields ``description_html`` and - ``custom_html_form`` in DAG params until the feature is removed in a future version. - version_added: 2.8.0 - type: boolean - example: "False" - default: "False" allowed_payload_size: description: | The maximum size of the request payload (in MB) that can be sent. diff --git a/airflow/www/templates/airflow/trigger.html b/airflow/www/templates/airflow/trigger.html index eb098dd21d076..86e0b4eb4565a 100644 --- a/airflow/www/templates/airflow/trigger.html +++ b/airflow/www/templates/airflow/trigger.html @@ -42,9 +42,7 @@ : - {% if "custom_html_form" in form_details.schema %} - {{ form_details.schema.custom_html_form | replace("{name}", "element_" + form_key) | replace("{value}", form_details.value) }} - {% elif "type" in form_details.schema and form_details.schema.type == "boolean" %} + {% if "type" in form_details.schema and form_details.schema.type == "boolean" %}