Skip to content

Allowing the Airflow Scheduler to use a custom appless security manager #23232

Closed

Description

@zpinto

Description

Currently, Airflow allows the use of a custom security manager for auth within the web application. The custom security manager class is typically declared in the webserver_config.py and dynamically imported and used by flask_appbuilder when the web application starts.

Outside of the web application, the Airflow Scheduler(specifically DagBag) uses ApplessAirflowSecurityManager which is a subclass of AirflowSecurityManager and not the custom security manager. This makes it impossible(without monkey patching) to override the logic for sync_perm_for_dag.

I would like to override this method called by DagBag to implicitly create roles defined in a DAGs access_control dict based on some custom logic.

I believe a possible approach to allowing DagBag to use a custom ApplessAirflowSecurityManager would be to add a config to [core] called something like appless_security_manager_class which declares the class. Then, replace the import of ApplessAirflowSecurityManager with a dynamic import of the custom security manager(if specified) similar to the way it is done for the web application.

Use case/motivation

I would like to override the sync_perm_for_dag method called by DagBag to implicitly create roles defined in a DAGs access_control dict based on some custom logic. This cannot currently be done because DagBag does not use the same custom security manager as the Airflow web application.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:feature
    on Apr 25, 2022
  2. boring-cyborg commented on Apr 25, 2022

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template!

  3. vincbeck commented on Jul 27, 2026

    @vincbeck
    Contributor

    Closing it since this is no longer applicable. All Flask code has been moved to Fab but also I dont think this is something we want/need today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions