Update is_authorized_dag method in FabAuthManager#54926
Merged
vincbeck merged 9 commits intoapache:mainfrom Sep 3, 2025
Merged
Update is_authorized_dag method in FabAuthManager#54926vincbeck merged 9 commits intoapache:mainfrom
is_authorized_dag method in FabAuthManager#54926vincbeck merged 9 commits intoapache:mainfrom
Conversation
5c673a2 to
b9f7808
Compare
o-nikolas
reviewed
Aug 25, 2025
…manager.py Co-authored-by: Niko Oliveira <onikolas@amazon.com>
59bcf28 to
e360e2c
Compare
o-nikolas
approved these changes
Aug 26, 2025
Contributor
o-nikolas
left a comment
There was a problem hiding this comment.
Not my area of expertise, but the code seems reasonable.
This was referenced Aug 27, 2025
bugraoz93
approved these changes
Aug 28, 2025
Contributor
Author
|
Please do not merge before @pierrejeambrun approval, I'd like to have it before merging :) |
pierrejeambrun
approved these changes
Sep 1, 2025
Member
pierrejeambrun
left a comment
There was a problem hiding this comment.
Makes sense to me, thanks Vincent!
Just one question for my own understanding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #53936.
Follow-up of #54197.
The way
FabAuthManagerchecks for Dag permission is partially broken in multiple ways:get_authorized_dag_ids(which returns the list of Dags the user is authorized to access) and checking whether this list is not empty. Even though this is not strictly wrong, it is not good either. A more robust solution proposed by @pierrejeambrun (see thread here for more information about the solution but also the reason why it is better) is to check whether the user has either access to all Dags or at least one dag permission withRESOURCE_DAG_PREFIXRESOURCE_DAG_RUN_PREFIXbecause I think this is very wrong. The purpose of this constant (value isDAG Run:) is to be able to give access to Dag runs of specific Dags. Example: To give read access to userXof Dag runs of Dagtest, I can add to the user's permissions(CAN_READ, DAG Run:test). But this is possible without this constant, using the same example, to grant the user access to Dagtestruns, you can give them(CAN_READ, Dag:test)and(CAN_READ, RESOURCE_DAG_RUN).^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.