Skip to content

Require Dag edit to delete asset queued events - #71736

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:assets-queued-events-require-dag-edit
Aug 19, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
potiuk:assets-queued-events-require-dag-edit

Conversation

@potiuk

@potiuk potiuk commented Aug 17, 2026

Copy link
Copy Markdown
Member

The three asset queued-events DELETE endpoints authorize the Dag axis with requires_access_dag(method="GET") — a read-level check — while deleting rows from AssetDagRunQueue, which cancels a Dag's pending asset-triggered scheduling.

Every other Dag-scheduling mutation in the API requires Dag edit:

  • Dag run clear / patch / delete — method="PUT"/"DELETE" with access_entity=RUN
  • task-instance state changes — method="PUT"

These three deletes were the only Dag-scheduling-state writes gated on read. A caller holding can_delete on the global Assets resource plus only can_read on a Dag could therefore suppress that Dag's asset-triggered runs.

Change

The Dag-axis gate on the three routes moves to method="PUT". The paired requires_access_asset(method="DELETE") and the ReadableDagsFilterDep row filter are unchanged — only the Dag axis moves from read to edit.

The GET queued-events routes keep method="GET"; reading queued events is a read.

The generated REST API permission reference picked the change up automatically:

    * - ``DELETE``
      - ``/api/v2/dags/{dag_id}/assets/queuedEvents``
      - ``DAG``
-     - ``GET``
+     - ``PUT``

Compatibility

This is a tightening, so a caller who previously succeeded with only Dag read on these three endpoints will now get a 403. That is the intent, but it is worth a second opinion on whether it needs a release-note callout beyond the permission-reference diff.

Testing

Added TestQueuedEventsDagAxisAuthorization, which introspects the registered routes and asserts the method each requires_access_dag was built with — PUT on the three deletes, GET on the two reads. Verified it is not vacuous: reverting the source change makes exactly the three delete assertions fail while the two read assertions still pass.

All 185 tests in test_assets.py pass.

dependant is added to docs/spelling_wordlist.txt — it is FastAPI's own attribute name on a route object, which codespell otherwise flags.


Generated-by: Claude Opus 5 (1M context) following the guidelines at
https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions

The three asset queued-events DELETE endpoints authorized the Dag axis with
requires_access_dag(method="GET") — a read-level check — while deleting rows
from AssetDagRunQueue, which cancels a Dag's pending asset-triggered
scheduling.

Every other Dag-scheduling mutation in the API requires Dag edit: Dag run
clear, patch and delete use method="PUT"/"DELETE" with access_entity=RUN, and
task-instance state changes use method="PUT". These three deletes were the
only Dag-scheduling-state writes gated on read, so a caller holding delete on
the global "Assets" resource plus only read on a Dag could suppress that Dag's
asset-triggered runs.

Change the Dag-axis gate on the three routes to method="PUT". The paired
requires_access_asset(method="DELETE") and the ReadableDagsFilterDep row
filter are unchanged; only the Dag axis moves from read to edit. The generated
REST API permission reference is updated to match.

The GET queued-events routes keep method="GET" — reading queued events is a
read.

Added a structural test asserting the Dag-axis method each queued-events route
carries, so the read/write asymmetry cannot silently return. "dependant" is
added to the spelling wordlist: it is FastAPI's own attribute name on a route.

Generated-by: Claude Opus 5 (1M context) following the guidelines at
https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions
@potiuk
potiuk merged commit 0414544 into apache:main Aug 19, 2026
79 checks passed
@potiuk
potiuk deleted the assets-queued-events-require-dag-edit branch August 19, 2026 09:48
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-3-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-3-test PR Link

@github-actions github-actions Bot added this to the Airflow 3.3.2 milestone Aug 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.3.2 based on: backport label targeting v3-3-test
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

potiuk added a commit that referenced this pull request Aug 19, 2026
…71828)

The three asset queued-events DELETE endpoints authorized the Dag axis with
requires_access_dag(method="GET") — a read-level check — while deleting rows
from AssetDagRunQueue, which cancels a Dag's pending asset-triggered
scheduling.

Every other Dag-scheduling mutation in the API requires Dag edit: Dag run
clear, patch and delete use method="PUT"/"DELETE" with access_entity=RUN, and
task-instance state changes use method="PUT". These three deletes were the
only Dag-scheduling-state writes gated on read, so a caller holding delete on
the global "Assets" resource plus only read on a Dag could suppress that Dag's
asset-triggered runs.

Change the Dag-axis gate on the three routes to method="PUT". The paired
requires_access_asset(method="DELETE") and the ReadableDagsFilterDep row
filter are unchanged; only the Dag axis moves from read to edit. The generated
REST API permission reference is updated to match.

The GET queued-events routes keep method="GET" — reading queued events is a
read.

Added a structural test asserting the Dag-axis method each queued-events route
carries, so the read/write asymmetry cannot silently return. "dependant" is
added to the spelling wordlist: it is FastAPI's own attribute name on a route.
(cherry picked from commit 0414544)


Generated-by: Claude Opus 5 (1M context) following the guidelines at
https: //github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions

Co-authored-by: Jarek Potiuk <[email protected]>
vatsrahul1001 pushed a commit that referenced this pull request Sep 7, 2026
…71828)

The three asset queued-events DELETE endpoints authorized the Dag axis with
requires_access_dag(method="GET") — a read-level check — while deleting rows
from AssetDagRunQueue, which cancels a Dag's pending asset-triggered
scheduling.

Every other Dag-scheduling mutation in the API requires Dag edit: Dag run
clear, patch and delete use method="PUT"/"DELETE" with access_entity=RUN, and
task-instance state changes use method="PUT". These three deletes were the
only Dag-scheduling-state writes gated on read, so a caller holding delete on
the global "Assets" resource plus only read on a Dag could suppress that Dag's
asset-triggered runs.

Change the Dag-axis gate on the three routes to method="PUT". The paired
requires_access_asset(method="DELETE") and the ReadableDagsFilterDep row
filter are unchanged; only the Dag axis moves from read to edit. The generated
REST API permission reference is updated to match.

The GET queued-events routes keep method="GET" — reading queued events is a
read.

Added a structural test asserting the Dag-axis method each queued-events route
carries, so the read/write asymmetry cannot silently return. "dependant" is
added to the spelling wordlist: it is FastAPI's own attribute name on a route.
(cherry picked from commit 0414544)


Generated-by: Claude Opus 5 (1M context) following the guidelines at
https: //github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions

Co-authored-by: Jarek Potiuk <[email protected]>
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 type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants