Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix after bump pyjwt
Damian Wdd7645344cb3
diff --git a/requirements.txt b/requirements.txtindex 0727fa177d..a845f7919a 100644--- a/requirements.txt+++ b/requirements.txt@@ -98,7 +98,7 @@ purl==1.5pyasn1-modules==0.2.8; python_version >= "3.5" and python_full_version < "3.0.0" or python_version >= "3.5" and python_full_version >= "3.6.0"pyasn1==0.4.8; python_version >= "3.5" and python_full_version < "3.0.0" and python_version < "4" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.6.0") or python_version >= "3.5" and python_full_version >= "3.6.0" and python_version < "4" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.6.0")pycparser==2.20; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"-pyjwt==1.7.1+pyjwt==2.0.0pyphen==0.10.0; python_version >= "3.6"python-dateutil==2.8.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"python-dotenv==0.15.0diff --git a/requirements_dev.txt b/requirements_dev.txtindex 8791e9a90b..12541093d7 100644--- a/requirements_dev.txt+++ b/requirements_dev.txt@@ -137,7 +137,7 @@ pycodestyle==2.6.0; (python_version >= "2.7" and python_full_version < "3.0.0")pycparser==2.20; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"pydocstyle==5.1.1; python_version >= "3.5"pyflakes==2.2.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0"-pyjwt==1.7.1+pyjwt==2.0.0pylint-celery==0.3pylint-django==2.4.0pylint-plugin-utils==0.6diff --git a/saleor/core/jwt.py b/saleor/core/jwt.pyindex aeed424edb..9de9b32bfa 100644--- a/saleor/core/jwt.py+++ b/saleor/core/jwt.py@@ -54,14 +54,14 @@ def jwt_encode(payload: Dict[str, Any]) -> str:payload,settings.SECRET_KEY, # type: ignoreJWT_ALGORITHM,- ).decode("utf-8")+ )def jwt_decode(token: str) -> Dict[str, Any]:return jwt.decode(token,settings.SECRET_KEY, # type: ignore- algorithms=JWT_ALGORITHM,+ algorithms=[JWT_ALGORITHM],verify_expiration=settings.JWT_EXPIRE,)diff --git a/saleor/core/tests/test_auth_backend.py b/saleor/core/tests/test_auth_backend.pyindex 88116b4cbb..e19cee43ba 100644--- a/saleor/core/tests/test_auth_backend.py+++ b/saleor/core/tests/test_auth_backend.py@@ -53,7 +53,7 @@ def test_incorrect_token(rf, staff_user, settings):payload,"Wrong secret",JWT_ALGORITHM,- ).decode("utf-8")+ )request = rf.request(HTTP_AUTHORIZATION=f"JWT {token}")backend = JSONWebTokenBackend()with pytest.raises(InvalidSignatureError):diff --git a/saleor/graphql/account/mutations/jwt.py b/saleor/graphql/account/mutations/jwt.pyindex 1af709cf41..e6c49d01e5 100644--- a/saleor/graphql/account/mutations/jwt.py+++ b/saleor/graphql/account/mutations/jwt.py@@ -29,7 +29,7 @@ from ..types import Userdef get_payload(token):try:payload = jwt_decode(token)- except jwt.ExpiredSignature:+ except jwt.ExpiredSignatureError:raise ValidationError("Signature has expired", code=AccountErrorCode.JWT_SIGNATURE_EXPIRED.value)