Skip to content

Grant Keycloak SuperAdmin access to teamless resources - #74640

Merged
vincbeck merged 1 commit into
apache:mainfrom
Ajneesh55:keycloak-superadmin-teamless-resources
Oct 14, 2026
Merged

vincbeck merged 1 commit into
apache:mainfrom
Ajneesh55:keycloak-superadmin-teamless-resources

Conversation

@Ajneesh55

Copy link
Copy Markdown
Contributor

In multi-team mode, the Keycloak auth manager docs describe SuperAdmin as the role that "grants global admin access across all teams", and the multi-team docs state that resources without a team assignment are global. However, when create-team repairs the global Admin permission (the one bound to SuperAdmin), it only keeps team-suffixed resources (Dag:<team>, Variable:<team>, ...) plus Asset, AssetAlias and Configuration.

Dags, Variables, Connections and Pools that have no team are authorized against their plain resource names (Dag, Variable, Connection, Pool), and no permission grants SuperAdmin anything but LIST on those. As a result a SuperAdmin gets 403 when reading or editing any teamless Dag, Variable, Connection or Pool.

This change keeps the plain team-scoped resource names in the repaired Admin permission, so SuperAdmin covers both team-owned and teamless resources. Existing deployments pick it up by re-running airflow keycloak-auth-manager create-team <team>, as already described in the 0.9.0 changelog note.

related: #71277

Testing

  • Unit: updated test_update_admin_permission_resources_removes_admin_role_policy, whose expected resources encoded the missing Dag entry; it fails without the change and passes with it. providers/keycloak/tests/unit/keycloak/auth_manager/cli/test_commands.py passes.

  • Manual, against Keycloak 26.0.8 with Airflow built from main, provisioned with create-all --teams team-a,team-b, create-team and add-user-to-team, then querying Keycloak with the same UMA requests KeycloakAuthManager._is_authorized sends:

    SuperAdmin request before after
    Dag:team-a#GET, Dag:team-a#PUT allowed allowed
    Dag#GET, Dag#PUT (teamless Dag) denied allowed
    Variable#GET, Variable#PUT denied allowed
    Connection#GET, Pool#GET denied allowed

    Team-role users (Admin in team-a / team-b) are unchanged by this PR: still no access to the other team's resources.

  • prek pre-commit hooks pass, except generate-openapi-spec-keycloak, which was skipped locally because it requires Breeze; this change does not touch the Keycloak API.

Not in scope

Team roles (Viewer/User/Op/Admin in a team) still only get LIST on teamless resources, so they cannot open or edit shared Dags or global Variables. That needs a decision on which team roles should read or write global resources, so it is left out of this PR.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5.5)

Generated-by: Claude Code (Opus 5.5) following the guidelines

In multi-team mode SuperAdmin is documented as the role with global admin
access across all teams, but the repaired Admin permission only covered
team-suffixed resources plus Asset, AssetAlias and Configuration. Dags,
Variables, Connections and Pools without a team assignment are checked
against their plain resource names, so a SuperAdmin received 403 when
reading or editing any of them.
@boring-cyborg

boring-cyborg Bot commented Oct 13, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@vincbeck
vincbeck merged commit 1461ddf into apache:main Oct 14, 2026
80 checks passed
@boring-cyborg

boring-cyborg Bot commented Oct 14, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants