diff --git a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/config.py b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/config.py index e7c39b3f3a154..addafaf0bc7be 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/config.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/config.py @@ -24,10 +24,6 @@ class ConfigResponse(BaseModel): """configuration serializer.""" - navbar_color: str - navbar_text_color: str - navbar_hover_color: str - navbar_text_hover_color: str page_size: int auto_refresh_interval: int hide_paused_dags_by_default: bool diff --git a/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml b/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml index 5eead52583dd4..67f37ac5eae27 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml +++ b/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml @@ -728,18 +728,6 @@ components: description: Base Node serializer for responses. ConfigResponse: properties: - navbar_color: - type: string - title: Navbar Color - navbar_text_color: - type: string - title: Navbar Text Color - navbar_hover_color: - type: string - title: Navbar Hover Color - navbar_text_hover_color: - type: string - title: Navbar Text Hover Color page_size: type: integer title: Page Size @@ -783,10 +771,6 @@ components: title: Dashboard Alert type: object required: - - navbar_color - - navbar_text_color - - navbar_hover_color - - navbar_text_hover_color - page_size - auto_refresh_interval - hide_paused_dags_by_default diff --git a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/config.py b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/config.py index 9a0ee08eca919..7c61c8b93d4c9 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/config.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/config.py @@ -30,7 +30,6 @@ config_router = AirflowRouter(tags=["Config"]) WEBSERVER_CONFIG_KEYS = [ - "navbar_color", "page_size", "auto_refresh_interval", "hide_paused_dags_by_default", @@ -39,9 +38,6 @@ "require_confirmation_dag_change", "enable_swagger_ui", "instance_name_has_markup", - "navbar_text_color", - "navbar_hover_color", - "navbar_text_hover_color", ] diff --git a/airflow-core/src/airflow/cli/commands/config_command.py b/airflow-core/src/airflow/cli/commands/config_command.py index 381fdc848fd6d..2d817bbf40c8f 100644 --- a/airflow-core/src/airflow/cli/commands/config_command.py +++ b/airflow-core/src/airflow/cli/commands/config_command.py @@ -386,6 +386,26 @@ def message(self) -> str | None: config=ConfigParameter("webserver", "expose_hostname"), renamed_to=ConfigParameter("fab", "expose_hostname"), ), + ConfigChange( + config=ConfigParameter("webserver", "navbar_color"), + renamed_to=ConfigParameter("fab", "navbar_color"), + ), + ConfigChange( + config=ConfigParameter("webserver", "navbar_text_color"), + renamed_to=ConfigParameter("fab", "navbar_text_color"), + ), + ConfigChange( + config=ConfigParameter("webserver", "navbar_hover_color"), + renamed_to=ConfigParameter("fab", "navbar_hover_color"), + ), + ConfigChange( + config=ConfigParameter("webserver", "navbar_text_hover_color"), + renamed_to=ConfigParameter("fab", "navbar_text_hover_color"), + ), + ConfigChange( + config=ConfigParameter("webserver", "x_frame_enabled"), + was_deprecated=False, + ), ConfigChange( config=ConfigParameter("webserver", "base_url"), renamed_to=ConfigParameter("api", "base_url"), diff --git a/airflow-core/src/airflow/config_templates/config.yml b/airflow-core/src/airflow/config_templates/config.yml index 122b67174e5de..8a96de68a6fa9 100644 --- a/airflow-core/src/airflow/config_templates/config.yml +++ b/airflow-core/src/airflow/config_templates/config.yml @@ -1771,34 +1771,6 @@ webserver: type: string example: ~ default: "50" - navbar_color: - description: | - Define the color of navigation bar - version_added: ~ - type: string - example: ~ - default: "#fff" - navbar_text_color: - description: | - Define the color of text in the navigation bar - version_added: 2.8.0 - type: string - example: ~ - default: "#51504f" - navbar_hover_color: - description: | - Define the color of navigation bar links when hovered - version_added: 2.9.0 - type: string - example: ~ - default: "#eee" - navbar_text_hover_color: - description: | - Define the color of text in the navigation bar when hovered - version_added: 2.9.0 - type: string - example: ~ - default: "#51504f" default_wrap: description: | Default setting for wrap toggle on DAG code and TI log views. @@ -1806,13 +1778,6 @@ webserver: type: boolean example: ~ default: "False" - x_frame_enabled: - description: | - Allow the UI to be rendered in a frame - version_added: 1.10.8 - type: boolean - example: ~ - default: "True" instance_name: description: | Sets a custom page title for the DAGs overview page and site title for all pages diff --git a/airflow-core/src/airflow/configuration.py b/airflow-core/src/airflow/configuration.py index 592a060307def..aa1a147c3bc3d 100644 --- a/airflow-core/src/airflow/configuration.py +++ b/airflow-core/src/airflow/configuration.py @@ -358,6 +358,10 @@ def sensitive_config_values(self) -> set[tuple[str, str]]: ("api", "expose_config"): ("webserver", "expose_config", "3.0.1"), ("fab", "access_denied_message"): ("webserver", "access_denied_message", "3.0.2"), ("fab", "expose_hostname"): ("webserver", "expose_hostname", "3.0.2"), + ("fab", "navbar_color"): ("webserver", "navbar_color", "3.0.2"), + ("fab", "navbar_text_color"): ("webserver", "navbar_text_color", "3.0.2"), + ("fab", "navbar_hover_color"): ("webserver", "navbar_hover_color", "3.0.2"), + ("fab", "navbar_text_hover_color"): ("webserver", "navbar_text_hover_color", "3.0.2"), } # A mapping of new section -> (old section, since_version). diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts index 71358efef679e..0f4b6cdef6df2 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts @@ -5786,22 +5786,6 @@ export const $BaseNodeResponse = { export const $ConfigResponse = { properties: { - navbar_color: { - type: "string", - title: "Navbar Color", - }, - navbar_text_color: { - type: "string", - title: "Navbar Text Color", - }, - navbar_hover_color: { - type: "string", - title: "Navbar Hover Color", - }, - navbar_text_hover_color: { - type: "string", - title: "Navbar Text Hover Color", - }, page_size: { type: "integer", title: "Page Size", @@ -5860,10 +5844,6 @@ export const $ConfigResponse = { }, type: "object", required: [ - "navbar_color", - "navbar_text_color", - "navbar_hover_color", - "navbar_text_hover_color", "page_size", "auto_refresh_interval", "hide_paused_dags_by_default", diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts index ba8bbb28d2de0..0d27e9c4a5cb1 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts @@ -1449,10 +1449,6 @@ export type type = * configuration serializer. */ export type ConfigResponse = { - navbar_color: string; - navbar_text_color: string; - navbar_hover_color: string; - navbar_text_hover_color: string; page_size: number; auto_refresh_interval: number; hide_paused_dags_by_default: boolean; diff --git a/airflow-core/src/airflow/ui/src/mocks/handlers/config.ts b/airflow-core/src/airflow/ui/src/mocks/handlers/config.ts index 79dfc7d634ab0..cbfb9298f8dcb 100644 --- a/airflow-core/src/airflow/ui/src/mocks/handlers/config.ts +++ b/airflow-core/src/airflow/ui/src/mocks/handlers/config.ts @@ -29,10 +29,6 @@ export const handlers: Array = [ hide_paused_dags_by_default: false, instance_name: "Airflow", instance_name_has_markup: false, - navbar_color: "#fff", - navbar_hover_color: "#eee", - navbar_text_color: "#51504f", - navbar_text_hover_color: "#51504f", page_size: 15, require_confirmation_dag_change: false, test_connection: "Disabled", diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_config.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_config.py index 1deb5f4696736..c9987d5d69f07 100644 --- a/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_config.py +++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_config.py @@ -23,10 +23,6 @@ pytestmark = pytest.mark.db_test mock_config_response = { - "navbar_color": "#fff", - "navbar_text_color": "#51504f", - "navbar_hover_color": "#eee", - "navbar_text_hover_color": "#51504f", "page_size": 100, "auto_refresh_interval": 3, "hide_paused_dags_by_default": False, @@ -51,10 +47,6 @@ def mock_config_data(): with patch("airflow.configuration.conf.as_dict") as mock_conf: mock_conf.return_value = { "webserver": { - "navbar_color": "#fff", - "navbar_text_color": "#51504f", - "navbar_hover_color": "#eee", - "navbar_text_hover_color": "#51504f", "page_size": "100", "auto_refresh_interval": "3", "hide_paused_dags_by_default": "false", diff --git a/providers/fab/docs/auth-manager/security.rst b/providers/fab/docs/auth-manager/security.rst index cd07d24c556ee..9f2bf0a9e4cd5 100644 --- a/providers/fab/docs/auth-manager/security.rst +++ b/providers/fab/docs/auth-manager/security.rst @@ -22,17 +22,6 @@ FAB auth manager UI security options This guide only applies to FAB auth manager UI pages. These pages are accessible under category "Security" in the menu. -Rendering Airflow UI in a Web Frame from another site ------------------------------------------------------- - -Using Airflow in a web frame is enabled by default. To disable this (and prevent click jacking attacks) -set the below: - -.. code-block:: ini - - [webserver] - x_frame_enabled = False - Disable Deployment Exposure Warning --------------------------------------- diff --git a/providers/fab/provider.yaml b/providers/fab/provider.yaml index 9c7d63f76a67c..618a15e95f08a 100644 --- a/providers/fab/provider.yaml +++ b/providers/fab/provider.yaml @@ -32,7 +32,8 @@ source-date-epoch: 1741121873 # note that those versions are maintained by release manager - do not update them manually versions: - - 2.0.3 + - 2.2.0 + - 2.1.0 - 2.0.2 - 2.0.1 - 2.0.0 @@ -57,6 +58,34 @@ config: fab: description: This section contains configs specific to FAB provider. options: + navbar_color: + description: | + Define the color of navigation bar + version_added: 2.2.0 + type: string + example: ~ + default: "#fff" + navbar_text_color: + description: | + Define the color of text in the navigation bar + version_added: 2.2.0 + type: string + example: ~ + default: "#51504f" + navbar_hover_color: + description: | + Define the color of navigation bar links when hovered + version_added: 2.2.0 + type: string + example: ~ + default: "#eee" + navbar_text_hover_color: + description: | + Define the color of text in the navigation bar when hovered + version_added: 2.2.0 + type: string + example: ~ + default: "#51504f" access_denied_message: description: | The message displayed when a user attempts to execute actions beyond their authorised privileges. diff --git a/providers/fab/pyproject.toml b/providers/fab/pyproject.toml index e75eaa30eaa3c..905be02a20cf8 100644 --- a/providers/fab/pyproject.toml +++ b/providers/fab/pyproject.toml @@ -25,7 +25,7 @@ build-backend = "flit_core.buildapi" [project] name = "apache-airflow-providers-fab" -version = "2.0.3" +version = "2.2.0" description = "Provider package apache-airflow-providers-fab for Apache Airflow" readme = "README.rst" authors = [ @@ -127,8 +127,8 @@ apache-airflow-providers-common-sql = {workspace = true} apache-airflow-providers-standard = {workspace = true} [project.urls] -"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-fab/2.0.3" -"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-fab/2.0.3/changelog.html" +"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-fab/2.2.0" +"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-fab/2.2.0/changelog.html" "Bug Tracker" = "https://github.com/apache/airflow/issues" "Source Code" = "https://github.com/apache/airflow" "Slack Chat" = "https://s.apache.org/airflow-slack" diff --git a/providers/fab/src/airflow/providers/fab/__init__.py b/providers/fab/src/airflow/providers/fab/__init__.py index daa81fc76b6cf..3293cf2d8b050 100644 --- a/providers/fab/src/airflow/providers/fab/__init__.py +++ b/providers/fab/src/airflow/providers/fab/__init__.py @@ -29,7 +29,7 @@ __all__ = ["__version__"] -__version__ = "2.0.3" +__version__ = "2.2.0" if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse( "3.0.2" diff --git a/providers/fab/src/airflow/providers/fab/get_provider_info.py b/providers/fab/src/airflow/providers/fab/get_provider_info.py index a811deb5cec2a..21891f7ec15b8 100644 --- a/providers/fab/src/airflow/providers/fab/get_provider_info.py +++ b/providers/fab/src/airflow/providers/fab/get_provider_info.py @@ -30,6 +30,34 @@ def get_provider_info(): "fab": { "description": "This section contains configs specific to FAB provider.", "options": { + "navbar_color": { + "description": "Define the color of navigation bar\n", + "version_added": "2.2.0", + "type": "string", + "example": None, + "default": "#fff", + }, + "navbar_text_color": { + "description": "Define the color of text in the navigation bar\n", + "version_added": "2.2.0", + "type": "string", + "example": None, + "default": "#51504f", + }, + "navbar_hover_color": { + "description": "Define the color of navigation bar links when hovered\n", + "version_added": "2.2.0", + "type": "string", + "example": None, + "default": "#eee", + }, + "navbar_text_hover_color": { + "description": "Define the color of text in the navigation bar when hovered\n", + "version_added": "2.2.0", + "type": "string", + "example": None, + "default": "#51504f", + }, "access_denied_message": { "description": "The message displayed when a user attempts to execute actions beyond their authorised privileges.\n", "version_added": "2.0.3", diff --git a/providers/fab/src/airflow/providers/fab/www/app.py b/providers/fab/src/airflow/providers/fab/www/app.py index be29f28bd674c..3632cf2df4920 100644 --- a/providers/fab/src/airflow/providers/fab/www/app.py +++ b/providers/fab/src/airflow/providers/fab/www/app.py @@ -33,7 +33,7 @@ from airflow.providers.fab.www.extensions.init_appbuilder import init_appbuilder from airflow.providers.fab.www.extensions.init_jinja_globals import init_jinja_globals from airflow.providers.fab.www.extensions.init_manifest_files import configure_manifest_files -from airflow.providers.fab.www.extensions.init_security import init_api_auth, init_xframe_protection +from airflow.providers.fab.www.extensions.init_security import init_api_auth from airflow.providers.fab.www.extensions.init_session import init_airflow_session_interface from airflow.providers.fab.www.extensions.init_views import ( init_api_auth_provider, @@ -101,7 +101,6 @@ def create_app(enable_plugins: bool): init_api_auth_provider(flask_app) init_api_error_handlers(flask_app) init_jinja_globals(flask_app, enable_plugins=enable_plugins) - init_xframe_protection(flask_app) init_airflow_session_interface(flask_app) return flask_app diff --git a/providers/fab/src/airflow/providers/fab/www/extensions/init_jinja_globals.py b/providers/fab/src/airflow/providers/fab/www/extensions/init_jinja_globals.py index 35aa5c71413b9..6ef21a185022f 100644 --- a/providers/fab/src/airflow/providers/fab/www/extensions/init_jinja_globals.py +++ b/providers/fab/src/airflow/providers/fab/www/extensions/init_jinja_globals.py @@ -52,10 +52,10 @@ def prepare_jinja_globals(): extra_globals = { "server_timezone": server_timezone, "hostname": hostname, - "navbar_color": conf.get("webserver", "NAVBAR_COLOR"), - "navbar_text_color": conf.get("webserver", "NAVBAR_TEXT_COLOR"), - "navbar_hover_color": conf.get("webserver", "NAVBAR_HOVER_COLOR"), - "navbar_text_hover_color": conf.get("webserver", "NAVBAR_TEXT_HOVER_COLOR"), + "navbar_color": conf.get("fab", "NAVBAR_COLOR"), + "navbar_text_color": conf.get("fab", "NAVBAR_TEXT_COLOR"), + "navbar_hover_color": conf.get("fab", "NAVBAR_HOVER_COLOR"), + "navbar_text_hover_color": conf.get("fab", "NAVBAR_TEXT_HOVER_COLOR"), "airflow_version": airflow_version, "git_version": git_version, "show_plugin_message": enable_plugins, diff --git a/providers/fab/src/airflow/providers/fab/www/extensions/init_security.py b/providers/fab/src/airflow/providers/fab/www/extensions/init_security.py index 6f62880808014..8d85885d4ab4e 100644 --- a/providers/fab/src/airflow/providers/fab/www/extensions/init_security.py +++ b/providers/fab/src/airflow/providers/fab/www/extensions/init_security.py @@ -25,25 +25,6 @@ log = logging.getLogger(__name__) -def init_xframe_protection(app): - """ - Add X-Frame-Options header. - - Use it to avoid click-jacking attacks, by ensuring that their content is not embedded into other sites. - - See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options - """ - x_frame_enabled = conf.getboolean("webserver", "X_FRAME_ENABLED", fallback=True) - if x_frame_enabled: - return - - def apply_caching(response): - response.headers["X-Frame-Options"] = "DENY" - return response - - app.after_request(apply_caching) - - def init_api_auth(app): """Load authentication backends.""" auth_backends = conf.get( diff --git a/providers/fab/tests/unit/fab/decorators.py b/providers/fab/tests/unit/fab/decorators.py index f359563e2eaf6..77c9b077e7740 100644 --- a/providers/fab/tests/unit/fab/decorators.py +++ b/providers/fab/tests/unit/fab/decorators.py @@ -37,7 +37,6 @@ def no_op(*args, **kwargs): "init_api_auth_provider", "init_api_error_handlers", "init_jinja_globals", - "init_xframe_protection", "init_airflow_session_interface", "init_appbuilder", ] diff --git a/pyproject.toml b/pyproject.toml index 92c3010f1d883..a9d2e33b2c8a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -209,7 +209,7 @@ packages = [] "apache-airflow-providers-exasol>=4.6.1" ] "fab" = [ - "apache-airflow-providers-fab>=2.0.3" # Set from MIN_VERSION_OVERRIDE in update_airflow_pyproject_toml.py + "apache-airflow-providers-fab>=2.2.0" # Set from MIN_VERSION_OVERRIDE in update_airflow_pyproject_toml.py ] "facebook" = [ "apache-airflow-providers-facebook>=3.7.0" @@ -418,7 +418,7 @@ packages = [] "apache-airflow-providers-edge3>=1.0.0", "apache-airflow-providers-elasticsearch>=5.5.2", "apache-airflow-providers-exasol>=4.6.1", - "apache-airflow-providers-fab>=2.0.3", # Set from MIN_VERSION_OVERRIDE in update_airflow_pyproject_toml.py + "apache-airflow-providers-fab>=2.2.0", # Set from MIN_VERSION_OVERRIDE in update_airflow_pyproject_toml.py "apache-airflow-providers-facebook>=3.7.0", "apache-airflow-providers-ftp>=3.12.0", "apache-airflow-providers-git>=0.0.2", # Set from MIN_VERSION_OVERRIDE in update_airflow_pyproject_toml.py diff --git a/scripts/ci/pre_commit/update_airflow_pyproject_toml.py b/scripts/ci/pre_commit/update_airflow_pyproject_toml.py index 9f77d05deb108..6dc8853026fad 100755 --- a/scripts/ci/pre_commit/update_airflow_pyproject_toml.py +++ b/scripts/ci/pre_commit/update_airflow_pyproject_toml.py @@ -56,7 +56,7 @@ # minimum versions for compatibility with Airflow 3 MIN_VERSION_OVERRIDE: dict[str, Version] = { "amazon": parse_version("2.1.3"), - "fab": parse_version("2.0.3"), + "fab": parse_version("2.2.0"), "openlineage": parse_version("2.1.3"), "git": parse_version("0.0.2"), "common.messaging": parse_version("1.0.1"),