Repository navigation
Validate id_token issuer and audience in the FAB Authentik provider - #72645
Merged
vincbeck merged 1 commit intoSep 9, 2026
Merged
Conversation
The authentik OAuth path decoded the id_token with no claims_options, so authlib validated only the time-based claims. The issuer and audience were never checked. A provider signs the tokens of every application registered with it using one key set, so a valid signature only establishes that the provider minted the token, not that it was minted for Airflow. A token issued for a different application registered with the same provider was therefore accepted, and authenticated its subject as an Airflow user. Pin the audience to the configured client_id and the issuer to the value advertised in the provider's OpenID metadata. When no issuer can be resolved, verification fails closed with an actionable error instead of falling back to an audience-only check: the key set may sign for more than one issuer, so an audience-only check would still accept a token from an untrusted one. Deployments whose metadata omits the issuer can set it explicitly in the provider's client_kwargs. This mirrors the claims_options already applied on the azure path in the same file. Tests cover a correctly addressed token, a token for another application, a token from another issuer, the fail-closed path asserted with a correct audience and a wrong issuer, and the configured-issuer override both accepting a valid token and rejecting a foreign issuer.
potiuk
force-pushed
the
security/fab-authentik-claims-validation
branch
from
September 7, 2026 18:24
ec1f8ae to
87f62dd
Compare
vincbeck
approved these changes
Sep 9, 2026
imrichardwu
pushed a commit
to imrichardwu/airflow
that referenced
this pull request
Sep 11, 2026
…pache#72645) The authentik OAuth path decoded the id_token with no claims_options, so authlib validated only the time-based claims. The issuer and audience were never checked. A provider signs the tokens of every application registered with it using one key set, so a valid signature only establishes that the provider minted the token, not that it was minted for Airflow. A token issued for a different application registered with the same provider was therefore accepted, and authenticated its subject as an Airflow user. Pin the audience to the configured client_id and the issuer to the value advertised in the provider's OpenID metadata. When no issuer can be resolved, verification fails closed with an actionable error instead of falling back to an audience-only check: the key set may sign for more than one issuer, so an audience-only check would still accept a token from an untrusted one. Deployments whose metadata omits the issuer can set it explicitly in the provider's client_kwargs. This mirrors the claims_options already applied on the azure path in the same file. Tests cover a correctly addressed token, a token for another application, a token from another issuer, the fail-closed path asserted with a correct audience and a wrong issuer, and the configured-issuer override both accepting a valid token and rejecting a foreign issuer.
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.
The
authentikOAuth path in the FAB auth manager decoded theid_tokenwithout any
claims_options, so authlib validated only the time-basedclaims. Neither the issuer nor the audience was checked.
A provider signs the tokens of every application registered with it using a
single key set, so a valid signature only establishes that the provider
minted the token — not that it was minted for Airflow. A token issued for a
different application registered with the same provider was accepted and
authenticated its subject as an Airflow user.
This pins:
audto the configuredclient_idissto the issuer advertised in the provider's OpenID metadataIf no issuer can be resolved, verification now fails with an actionable
error rather than falling back to an audience-only check — the configured
key set may sign for more than one issuer, so an audience-only check would
still accept a token from an untrusted one. Deployments whose metadata does
not publish an
issuercan set it explicitly in the provider'sclient_kwargs; this is documented.This mirrors the
claims_optionsalready applied on theazurepath in thesame file.
Tests
Six tests covering a correctly addressed token, a token for another
application, a token from another issuer, the fail-closed path (asserted
with a correct audience and a wrong issuer, which is the shape an
audience-only fallback would let through), and the configured-issuer
override both accepting a valid token and rejecting a foreign issuer.
The three rejection tests fail without the source change.
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code following the guidelines