Skip to content

Authorize team-scoped plugin API endpoints in multi-team mode - #71919

Merged
o-nikolas merged 2 commits into
apache:mainfrom
aws-mwaa:onikolas/multi-team-plugins/fastapi-auth
Aug 25, 2026
Merged

o-nikolas merged 2 commits into
apache:mainfrom
aws-mwaa:onikolas/multi-team-plugins/fastapi-auth

Conversation

@o-nikolas

Copy link
Copy Markdown
Contributor

A plugin's team_name has so far only affected what the API returns about the plugin, not what its own endpoints allow. Because Airflow mounts plugin FastAPI apps on the shared API server and applies no authorization to them, a team-scoped plugin's endpoints were reachable by every authenticated user — so team_name.

When multi-team mode is enabled, a team-scoped plugin's app is now mounted behind a middleware that rejects users who are not authorized for that team, using the auth manager's existing team check. Requests are authenticated the same way as the core API (bearer token or session cookie), and the request's HTTP method is mapped onto Airflow's resource methods so an auth manager can grant a team read-only access if it distinguishes them. Global plugins and deployments with multi-team disabled are unaffected.

Root middlewares from a team-scoped plugin are skipped with a warning: they wrap every request to the API server, including other teams' and core routes, so they cannot be limited to one team. A team plugin that needs middleware should apply it inside its own app.


UAT testing:

Before the changes. A user could not list plugins but could still call them:

Plugin uat-team-a does not show up in the list, but endpoints from that plugin can be called

Screenshot from 2026-08-20 15-31-08

With this change they cannot list or call team plugins

Plugin uat-team-a does not show up in the list and the endpoints from that plugin cannot be called
Screenshot from 2026-08-20 15-37-26


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

  • 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.

A plugin's team_name has so far only affected what the API returns about
the plugin, not what its own endpoints allow. Because Airflow mounts plugin
FastAPI apps on the shared API server and applies no authorization to them,
a team-scoped plugin's endpoints were reachable by every authenticated user
— so team_name.

When multi-team mode is enabled, a team-scoped plugin's app is now mounted
behind a middleware that rejects users who are not authorized for that team,
using the auth manager's existing team check. Requests are authenticated the
same way as the core API (bearer token or session cookie), and the request's
HTTP method is mapped onto Airflow's resource methods so an auth manager can
grant a team read-only access if it distinguishes them. Global plugins and
deployments with multi-team disabled are unaffected.

Root middlewares from a team-scoped plugin are skipped with a warning: they
wrap every request to the API server, including other teams' and core
routes, so they cannot be limited to one team. A team plugin that needs
middleware should apply it inside its own app.
Comment thread airflow-core/src/airflow/api_fastapi/app.py Outdated
Move to walrus operator but be sure to keep None check
@o-nikolas
o-nikolas merged commit 5aeba03 into apache:main Aug 25, 2026
84 checks passed
@o-nikolas
o-nikolas deleted the onikolas/multi-team-plugins/fastapi-auth branch August 25, 2026 18:38
imrichardwu pushed a commit to imrichardwu/airflow that referenced this pull request Sep 11, 2026
…#71919)

A plugin's team_name has so far only affected what the API returns about
the plugin, not what its own endpoints allow. A team-scoped plugin's
endpoints were reachable by every authenticated user.

When multi-team mode is enabled, a team-scoped plugin's app is now mounted
behind a middleware that rejects users who are not authorized for that team,
using the auth manager's existing team check. Requests are authenticated the
same way as the core API (bearer token or session cookie). Global plugins and
deployments with multi-team disabled are unaffected.

Root middlewares from a team-scoped plugin are skipped with a warning: they
wrap every request to the API server, including other teams' and core
routes, so they cannot be limited to one team. A team plugin that needs
middleware should apply it inside its own app.
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 area:plugins

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants