Skip to content
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

Skip 'at_hash' claim validation when missing #852

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion social_core/backends/open_id_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ def validate_and_return_id_token(self, id_token, access_token):

# pyjwt does not validate OIDC claims
# see https://github.com/jpadilla/pyjwt/pull/296
if claims.get("at_hash") != self.calc_at_hash(access_token, key["alg"]):
if "at_hash" in claims and claims["at_hash"] != self.calc_at_hash(
access_token, key["alg"]
):
raise AuthTokenError(self, "Invalid access token")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, this isn't covered by the tests currently.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, there is no test where at_hash claim would be missing, so this behavior is not tested (otherwise we would see a test failure earlier).


self.validate_claims(claims)
Expand Down