Repository navigation
[v3-3-test] Scope /assets/events to the Dags the caller may read (#71741) - #71785
Merged
Merged
Conversation
) 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
potiuk
marked this pull request as ready for review
August 18, 2026 17:57
potiuk
requested review from
bugraoz93,
choo121600,
ephraimbuddy,
henry3260,
jason810496,
pierrejeambrun,
rawwar and
shubhamraj-git
as code owners
August 18, 2026 17:57
Contributor
Author
|
Hi maintainer, this PR was merged without a milestone set.
|
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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