Skip to content

Commit

Permalink
Bump PyJWT to 2.10.0 (home-assistant#130907)
Browse files Browse the repository at this point in the history
* Bump PyJWT to 2.10.0

changelog: jpadilla/pyjwt@2.9.0...2.10.0

* handle new keys

* add test to verify all default options are checked for merge
  • Loading branch information
bdraco authored Nov 19, 2024
1 parent 3a8a886 commit 8b49830
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion homeassistant/auth/jwt_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
JWT_TOKEN_CACHE_SIZE = 16
MAX_TOKEN_SIZE = 8192

_VERIFY_KEYS = ("signature", "exp", "nbf", "iat", "aud", "iss")
_VERIFY_KEYS = ("signature", "exp", "nbf", "iat", "aud", "iss", "sub", "jti")

_VERIFY_OPTIONS: dict[str, Any] = {f"verify_{key}": True for key in _VERIFY_KEYS} | {
"require": []
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/package_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ paho-mqtt==1.6.1
Pillow==11.0.0
propcache==0.2.0
psutil-home-assistant==0.0.1
PyJWT==2.9.0
PyJWT==2.10.0
pymicro-vad==1.0.1
PyNaCl==1.5.0
pyOpenSSL==24.2.1
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dependencies = [
"ifaddr==0.2.0",
"Jinja2==3.1.4",
"lru-dict==1.3.0",
"PyJWT==2.9.0",
"PyJWT==2.10.0",
# PyJWT has loose dependency. We want the latest one.
"cryptography==43.0.1",
"Pillow==11.0.0",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ home-assistant-bluetooth==1.13.0
ifaddr==0.2.0
Jinja2==3.1.4
lru-dict==1.3.0
PyJWT==2.9.0
PyJWT==2.10.0
cryptography==43.0.1
Pillow==11.0.0
propcache==0.2.0
Expand Down
6 changes: 6 additions & 0 deletions tests/auth/test_jwt_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
from homeassistant.auth import jwt_wrapper


async def test_all_default_options_are_in_verify_options() -> None:
"""Test that all default options in _VERIFY_OPTIONS."""
for option in jwt_wrapper._PyJWTWithVerify._get_default_options():
assert option in jwt_wrapper._VERIFY_OPTIONS


async def test_reject_access_token_with_impossible_large_size() -> None:
"""Test rejecting access tokens with impossible sizes."""
with pytest.raises(jwt.DecodeError):
Expand Down

0 comments on commit 8b49830

Please sign in to comment.