Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAG-level permissions for /dags/{dag_id}/clearTaskInstances is incorrect #43140

Open
1 of 2 tasks
wolfier opened this issue Oct 18, 2024 · 0 comments
Open
1 of 2 tasks
Labels
area:auth kind:bug This is a clearly a bug kind:documentation needs-triage label for new issues that we didn't triage yet

Comments

@wolfier
Copy link
Contributor

wolfier commented Oct 18, 2024

What do you see as an issue?

The documentation on DAG level permissions states that the permissions DAGs.can_edit, DAG Runs.can_read, Task Instances.can_edit are required for the endpoint /dags/{dag_id}/clearTaskInstances.

Solving the problem

The permissions for the endpoint /dags/{dag_id}/clearTaskInstances are DAGs.can_edit, DAG Runs.can_edit, Task Instances.can_edit. The method is also "PUT" not "POST".

In Airflow 2.8.0, the clear endpoint updated (see PR) to use the requires_access_dag function which leverages is_authorized_dag. More importantly, the SAME resource method is used to check against each resource entity. The clear method passes the "PUT" resource method which translates to "ACTION_CAN_EDIT".

The logic translates to requiring the following permissions.
(permissions.ACTION_CAN_EDIT, permissions.RESOURCE_DAG)
(permissions.ACTION_CAN_EDIT, permissions.RESOURCE_DAG_RUN)
(permissions.ACTION_CAN_EDIT, permissions.RESOURCE_TASK_INSTANCE)

Anything else

I did not check the other DAG level permissions. I recommend verifying each entry.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@wolfier wolfier added kind:bug This is a clearly a bug kind:documentation needs-triage label for new issues that we didn't triage yet labels Oct 18, 2024
@dosubot dosubot bot added the area:auth label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:auth kind:bug This is a clearly a bug kind:documentation needs-triage label for new issues that we didn't triage yet
Projects
None yet
Development

No branches or pull requests

1 participant