You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "sjyangkevin (via GitHub)" <gi...@apache.org> on 2026/04/07 02:10:19 UTC
[PR] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response [airflow]
sjyangkevin opened a new pull request, #64822:
URL: https://github.com/apache/airflow/pull/64822
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
<!--
Thank you for contributing!
Please provide above a brief description of the changes made in this pull request.
Write a good git commit message following this guide: http://chris.beams.io/posts/git-commit/
Please make sure that your code changes are covered with tests.
And in case of new features or big changes remember to adjust the documentation.
Feel free to ping (in general) for the review if you do not see reaction for a few days
(72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
In case of an existing issue, reference it using one of the following:
* closes: #ISSUE
* related: #ISSUE
-->
---
##### Was generative AI tooling used to co-author this PR?
<!--
If generative AI tooling has been used in the process of authoring this PR, please
change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
-->
- [ ] Yes (please specify the tool below)
<!--
Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
-->
---
* Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
* For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #64822:
URL: https://github.com/apache/airflow/pull/64822#discussion_r3065015227
##########
airflow-core/newsfragments/64822.significant.rst:
##########
@@ -0,0 +1 @@
+Add ``DagAccessEntity.RUN``, ``DagAccessEntity.HITL_DETAIL``, ``DagAccessEntity.TASK_INSTANCE`` as ``requires_access_dag`` dependencies of the ``/dags`` endpoint because it returns data from multiple entities in response
Review Comment:
Can you explicit what it means from a permission management point of view. Something along this lines (without .... of course)
"Users that have only access to ..... won't be able to fetch etc... please consider updating your users permissions if they should still access this"
##########
airflow-core/newsfragments/64822.significant.rst:
##########
@@ -0,0 +1 @@
+Add ``DagAccessEntity.RUN``, ``DagAccessEntity.HITL_DETAIL``, ``DagAccessEntity.TASK_INSTANCE`` as ``requires_access_dag`` dependencies of the ``/dags`` endpoint because it returns data from multiple entities in response
Review Comment:
Can you explicit what it means from a permission management point of view. Something along this lines (without .... of course)
"Users that have only access to ..... won't be able to fetch etc... please consider updating your users permissions if they should still access ..."
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun merged PR #64822:
URL: https://github.com/apache/airflow/pull/64822
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response [airflow]
Posted by "sjyangkevin (via GitHub)" <gi...@apache.org>.
sjyangkevin commented on PR #64822:
URL: https://github.com/apache/airflow/pull/64822#issuecomment-4199239190
> Looking good. We might need a significant newsfragment just to mention this. Just a disclaimer for people to double check their users permissions check or they might have unintended forbidden errors.
Thanks! I will look into how to add a newsfragment for this change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response [airflow]
Posted by "sjyangkevin (via GitHub)" <gi...@apache.org>.
sjyangkevin commented on PR #64822:
URL: https://github.com/apache/airflow/pull/64822#issuecomment-4245117906
Thanks, I will check and resolve the copilot comments by this week.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response [airflow]
Posted by "sjyangkevin (via GitHub)" <gi...@apache.org>.
sjyangkevin commented on code in PR #64822:
URL: https://github.com/apache/airflow/pull/64822#discussion_r3065580471
##########
airflow-core/newsfragments/64822.significant.rst:
##########
@@ -0,0 +1 @@
+Add ``DagAccessEntity.RUN``, ``DagAccessEntity.HITL_DETAIL``, ``DagAccessEntity.TASK_INSTANCE`` as ``requires_access_dag`` dependencies of the ``/dags`` endpoint because it returns data from multiple entities in response
Review Comment:
Thanks for the feedback! I've updated the description. Please feel free to let me know if the message sounds more clear, or any refinement still needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #64822:
URL: https://github.com/apache/airflow/pull/64822#discussion_r3065015227
##########
airflow-core/newsfragments/64822.significant.rst:
##########
@@ -0,0 +1 @@
+Add ``DagAccessEntity.RUN``, ``DagAccessEntity.HITL_DETAIL``, ``DagAccessEntity.TASK_INSTANCE`` as ``requires_access_dag`` dependencies of the ``/dags`` endpoint because it returns data from multiple entities in response
Review Comment:
Can you explicit what it means from a permission management point of view.
"Users that have only access to ..... won't be able to fetch etc... please consider updating your users permissions if they should still access this"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response [airflow]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #64822:
URL: https://github.com/apache/airflow/pull/64822#discussion_r3066473706
##########
airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_dags.py:
##########
@@ -235,6 +237,29 @@ def test_should_response_403(self, unauthorized_test_client):
response = unauthorized_test_client.get("/dags", params={})
assert response.status_code == 403
+ @pytest.mark.parametrize(
+ "denied_entity",
+ [
+ DagAccessEntity.RUN,
+ DagAccessEntity.HITL_DETAIL,
+ DagAccessEntity.TASK_INSTANCE,
+ ],
+ )
+ def test_should_response_403_on_missing_entity_permission(self, test_client, denied_entity):
+ """Users lacking any sub-entity permission should receive 403 on the DAG list."""
+ original_is_authorized = SimpleAuthManager.is_authorized_dag
+
+ def restricted_is_authorized_dag(self, *, method, user, access_entity=None, details=None):
+ if access_entity == denied_entity:
+ return False
+ return original_is_authorized(
Review Comment:
`original_is_authorized` is assigned, but the function returns `original_is_authorized(...)` (a different name), which will raise `NameError` and make the test fail. Rename the call to use the variable that was actually captured (or rename the captured variable to match).
```suggestion
original_is_authorized_dag = SimpleAuthManager.is_authorized_dag
def restricted_is_authorized_dag(self, *, method, user, access_entity=None, details=None):
if access_entity == denied_entity:
return False
return original_is_authorized_dag(
```
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dags.py:
##########
@@ -79,6 +79,9 @@
response_model_exclude_none=True,
dependencies=[
Depends(requires_access_dag(method="GET")),
+ Depends(requires_access_dag(method="GET", access_entity=DagAccessEntity.RUN)),
+ Depends(requires_access_dag(method="GET", access_entity=DagAccessEntity.HITL_DETAIL)),
+ Depends(requires_access_dag(method="GET", access_entity=DagAccessEntity.TASK_INSTANCE)),
],
Review Comment:
Repeating `requires_access_dag(method="GET", ...)` three times duplicates the access-check wiring and makes future additions/removals easy to miss (and may also add avoidable overhead if each dependency performs non-trivial work). Consider consolidating into a single dependency that can validate multiple `DagAccessEntity` values (e.g., accept a list/set or provide a small wrapper dependency that iterates entities and fails fast).
##########
airflow-core/newsfragments/64822.significant.rst:
##########
@@ -0,0 +1 @@
+Users who only have read access to DAGs will no longer be able to fetch data from the ``/dags`` endpoint, as it now requires additional permissions (``DagAccessEntity.RUN``, ``DagAccessEntity.HITL_DETAIL``, and ``DagAccessEntity.TASK_INSTANCE``). This change was made because the endpoint returns aggregated data from these multiple entities. Please update your custom user roles to include read access for DAG Runs, Task Instances, and HITL Details if those users should still have access to the ``/dags`` endpoint.
Review Comment:
This note may be ambiguous because Airflow has multiple “/dags” surfaces (UI vs API) and this change is specifically in the FastAPI UI route (`get_dags_ui`). Consider clarifying that this applies to the UI FastAPI `/dags` endpoint (and/or naming it as shown in the route) to reduce confusion for operators updating roles.
```suggestion
Users who only have read access to DAGs will no longer be able to fetch data from the FastAPI UI ``/dags`` endpoint, as it now requires additional permissions (``DagAccessEntity.RUN``, ``DagAccessEntity.HITL_DETAIL``, and ``DagAccessEntity.TASK_INSTANCE``). This change was made because the endpoint returns aggregated data from these multiple entities. Please update your custom user roles to include read access for DAG Runs, Task Instances, and HITL Details if those users should still have access to the FastAPI UI ``/dags`` endpoint.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #64822:
URL: https://github.com/apache/airflow/pull/64822#issuecomment-4245126336
### Backport successfully created: v3-2-test
Note: As of [Merging PRs targeted for Airflow 3.X](https://github.com/apache/airflow/blob/main/dev/README_AIRFLOW3_DEV.md#merging-prs-targeted-for-airflow-3x)
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.
In matter of doubt please ask in [#release-management](https://apache-airflow.slack.com/archives/C03G9H97MM2) Slack channel.
<table>
<tr>
<th>Status</th>
<th>Branch</th>
<th>Result</th>
</tr>
<tr>
<td>✅</td>
<td>v3-2-test</td>
<td><a href="https://github.com/apache/airflow/pull/65225"><img src="https://img.shields.io/badge/PR-65225-blue" alt="PR Link"></a></td>
</tr>
</table>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org