Closed shmoon-kr closed 3 months ago
This pull request addresses a bug in the TokenType.is_expired
method by ensuring that the timestamp comparison is done between aware datetime objects. Additionally, a new RELEASE.md
file has been added to document the release type and the bug fix details.
Files | Changes |
---|---|
gqlauth/jwt/types_.py RELEASE.md |
Fixed a bug in TokenType.is_expired by ensuring aware datetime comparison and added release notes documenting the fix. |
Release type: patch
Fix issue: TokenType.is_expired() fails since it's comparing naive timestamp with aware timestamp Replace payload.exp with payload.exp.replace(tzinfo=timezone.utc) when it is compared with utc_now()
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 92.96%. Comparing base (
9c760b6
) to head (def91a6
). Report is 38 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I was wondering why did it pass test cases though there's a test case for the function and now I've got the answer. When a TokenType is generated from a user, time stamp is aware timestamp so there's no problem in is_expired() function. But when a TokenType is generated from a token, time stamp is naive timestamp and there was no test code for this case. I just added a test case and update PR.
The issue was resolved by setting JWT payload timestamp format.
Summary by Sourcery
This pull request fixes a bug in the TokenType.is_expired() method by ensuring that the payload expiration timestamp is timezone-aware before comparison. Additionally, a RELEASE.md file has been added to document the patch release and the bug fix.