diff options
| author | Ankur Tyagi <ankur.tyagi85@gmail.com> | 2026-03-17 09:18:26 +1300 |
|---|---|---|
| committer | Anuj Mittal <anuj.mittal@oss.qualcomm.com> | 2026-03-26 10:29:24 +0530 |
| commit | dbde84f17b9e38d288d9918c0f41ab1e9df64e8b (patch) | |
| tree | de64794f9949f768bfcb30e2d8271197e63d69be /meta-python/recipes-devtools/python | |
| parent | f38ff6e7d0ce0583bd1e751e16974ab2d49558c6 (diff) | |
| download | meta-openembedded-dbde84f17b9e38d288d9918c0f41ab1e9df64e8b.tar.gz | |
python3-pyjwt: Fix CVE-2026-32597
Details https://nvd.nist.gov/vuln/detail/CVE-2026-32597
Backport commit[1] which fixes this vulnerability as mentioned in changelog[2]
Dropped changes to the changelog, version bump and tests during backport.
[1] https://github.com/jpadilla/pyjwt/commit/051ea341b5573fe3edcd53042f347929b92c2b92
[2] https://github.com/jpadilla/pyjwt/blob/2.12.0/CHANGELOG.rst
Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
Diffstat (limited to 'meta-python/recipes-devtools/python')
| -rw-r--r-- | meta-python/recipes-devtools/python/python3-pyjwt/CVE-2026-32597.patch | 79 | ||||
| -rw-r--r-- | meta-python/recipes-devtools/python/python3-pyjwt_2.10.1.bb | 2 |
2 files changed, 81 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-pyjwt/CVE-2026-32597.patch b/meta-python/recipes-devtools/python/python3-pyjwt/CVE-2026-32597.patch new file mode 100644 index 0000000000..7fec45e13c --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-pyjwt/CVE-2026-32597.patch | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | From c77d816548bd768df262ba0204904168584c0bd1 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Jos=C3=A9=20Padilla?= <jpadilla@webapplicate.com> | ||
| 3 | Date: Thu, 12 Mar 2026 12:46:08 -0400 | ||
| 4 | Subject: [PATCH] Merge commit from fork | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | Co-authored-by: José Padilla <jpadilla@users.noreply.github.com> | ||
| 10 | |||
| 11 | CVE: CVE-2026-32597 | ||
| 12 | Upstream-Status: Backport [https://github.com/jpadilla/pyjwt/commit/051ea341b5573fe3edcd53042f347929b92c2b92] | ||
| 13 | |||
| 14 | Dropped changes to the changelog, version bump and tests during backport. | ||
| 15 | |||
| 16 | Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com> | ||
| 17 | --- | ||
| 18 | jwt/api_jws.py | 27 +++++++++++++++++++++++++-- | ||
| 19 | 1 file changed, 25 insertions(+), 2 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/jwt/api_jws.py b/jwt/api_jws.py | ||
| 22 | index 654ee0b..db2c80f 100644 | ||
| 23 | --- a/jwt/api_jws.py | ||
| 24 | +++ b/jwt/api_jws.py | ||
| 25 | @@ -137,7 +137,7 @@ class PyJWS: | ||
| 26 | header: dict[str, Any] = {"typ": self.header_typ, "alg": algorithm_} | ||
| 27 | |||
| 28 | if headers: | ||
| 29 | - self._validate_headers(headers) | ||
| 30 | + self._validate_headers(headers, encoding=True) | ||
| 31 | header.update(headers) | ||
| 32 | |||
| 33 | if not header["typ"]: | ||
| 34 | @@ -208,6 +208,8 @@ class PyJWS: | ||
| 35 | |||
| 36 | payload, signing_input, header, signature = self._load(jwt) | ||
| 37 | |||
| 38 | + self._validate_headers(header) | ||
| 39 | + | ||
| 40 | if header.get("b64", True) is False: | ||
| 41 | if detached_payload is None: | ||
| 42 | raise DecodeError( | ||
| 43 | @@ -327,14 +329,35 @@ class PyJWS: | ||
| 44 | if not alg_obj.verify(signing_input, prepared_key, signature): | ||
| 45 | raise InvalidSignatureError("Signature verification failed") | ||
| 46 | |||
| 47 | - def _validate_headers(self, headers: dict[str, Any]) -> None: | ||
| 48 | + # Extensions that PyJWT actually understands and supports | ||
| 49 | + _supported_crit: set[str] = {"b64"} | ||
| 50 | + | ||
| 51 | + def _validate_headers( | ||
| 52 | + self, headers: dict[str, Any], *, encoding: bool = False | ||
| 53 | + ) -> None: | ||
| 54 | if "kid" in headers: | ||
| 55 | self._validate_kid(headers["kid"]) | ||
| 56 | + if not encoding and "crit" in headers: | ||
| 57 | + self._validate_crit(headers) | ||
| 58 | |||
| 59 | def _validate_kid(self, kid: Any) -> None: | ||
| 60 | if not isinstance(kid, str): | ||
| 61 | raise InvalidTokenError("Key ID header parameter must be a string") | ||
| 62 | |||
| 63 | + def _validate_crit(self, headers: dict[str, Any]) -> None: | ||
| 64 | + crit = headers["crit"] | ||
| 65 | + if not isinstance(crit, list) or len(crit) == 0: | ||
| 66 | + raise InvalidTokenError("Invalid 'crit' header: must be a non-empty list") | ||
| 67 | + for ext in crit: | ||
| 68 | + if not isinstance(ext, str): | ||
| 69 | + raise InvalidTokenError("Invalid 'crit' header: values must be strings") | ||
| 70 | + if ext not in self._supported_crit: | ||
| 71 | + raise InvalidTokenError(f"Unsupported critical extension: {ext}") | ||
| 72 | + if ext not in headers: | ||
| 73 | + raise InvalidTokenError( | ||
| 74 | + f"Critical extension '{ext}' is missing from headers" | ||
| 75 | + ) | ||
| 76 | + | ||
| 77 | |||
| 78 | _jws_global_obj = PyJWS() | ||
| 79 | encode = _jws_global_obj.encode | ||
diff --git a/meta-python/recipes-devtools/python/python3-pyjwt_2.10.1.bb b/meta-python/recipes-devtools/python/python3-pyjwt_2.10.1.bb index 3954c526f5..981f79a743 100644 --- a/meta-python/recipes-devtools/python/python3-pyjwt_2.10.1.bb +++ b/meta-python/recipes-devtools/python/python3-pyjwt_2.10.1.bb | |||
| @@ -5,6 +5,8 @@ HOMEPAGE = "https://github.com/jpadilla/pyjwt" | |||
| 5 | LICENSE = "MIT" | 5 | LICENSE = "MIT" |
| 6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=e4b56d2c9973d8cf54655555be06e551" | 6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=e4b56d2c9973d8cf54655555be06e551" |
| 7 | 7 | ||
| 8 | SRC_URI += "file://CVE-2026-32597.patch" | ||
| 9 | |||
| 8 | SRC_URI[sha256sum] = "3cc5772eb20009233caf06e9d8a0577824723b44e6648ee0a2aedb6cf9381953" | 10 | SRC_URI[sha256sum] = "3cc5772eb20009233caf06e9d8a0577824723b44e6648ee0a2aedb6cf9381953" |
| 9 | 11 | ||
| 10 | PYPI_PACKAGE = "pyjwt" | 12 | PYPI_PACKAGE = "pyjwt" |
