Skip to content

Avoid a full asset table scan per request in simple auth manager - #72934

Open
Lee-W wants to merge 2 commits into
apache:mainfrom
astronomer:asset-auth-filter-perf
Open

Lee-W wants to merge 2 commits into
apache:mainfrom
astronomer:asset-auth-filter-perf

Conversation

@Lee-W

@Lee-W Lee-W commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Scoping asset API responses to what a user may read (#72682) gave BaseAuthManager a default that loads the id, name and uri of every asset and then asks is_authorized_asset about each row. Simple auth manager grants asset access by role alone and never inspects the asset it is asked about, so that loop re-derives a single constant answer once per row, and listing one page of assets costs time proportional to the size of the asset table rather than to the page.

The auth managers whose is_authorized_asset makes a remote call were given batched overrides at the time; simple auth manager, which is the default, was left on the generic path.


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

Generated-by: [Claude] 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 Sep 11, 2026
@Lee-W
Lee-W force-pushed the asset-auth-filter-perf branch from 0fc3dce to 4fa1cf2 Compare October 5, 2026 12:00
Lee-W added 2 commits October 6, 2026 17:13
Scoping asset API responses to what a user may read (apache#72682) gave
BaseAuthManager a default that loads the id, name and uri of every asset
and then asks is_authorized_asset about each row. Simple auth manager
grants asset access by role alone and never inspects the asset it is
asked about, so that loop re-derives a single constant answer once per
row, along with the name and uri it only loads to build the details it
then ignores.

The auth managers whose is_authorized_asset makes a remote call were
given batched overrides at the time; simple auth manager, which is the
default, was left on the generic path.
Simple auth manager now overrides get_authorized_assets, and it is the
auth manager the API tests run against. The asset route tests that
scope responses to readable assets patched the method on
BaseAuthManager, so the override bypassed the patch and the tests
stopped exercising the filtering they assert on.
@Lee-W
Lee-W force-pushed the asset-auth-filter-perf branch from 4fa1cf2 to 7b1a2c2 Compare October 6, 2026 16:13
@Lee-W
Lee-W marked this pull request as ready for review October 6, 2026 20:59
@Lee-W
Lee-W requested a review from vincbeck as a code owner October 6, 2026 20:59

@fat-catTW fat-catTW left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Awesome! lgtm

This branch has not been deployed

No deployments
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants