Skip to content

[v3-3-test] Scope /assets/events to the Dags the caller may read (#71741) - #71785

Merged
potiuk merged 1 commit into
v3-3-testfrom
backport-f01520c-v3-3-test
Aug 18, 2026
Merged

potiuk merged 1 commit into
v3-3-testfrom
backport-f01520c-v3-3-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

GET /api/v2/assets/events returned AssetEvent rows for every Dag. It is gated
on requires_access_asset(method="GET"), which under the FAB auth manager checks
the global "Assets" resource and does not consider which Dag produced the
event, and the query applied no per-Dag row filter.

A caller with read on a single Dag plus the global "Assets" resource could
therefore read the source Dag, task and run identifiers, the created dag runs,
and the task-authored "extra" payload of events belonging to every other Dag,
and could target a specific one with ?source_dag_id=.

The six sibling queued-events routes in the same file already apply
ReadableDagsFilterDep; only this one did not.

Add PermittedAssetEventFilter and apply it to the query. Events produced by a
Dag's task are scoped to that Dag's readability. Events with no source Dag —
created through the API, or emitted by a watcher — carry no per-Dag key to
authorize on and stay visible to any caller who may read assets.

The filter is applied inside paginated_select rather than after the fact, so
total_entries and pagination are scoped too and the existence of hidden events
does not leak either.

Test fixtures that create events with a source_dag_id now register the
corresponding Dag, since the scoping resolves against DagModel and the fixtures
previously referenced Dags that did not exist. The query-count assertion moves
from 4 to 5: resolving the caller's readable Dags costs one query, the same
cost the queued-events routes already pay.
(cherry picked from commit f01520c)

Co-authored-by: Jarek Potiuk [email protected]
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

)

GET /api/v2/assets/events returned AssetEvent rows for every Dag. It is gated
on requires_access_asset(method="GET"), which under the FAB auth manager checks
the global "Assets" resource and does not consider which Dag produced the
event, and the query applied no per-Dag row filter.

A caller with read on a single Dag plus the global "Assets" resource could
therefore read the source Dag, task and run identifiers, the created dag runs,
and the task-authored "extra" payload of events belonging to every other Dag,
and could target a specific one with ?source_dag_id=.

The six sibling queued-events routes in the same file already apply
ReadableDagsFilterDep; only this one did not.

Add PermittedAssetEventFilter and apply it to the query. Events produced by a
Dag's task are scoped to that Dag's readability. Events with no source Dag —
created through the API, or emitted by a watcher — carry no per-Dag key to
authorize on and stay visible to any caller who may read assets.

The filter is applied inside paginated_select rather than after the fact, so
total_entries and pagination are scoped too and the existence of hidden events
does not leak either.

Test fixtures that create events with a source_dag_id now register the
corresponding Dag, since the scoping resolves against DagModel and the fixtures
previously referenced Dags that did not exist. The query-count assertion moves
from 4 to 5: resolving the caller's readable Dags costs one query, the same
cost the queued-events routes already pay.
(cherry picked from commit f01520c)

Co-authored-by: Jarek Potiuk <[email protected]>
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
@boring-cyborg boring-cyborg Bot added the area:API Airflow's REST/HTTP API label Aug 18, 2026
@potiuk
potiuk marked this pull request as ready for review August 18, 2026 17:57
@potiuk potiuk closed this Aug 18, 2026
@potiuk potiuk reopened this Aug 18, 2026
@potiuk
potiuk merged commit e26a4cf into v3-3-test Aug 18, 2026
147 of 162 checks passed
@potiuk
potiuk deleted the backport-f01520c-v3-3-test branch August 18, 2026 18:58
@github-actions github-actions Bot added this to the Airflow 3.3.2 milestone Aug 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.3.2 based on: merged to version branch
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

vatsrahul1001 pushed a commit that referenced this pull request Sep 7, 2026
) (#71785)

GET /api/v2/assets/events returned AssetEvent rows for every Dag. It is gated
on requires_access_asset(method="GET"), which under the FAB auth manager checks
the global "Assets" resource and does not consider which Dag produced the
event, and the query applied no per-Dag row filter.

A caller with read on a single Dag plus the global "Assets" resource could
therefore read the source Dag, task and run identifiers, the created dag runs,
and the task-authored "extra" payload of events belonging to every other Dag,
and could target a specific one with ?source_dag_id=.

The six sibling queued-events routes in the same file already apply
ReadableDagsFilterDep; only this one did not.

Add PermittedAssetEventFilter and apply it to the query. Events produced by a
Dag's task are scoped to that Dag's readability. Events with no source Dag —
created through the API, or emitted by a watcher — carry no per-Dag key to
authorize on and stay visible to any caller who may read assets.

The filter is applied inside paginated_select rather than after the fact, so
total_entries and pagination are scoped too and the existence of hidden events
does not leak either.

Test fixtures that create events with a source_dag_id now register the
corresponding Dag, since the scoping resolves against DagModel and the fixtures
previously referenced Dags that did not exist. The query-count assertion moves
from 4 to 5: resolving the caller's readable Dags costs one query, the same
cost the queued-events routes already pay.
(cherry picked from commit f01520c)


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 vatsrahul1001 added the type:bug-fix Changelog: Bug Fixes label Sep 8, 2026
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