Skip to content

Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response#64822

Merged
pierrejeambrun merged 3 commits intoapache:mainfrom
sjyangkevin:enhance-dags-endpoint-access
Apr 14, 2026
Merged

Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response#64822
pierrejeambrun merged 3 commits intoapache:mainfrom
sjyangkevin:enhance-dags-endpoint-access

Conversation

@sjyangkevin
Copy link
Copy Markdown
Contributor

@sjyangkevin sjyangkevin commented Apr 7, 2026

The /dags endpoint returns nested entities include RUN, and HITLDetail includes TaskInstanceResponse. Add related access entity to govern the endpoint.

class DAGWithLatestDagRunsResponse(DAGResponse):
    """DAG with latest dag runs response serializer."""

    asset_expression: dict | None
    latest_dag_runs: list[DAGRunLightResponse]
    pending_actions: list[HITLDetail]
    is_favorite: bool

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: [Claude Code - Sonnet 4.6] following the guidelines


  • Read the 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) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@boring-cyborg boring-cyborg bot added the area:API Airflow's REST/HTTP API label Apr 7, 2026
@sjyangkevin sjyangkevin force-pushed the enhance-dags-endpoint-access branch from ecb6e6e to 3208ff0 Compare April 7, 2026 12:59
Copy link
Copy Markdown
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sjyangkevin
Copy link
Copy Markdown
Contributor Author

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.

@sjyangkevin sjyangkevin force-pushed the enhance-dags-endpoint-access branch from 3208ff0 to 8f39310 Compare April 8, 2026 05:42
@sjyangkevin sjyangkevin marked this pull request as ready for review April 8, 2026 14:20
@sjyangkevin sjyangkevin force-pushed the enhance-dags-endpoint-access branch 2 times, most recently from 259a250 to 363948c Compare April 8, 2026 20:56
Copy link
Copy Markdown
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit I think we need to make the newsfragment clearer.

Comment thread airflow-core/newsfragments/64822.significant.rst Outdated
@sjyangkevin sjyangkevin force-pushed the enhance-dags-endpoint-access branch from 363948c to d9f9403 Compare April 10, 2026 16:39
@kaxil kaxil requested a review from Copilot April 10, 2026 19:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds missing authorization requirements for nested entities returned by the UI /dags endpoint, ensuring access control covers DAG Runs, HITL Details, and Task Instances included in the response.

Changes:

  • Require DagAccessEntity.RUN, DagAccessEntity.HITL_DETAIL, and DagAccessEntity.TASK_INSTANCE permissions on GET /dags.
  • Add a unit test asserting 403 when any required sub-entity permission is missing.
  • Add a significant newsfragment documenting the permission change and migration guidance.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dags.py Adds additional requires_access_dag dependencies for nested entities returned by /dags.
airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_dags.py Adds a parametrized test to verify missing entity permissions cause a 403.
airflow-core/newsfragments/64822.significant.rst Documents the breaking permission change for consumers/custom roles.

Comment thread airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_dags.py
Comment thread airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dags.py
Comment thread airflow-core/newsfragments/64822.significant.rst
Copy link
Copy Markdown
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ty

@pierrejeambrun pierrejeambrun added this to the Airflow 3.2.2 milestone Apr 14, 2026
@pierrejeambrun pierrejeambrun added the backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch label Apr 14, 2026
@pierrejeambrun pierrejeambrun merged commit fed4921 into apache:main Apr 14, 2026
145 of 146 checks passed
@sjyangkevin
Copy link
Copy Markdown
Contributor Author

Thanks, I will check and resolve the copilot comments by this week.

github-actions bot pushed a commit that referenced this pull request Apr 14, 2026
…s endpoint as it returns nested entities in response (#64822)

* add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response

* add newsfragment for significant change to /dags endpoint

* update newsfragment message to be more clear
(cherry picked from commit fed4921)

Co-authored-by: Kevin Yang <85313829+sjyangkevin@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Backport successfully created: v3-2-test

Note: As of Merging PRs targeted for Airflow 3.X
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 Slack channel.

Status Branch Result
v3-2-test PR Link

potiuk pushed a commit that referenced this pull request Apr 15, 2026
…s endpoint as it returns nested entities in response (#64822)

* add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response

* add newsfragment for significant change to /dags endpoint

* update newsfragment message to be more clear
(cherry picked from commit fed4921)

Co-authored-by: Kevin Yang <85313829+sjyangkevin@users.noreply.github.com>
@potiuk potiuk modified the milestones: Airflow 3.2.2, Airflow 3.2.1 Apr 15, 2026
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
…s endpoint as it returns nested entities in response (#64822) (#65225)

[v3-2-test] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response (#64822) (#65225)
Co-authored-by: Kevin Yang <85313829+sjyangkevin@users.noreply.github.com>
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
…s endpoint as it returns nested entities in response (#64822) (#65225)

[v3-2-test] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response (#64822) (#65225)
Co-authored-by: Kevin Yang <85313829+sjyangkevin@users.noreply.github.com>
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
…s endpoint as it returns nested entities in response (#64822) (#65225)

[v3-2-test] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response (#64822) (#65225)
Co-authored-by: Kevin Yang <85313829+sjyangkevin@users.noreply.github.com>
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
…s endpoint as it returns nested entities in response (#64822) (#65225)

[v3-2-test] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response (#64822) (#65225)
Co-authored-by: Kevin Yang <85313829+sjyangkevin@users.noreply.github.com>
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
…s endpoint as it returns nested entities in response (#64822) (#65225)

[v3-2-test] Fix: add RUN, HITL_DETAIL, TASK_INSTANCE entities to /dags endpoint as it returns nested entities in response (#64822) (#65225)
Co-authored-by: Kevin Yang <85313829+sjyangkevin@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants