Repository navigation
Mock the simple auth manager in the upstream asset events permission test - #75126
Conversation
…test SimpleAuthManager overrides get_authorized_assets since apache#72934, so patching the BaseAuthManager method left the real one in place, every asset stayed readable, and the test added in apache#72924 failed on main. Generated-by: Claude Opus 5
Eason09053360
left a comment
There was a problem hiding this comment.
Thanks for the quick fix! LGTM.
|
Failing my CI at #74752, thanks for the fix ! |
Backport failed to create: v3-4-test. View the failure log Run detailsNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
You can attempt to backport this manually by running: cherry_picker 33e6b5f v3-4-testThis should apply the commit to the v3-4-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
|
The automatic backport to Drafted-by: Claude Code (Opus 5.5); reviewed by @potiuk before posting |
…gs the caller may read (#72924) (#75108) * [v3-4-test] Scope upstream asset events of a Dag run to assets and Dags the caller may read (#72924) GET /dags/{dag_id}/dagRuns/{dag_run_id}/upstreamAssetEvents returned every asset event a run consumed as long as the caller could read the consuming Dag. Events of assets, or produced by source Dags, the caller is not allowed to read were exposed, including their name, uri, extra and source Dag/task ids, even though GET /assets/events hides the same events. Query the consumed events through the dagrun_asset_event table and apply the same per-asset and per-source-Dag readability filters as GET /assets/events, so hidden events are excluded from both the response and total_entries. (cherry picked from commit 6f408e1) Co-authored-by: Henry Chen <henrychen@apache.org> * Mock the simple auth manager in the upstream asset events permission test (#75126) SimpleAuthManager overrides get_authorized_assets since #72934, so patching the BaseAuthManager method left the real one in place, every asset stayed readable, and the test added in #72924 failed on main. Generated-by: Claude Opus 5 (cherry picked from commit 33e6b5f) --------- Co-authored-by: Henry Chen <henrychen@apache.org> Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
…gs the caller may read (#72924) (#75108) * [v3-4-test] Scope upstream asset events of a Dag run to assets and Dags the caller may read (#72924) GET /dags/{dag_id}/dagRuns/{dag_run_id}/upstreamAssetEvents returned every asset event a run consumed as long as the caller could read the consuming Dag. Events of assets, or produced by source Dags, the caller is not allowed to read were exposed, including their name, uri, extra and source Dag/task ids, even though GET /assets/events hides the same events. Query the consumed events through the dagrun_asset_event table and apply the same per-asset and per-source-Dag readability filters as GET /assets/events, so hidden events are excluded from both the response and total_entries. (cherry picked from commit 6f408e1) Co-authored-by: Henry Chen <henrychen@apache.org> * Mock the simple auth manager in the upstream asset events permission test (#75126) SimpleAuthManager overrides get_authorized_assets since #72934, so patching the BaseAuthManager method left the real one in place, every asset stayed readable, and the test added in #72924 failed on main. Generated-by: Claude Opus 5 (cherry picked from commit 33e6b5f) --------- Co-authored-by: Henry Chen <henrychen@apache.org> Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
TestGetDagRunAssetTriggerEvents::test_returns_only_events_of_assets_the_caller_may_read, added in #72924, fails onmain: the endpoint returns all three events instead of the one on the readable asset.The test patches
BaseAuthManager.get_authorized_assets, but since #72934SimpleAuthManager(the auth manager the API test client uses) overrides that method, so the patch never takes effect and every asset stays readable. #72924's CI ran on a base without #72934. The production filter is fine; this patchesSimpleAuthManager.get_authorized_assets, as the other asset permission tests inroutes/public/test_assets.pyandroutes/ui/test_assets.pydo.TestGetDagRunAssetTriggerEvents: 13 passed (previously 1 failed onmain).Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines