-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Closed
Labels
area:APIAirflow's REST/HTTP APIAirflow's REST/HTTP APIkind:bugThis is a clearly a bugThis is a clearly a bugkind:documentation
Description
What do you see as an issue?
(preamble): I'm happy to help out with any doc work or code refactors to address this issue; but, I'm raising this issue partly because I myself do not know the correct answer to the details which I think need to be added to the auth manager / security docs.
Description
This issue pertains to the core auth manager docs (as of Airflow version 3.0.2). While the auth manager doc briefly covers the methods to override when implementing a custom Auth manager, the docs do not clarify any of the following details, which I believe are crucial for a proper implementation of a custom auth manager:
- What role do the resource identifiers in
airflow.security.permissionsplay in the auth manager? - How do the
airflow.api_fastapi.auth.managers.models.resource_detailsclass definitions relate to similarly named identifiers inairflow.security.permission? - Likewise, the docs do not clarify the implicit hierarchy of resources/permissioning in the
DagAccessEntity. - Whether the FAB auth manager is slated for deprecation in the near future.
- Which API-action + resource combinations are possible or not, especially as it relates to DAG sub-entities. (I was only able to understand some of these expected action-resource combinations by digging through the various files under
airflow.api_fastapi.core_api.routes.public, but it feels risky to base my assumptions on code which may not be part of the public interface)
Why is this an issue?
- If the auth manager docs explained these concepts thoroughly, it would benefit both Airflow end-users as well as Airflow core contributors seeking to help out with the remaining auth manager implementations (i.e. KeyCloak, AWS, etc).
- This also could present unintended security risks if the various authorization-related resource entities remain inconsistently defined as dataclasses, enums, or string constants in various locations, without any documentation recommending the use of one definition over the other.
- It seems that in general, I've not been the only one who has found the current auth manager docs in need of clarifications, such as in these 2 recent threads: Airflow not using custom API authentication/auth_backends #51362 API Authentication in Airflow 3.0.0 with FAB Provider #50684 . I believe the omissions I listed may help alleviate some (albeit not all of the common sticking points raised in those threads).
Solving the problem
- Clarify what resource definitions users should rely on for their auth manager implementations:
- Should people use the constants in
airflow.security.permissions, if not, why / what is that module's intended use? - What exactly do the various
idattributes refer to in the classes defined inairflow.api_fastapi.auth.models.resource_detailspassed into the auth manager'sis_authorized_*methods? How should user's rely on those fields, and what is the recommended approach for when those resource details arguments areNone?
- Should people use the constants in
- Maybe add a diagram for the expected resource hierarchies in the API permissions models, or at least describe the potential interactions between the various
is_authorized_*methods. For example, it would be nice to have a reference for the expected potential interactions betweenis_authorized_dagandis_authorized_backfillwhich is implicitly defined here.
Anything else
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
kyungjunleeme
Metadata
Metadata
Assignees
Labels
area:APIAirflow's REST/HTTP APIAirflow's REST/HTTP APIkind:bugThis is a clearly a bugThis is a clearly a bugkind:documentation