Repository navigation
[19.0][IMP] auth_oidc: use PyJWT instead of python-jose - #1090
Open
SparkDrago05 wants to merge 1 commit into
Open
SparkDrago05 wants to merge 1 commit into
SparkDrago05 wants to merge 1 commit into
Conversation
python-jose is no longer maintained. PyJWT is already used by auth_jwt on older branches of this repository. The ID Token is validated as before: RS256 only, aud checked only when the claim is present, iat must be an integer but is not compared to the clock, a JWKS key that cannot be loaded stops the login, and at_hash is checked against the access token (PyJWT does not do it, so this is done here, as described in OpenID Connect Core 3.1.3.6). The tests now serve real JWKs and cover at_hash, aud, exp, iat and the algorithm check. Assisted-by: Claude Opus 5.5 Signed-off-by: SparkDrago05 <huzaifa.farooq05@gmail.com>
Contributor
|
Hi @sbidoul, |
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.
Fixes #1085.
auth_oidcnow uses PyJWT to read and check the ID Token, because python-jose is no longer maintained.The checks are the same as before:
audis checked only when the token has it;iatmust be an integer, but it is not compared to the clock;PyJWT does not check
at_hash, so the module checks it now, like python-jose did (OpenID Connect Core 3.1.3.6).The errors raised are now PyJWT errors (
jwt.InvalidTokenErrorand its subclasses) instead ofJWTError.How I checked it is the same:
get_unverified_header.subandjtiis not checked.The tests now serve real JWKs instead of PEM keys. I added tests for
at_hash,aud,exp,iatand the algorithm. All 18 tests pass on Odoo 19 with PyJWT 2.15.1.#1074 changes the same function. To make that merge easier, the algorithm list is in one place, and the
at_hashhash follows the token'salg.AI disclosure: written with Claude Code (Claude Opus 5.5); I reviewed and tested the change.