Fix JWT token generation with unset issuer/audience config#61278
Fix JWT token generation with unset issuer/audience config#61278potiuk merged 2 commits intoapache:mainfrom
Conversation
|
The mypy error could be due to jpadilla/pyjwt@29fbfc3 where jpadilla/pyjwt@29fbfc3#diff-6893ad4a1c5a36b8af3028db8c8bc3b62418149843fc382faf901eaab008e380L30 jpadilla/pyjwt@29fbfc3#diff-6893ad4a1c5a36b8af3028db8c8bc3b62418149843fc382faf901eaab008e380L204 |
|
Yep its likely that. I tried to resolve it |
|
@tirkarthi do you wanna take another look now? Mypy is fixed. |
tirkarthi
left a comment
There was a problem hiding this comment.
LGTM. Thanks @amoghrajesh .
|
Nice, thanks @amoghrajesh! |
|
This needs a backport, seeing the similar issue. Will create in a moment |
apache#61278) * Fix JWT token generation with unset issuer/audience config * Fix JWT token generation with unset issuer/audience config (cherry picked from commit a440d1d) Co-authored-by: Amogh Desai <[email protected]>
#61278) (#61331) * Fix JWT token generation with unset issuer/audience config (cherry picked from commit a440d1d) Co-authored-by: Amogh Desai <[email protected]>
#61278) (#61331) * Fix JWT token generation with unset issuer/audience config (cherry picked from commit a440d1d) Co-authored-by: Amogh Desai <[email protected]>
|
cc @ephraimbuddy given rc2 we need to change milestone on this PR to 3.1.7 right? |
I have done so on the backport: #61331 |
* [v3-1-test] Add Keycloak token documentation to Security/API (#61228) (#61248) (cherry picked from commit bb04b5d) Co-authored-by: Bugra Ozturk <[email protected]> * [v3-1-test] Fix language selector state not updating on change (#61060) (#61263) (cherry picked from commit 975cfe6) * [v3-1-test] Clarify template context for asset-triggered DAGs in airflow-core docs (#61258) (#61282) (cherry picked from commit f7aa502) Co-authored-by: Rachana Dutta <[email protected]> Co-authored-by: kevinhongzl <[email protected]> * [v3-1-test] Fix flaky OTel integration test with DNS health check (#61070) (#61242) (#61286) * Fix flaky OTel integration test with DNS health check (#61070) * Update airflow-core/tests/integration/otel/test_otel.py --------- (cherry picked from commit 8ac25dd) Co-authored-by: Abhishek Mishra <[email protected]> Co-authored-by: Henry Chen <[email protected]> * [v3-1-test] Update pmc verification docs (#61271) (#61294) * Update Helm Chart release instructions for PMC Checks * Update KEY download instructions for PMC Checks * Update dev/README_RELEASE_HELM_CHART.md (cherry picked from commit c74b24a) * [v3-1-test] update version for release command (#61260) (#61328) (cherry picked from commit 7790482) Co-authored-by: Rahul Vats <[email protected]> * CI: Upgrade important CI environment (#61327) * [v3-1-test] Fix JWT token generation with unset issuer/audience config (#61278) (#61331) * Fix JWT token generation with unset issuer/audience config (cherry picked from commit a440d1d) Co-authored-by: Amogh Desai <[email protected]> * [v3-1-test] Remove empty `apache_airflow_site.py` file (#61308) (cherry picked from commit d65ff01) Co-authored-by: Jed Cunningham <[email protected]> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Bugra Ozturk <[email protected]> Co-authored-by: Guan-Ming (Wesley) Chiu <[email protected]> Co-authored-by: Shahar Epstein <[email protected]> Co-authored-by: Rachana Dutta <[email protected]> Co-authored-by: kevinhongzl <[email protected]> Co-authored-by: Abhishek Mishra <[email protected]> Co-authored-by: Henry Chen <[email protected]> Co-authored-by: Rahul Vats <[email protected]> Co-authored-by: Amogh Desai <[email protected]> Co-authored-by: Jed Cunningham <[email protected]>
Was generative AI tooling used to co-author this PR?
PyJWT released 2.11.0 https://pyjwt.readthedocs.io/en/stable/changelog.html#v2-11-0 which adds stricter validation for JWT claims.
The change: jpadilla/pyjwt#1039 and jpadilla/pyjwt#1040 ensures that the
issandaudclaims must me StringOrURI as per RFC 7519: https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1An example of earlier behaviour with 2.10.1 pyjwt
With 2.11.0 pyjwt:
Now, airflow's config parser returned
[]for unset configs whenfirst_onlywas set. This is now rejected by PyJWT as invalid claims.The fix is to return
Nonefor unset configs when single string is expected and for list values empty list is still valid -- this needs to be handled in the_conf_list_factoryas well as theJWTGeneratorto handle falsy values.{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.