-
Notifications
You must be signed in to change notification settings - Fork 16.6k
[v3-1-test] Fix JWT token generation with unset issuer/audience config #61331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking "Sign up for GitHub", you agree to our terms of service and privacy statement. We'll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bugraoz93
merged 1 commit into
apache:v3-1-test
from
bugraoz93:backport-a440d1d-v3-1-test
Feb 1, 2026
+10
-7
Merged
[v3-1-test] Fix JWT token generation with unset issuer/audience config #61331
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -124,7 +124,7 @@ dependencies = [ | |
| # Pygments 2.19.0 improperly renders .ini files with dictionaries as values | ||
| # See https://github.com/pygments/pygments/issues/2834 | ||
| "pygments>=2.0.1,!=2.19.0", | ||
| "pyjwt>=2.10.0", | ||
| "pyjwt>=2.11.0", | ||
| "python-daemon>=3.0.0", | ||
| "python-dateutil>=2.7.0", | ||
| "python-slugify>=5.0", | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -242,13 +242,13 @@ def _conf_list_factory( | |
|
|
||
|
|
||
| def _conf_list_factory(section, key, first_only: bool = False, **kwargs): | ||
| def factory() -> list[str] | str: | ||
| def factory() -> list[str] | str | None: | ||
| from airflow.configuration import conf | ||
|
|
||
| val = conf.getlist(section, key, **kwargs, suppress_warnings=True) | ||
|
|
||
| if first_only and val: | ||
| return val[0] | ||
| if first_only: | ||
| return val[0] if val else None | ||
| return val or [] | ||
|
|
||
| return factory | ||
|
|
@@ -330,7 +330,7 @@ async def avalidated_claims( | |
| key, | ||
| audience=self.audience, | ||
| issuer=self.issuer, | ||
| options={"require": self.required_claims}, | ||
| options={"require": list(self.required_claims)}, | ||
| algorithms=self.algorithm, | ||
| leeway=self.leeway, | ||
| ) | ||
|
|
@@ -446,9 +446,12 @@ def generate(self, extras: dict[str, Any] | None = None, headers: dict[str, Any] | |
| "iat": now, | ||
| } | ||
|
|
||
| if claims["iss"] is None: | ||
| # Remove iss and aud claims if they are falsy (None, [], "", etc.) | ||
| # Per RFC 7519, these are optional claims and should be omitted entirely | ||
| # rather than set to empty/invalid values: https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1 | ||
| if not claims["iss"]: | ||
| del claims["iss"] | ||
| if claims["aud"] is None: | ||
| if not claims["aud"]: | ||
| del claims["aud"] | ||
|
|
||
| if extras is not None: | ||
|
|
||
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.