Skip to content

x_frame_enabled logic broken in Airflow 2 #17255

Description

@planoe-cloudera

Apache Airflow version: 2.1.0

Environment:

  • Cloud provider or hardware configuration: Azure
  • OS (e.g. from /etc/os-release): RHEL8.3
  • Kernel (e.g. uname -a): Linux 7db15dac176b 5.10.25-linuxkit # 1 SMP Tue Mar 23 09:27:39 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

What happened:

When x_frame_enabled is default or set to true, embedding Airflow is not working since X-Frame-Options is set to "DENY"

What you expected to happen:

When x_frame_enabled is default or set to true, embedding Airflow is working

How to reproduce it:
leave x_frame_enabled to default or set it to true and try to embed it in an iFrame for instance and it will not work.
Setting it to "False" is the current workaround since the if condition does not seem to be correct.

Anything else we need to know:
broken code in Airflow 2:

def init_xframe_protection(app):

if x_frame_enabled is enabled it will apply the DENY header, which was not the case in Airflow 1:
def apply_caching(response):

since if was only setting the header in case it is NOT enabled.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions