From patchwork Tue Aug 18 18:15:19 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 95618 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9646FC5DF88 for ; Tue, 18 Aug 2026 18:15:36 +0000 (UTC) Received: from alln-iport-7.cisco.com (alln-iport-7.cisco.com [173.37.142.94]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15269.1787076932678337791 for ; Tue, 18 Aug 2026 11:15:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=HRqVzg13; spf=pass (domain: cisco.com, ip: 173.37.142.94, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=17749; q=dns/txt; s=iport01; t=1787076933; x=1788286533; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tIi1ecQret2PZxj1hPykSVCVZDc9ShWXrl6glxFSiBg=; b=HRqVzg13dSbLk1kM7/GHqNh6kcNNBMN1qX8KNr20+zLJWVOUfJfVKJ/D hPxW/dsiCS7YVwJXxAUP46DnaUQi2ZJ/234cnmkGlekGES+OuJncW0tlO KFDlX4zc0jyTq5ggQRnVDkltY4/x0HMLdpMaKVv2+umGvKz8y+qqGIEod BzMr45468rT1u80eZEM9UK8sA1rd9u5Z5vI22kvjCuvP7d0vXOPkJXR4w Sf66K59DcW2WvJtq2GPBbOJMtGV/0eiyMK+2pNYCcr1o+rma6PBfOSsiz 8DuKb5OLS4P/56nsWSVex2bQ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E48zwLwpXj5jr +QhEixUaCnW0opawJrjIgVtrs0nKM+uOMYUvWttiGmES/0nWpvEBa7N4Le03h9p2ZsIRqiYP pRfMGY1BPjDS0Un1lM/BJEzmO6pl3DXeDxDo1XTrq0yi4TW5FwoieG1YIuOJLRmQ+1EhkiAg 2DqvFj3BzskLPaelWHf7SOj07qncSTTHdh6+KeD3vlyjVuew2YeBBEbWR63rOe0jma6WslDM AoT4icooK04+UCnQ9W7WAe3yENopTYVX95WVul/4waXx++MvkCSB3MPSXhKb9lOWNIKeAHGH 2Shx7vBbQGDepXPIZ5B3t94dQ+PBBU= IronPort-HdrOrdr: A9a23:3zBYhKDD+43g/3LlHely55DYdb4zR+YMi2TDGXofdfUzSL3/qy nOpoV96faaslcssR0b9OxofZPwI080lqQFhbX5Q43DYOCOggLBR+tfBMnZsljd8kbFmNK1u5 0NT0FWMqyIMbEDt7eY3CCIV/A93dKA7Kekwc3az3trUEVWTpsI1XYANu5eeXcGPjWvwvECZe Gh2vY= X-Talos-CUID: 9a23:Llv+Rmkk7ReWfJSD6a3feVWxXoTXOVHa5nfhDU2TMzw3F+K4E0epwr89lfM7zg== X-Talos-MUID: 9a23:YkoeQAxVFgJmbu3DxPRb7QKgTZqaqLW2Blgok7lFh8eBHxJoETbB126oE4Byfw== X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.25,230,1779148800"; d="scan'208";a="811108936" Received: from alln-l-core-05.cisco.com ([173.36.16.142]) by alln-iport-7.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 18 Aug 2026 18:15:31 +0000 Received: from sjc-ads-5675.cisco.com (sjc-ads-5675.cisco.com [10.28.88.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by alln-l-core-05.cisco.com (Postfix) with ESMTPS id 7C35218000221; Tue, 18 Aug 2026 18:15:31 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 1CB24CCD9B2; Tue, 18 Aug 2026 11:15:31 -0700 (PDT) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: xe-linux-external@cisco.com, Darsh Kelaiya Subject: [oe][meta-python][wrynose][PATCH 01/10] python3-aiohttp: fix CVE-2026-34993 Date: Tue, 18 Aug 2026 11:15:19 -0700 Message-Id: <20260818181528.3405276-2-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20260818181528.3405276-1-dkelaiya@cisco.com> References: <20260818181528.3405276-1-dkelaiya@cisco.com> MIME-Version: 1.0 X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-Client-TLS: ANONYMOUS;sjc-ads-5675.cisco.com [10.28.88.189];TLSv1.3;TLS_AES_256_GCM_SHA384;256 X-Outbound-SMTP-Client: 10.28.88.189, sjc-ads-5675.cisco.com X-Outbound-Node: alln-l-core-05.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 18 Aug 2026 18:15:36 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/129241 From: Darsh Kelaiya This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. [1] https://github.com/aio-libs/aiohttp/commit/dcf40f30637e8752c76781cf6703b5a236749a00 [2] https://github.com/advisories/GHSA-jg22-mg44-37j8 Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-34993.patch | 478 ++++++++++++++++++ .../python/python3-aiohttp_3.13.5.bb | 4 + 2 files changed, 482 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-34993.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-34993.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-34993.patch new file mode 100644 index 0000000000..9c430f4217 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-34993.patch @@ -0,0 +1,478 @@ +From 9a92d1c1caacbb3244526d2ef9c197978f701c76 Mon Sep 17 00:00:00 2001 +From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> +Date: Sun, 22 Feb 2026 15:53:43 +0000 +Subject: [PATCH] [PR #12091/8a631e74 backport][3.14] Restrict pickle + deserialization in CookieJar.load() (#12105) + +**This is a backport of PR #12091 as merged into master +(8a631e74c1d266499dbc6bcdbc83c60f4ea3ee3c).** + +--------- + +CVE: CVE-2026-34993 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/dcf40f30637e8752c76781cf6703b5a236749a00] + +Co-authored-by: Yuval Elbar <41901908+YuvalElbar6@users.noreply.github.com> +Co-authored-by: Sam Bull +(cherry picked from commit dcf40f30637e8752c76781cf6703b5a236749a00) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/12091.bugfix.rst | 6 ++ + aiohttp/cookiejar.py | 114 +++++++++++++++++++++- + docs/client_reference.rst | 18 +++- + docs/spelling_wordlist.txt | 7 +- + tests/conftest.py | 5 + + tests/test_cookiejar.py | 189 +++++++++++++++++++++++++++++++++++++ + 6 files changed, 331 insertions(+), 8 deletions(-) + create mode 100644 CHANGES/12091.bugfix.rst + +diff --git a/CHANGES/12091.bugfix.rst b/CHANGES/12091.bugfix.rst +new file mode 100644 +index 000000000..45ffbc355 +--- /dev/null ++++ b/CHANGES/12091.bugfix.rst +@@ -0,0 +1,6 @@ ++Switched :py:meth:`~aiohttp.CookieJar.save` to use JSON format and ++:py:meth:`~aiohttp.CookieJar.load` to try JSON first with a fallback to ++a restricted pickle unpickler that only allows cookie-related types ++(``SimpleCookie``, ``Morsel``, ``defaultdict``, etc.), preventing ++arbitrary code execution via malicious pickle payloads ++(CWE-502) -- by :user:`YuvalElbar6`. +diff --git a/aiohttp/cookiejar.py b/aiohttp/cookiejar.py +index 193648d43..757cc10e8 100644 +--- a/aiohttp/cookiejar.py ++++ b/aiohttp/cookiejar.py +@@ -4,6 +4,7 @@ import contextlib + import datetime + import heapq + import itertools ++import json + import os # noqa + import pathlib + import pickle +@@ -48,6 +49,41 @@ _MIN_SCHEDULED_COOKIE_EXPIRATION = 100 + _SIMPLE_COOKIE = SimpleCookie() + + ++class _RestrictedCookieUnpickler(pickle.Unpickler): ++ """A restricted unpickler that only allows cookie-related types. ++ ++ This prevents arbitrary code execution when loading pickled cookie data ++ from untrusted sources. Only types that are expected in a serialized ++ CookieJar are permitted. ++ ++ See: https://docs.python.org/3/library/pickle.html#restricting-globals ++ """ ++ ++ _ALLOWED_CLASSES: frozenset[tuple[str, str]] = frozenset( ++ { ++ # Core cookie types ++ ("http.cookies", "SimpleCookie"), ++ ("http.cookies", "Morsel"), ++ # Container types used by CookieJar._cookies ++ ("collections", "defaultdict"), ++ # builtins that pickle uses for reconstruction ++ ("builtins", "tuple"), ++ ("builtins", "set"), ++ ("builtins", "frozenset"), ++ ("builtins", "dict"), ++ } ++ ) ++ ++ def find_class(self, module: str, name: str) -> type: ++ if (module, name) not in self._ALLOWED_CLASSES: ++ raise pickle.UnpicklingError( ++ f"Forbidden class: {module}.{name}. " ++ "CookieJar.load() only allows cookie-related types for security. " ++ "See https://docs.python.org/3/library/pickle.html#restricting-globals" ++ ) ++ return super().find_class(module, name) # type: ignore[no-any-return] ++ ++ + class CookieJar(AbstractCookieJar): + """Implements cookie storage adhering to RFC 6265.""" + +@@ -123,14 +159,84 @@ class CookieJar(AbstractCookieJar): + return self._quote_cookie + + def save(self, file_path: PathLike) -> None: ++ """Save cookies to a file using JSON format. ++ ++ :param file_path: Path to file where cookies will be serialized, ++ :class:`str` or :class:`pathlib.Path` instance. ++ """ + file_path = pathlib.Path(file_path) +- with file_path.open(mode="wb") as f: +- pickle.dump(self._cookies, f, pickle.HIGHEST_PROTOCOL) ++ data: dict[str, dict[str, dict[str, str | bool]]] = {} ++ for (domain, path), cookie in self._cookies.items(): ++ key = f"{domain}|{path}" ++ data[key] = {} ++ for name, morsel in cookie.items(): ++ morsel_data: dict[str, str | bool] = { ++ "key": morsel.key, ++ "value": morsel.value, ++ "coded_value": morsel.coded_value, ++ } ++ # Save all morsel attributes that have values ++ for attr in morsel._reserved: # type: ignore[attr-defined] ++ attr_val = morsel[attr] ++ if attr_val: ++ morsel_data[attr] = attr_val ++ data[key][name] = morsel_data ++ with file_path.open(mode="w", encoding="utf-8") as f: ++ json.dump(data, f, indent=2) + + def load(self, file_path: PathLike) -> None: ++ """Load cookies from a file. ++ ++ Tries to load JSON format first. Falls back to loading legacy ++ pickle format (using a restricted unpickler) for backward ++ compatibility with existing cookie files. ++ ++ :param file_path: Path to file from where cookies will be ++ imported, :class:`str` or :class:`pathlib.Path` instance. ++ """ + file_path = pathlib.Path(file_path) +- with file_path.open(mode="rb") as f: +- self._cookies = pickle.load(f) ++ # Try JSON format first ++ try: ++ with file_path.open(mode="r", encoding="utf-8") as f: ++ data = json.load(f) ++ self._cookies = self._load_json_data(data) ++ except (json.JSONDecodeError, UnicodeDecodeError, ValueError): ++ # Fall back to legacy pickle format with restricted unpickler ++ with file_path.open(mode="rb") as f: ++ self._cookies = _RestrictedCookieUnpickler(f).load() ++ ++ def _load_json_data( ++ self, data: dict[str, dict[str, dict[str, str | bool]]] ++ ) -> defaultdict[tuple[str, str], SimpleCookie]: ++ """Load cookies from parsed JSON data.""" ++ cookies: defaultdict[tuple[str, str], SimpleCookie] = defaultdict(SimpleCookie) ++ for compound_key, cookie_data in data.items(): ++ domain, path = compound_key.split("|", 1) ++ key = (domain, path) ++ for name, morsel_data in cookie_data.items(): ++ morsel: Morsel[str] = Morsel() ++ morsel_key = morsel_data["key"] ++ morsel_value = morsel_data["value"] ++ morsel_coded_value = morsel_data["coded_value"] ++ # Use __setstate__ to bypass validation, same pattern ++ # used in _build_morsel and _cookie_helpers. ++ morsel.__setstate__( # type: ignore[attr-defined] ++ { ++ "key": morsel_key, ++ "value": morsel_value, ++ "coded_value": morsel_coded_value, ++ } ++ ) ++ # Restore morsel attributes ++ for attr in morsel._reserved: # type: ignore[attr-defined] ++ if attr in morsel_data and attr not in ( ++ "key", ++ "value", ++ "coded_value", ++ ): ++ morsel[attr] = morsel_data[attr] ++ cookies[key][name] = morsel ++ return cookies + + def clear(self, predicate: Optional[ClearCookiePredicate] = None) -> None: + if predicate is None: +diff --git a/docs/client_reference.rst b/docs/client_reference.rst +index a1fc98b3c..374796f40 100644 +--- a/docs/client_reference.rst ++++ b/docs/client_reference.rst +@@ -2464,16 +2464,28 @@ Utilities + + .. method:: save(file_path) + +- Write a pickled representation of cookies into the file ++ Write a JSON representation of cookies into the file + at provided path. + ++ .. versionchanged:: 3.14 ++ ++ Previously used pickle format. Now uses JSON for safe ++ serialization. ++ + :param file_path: Path to file where cookies will be serialized, + :class:`str` or :class:`pathlib.Path` instance. + + .. method:: load(file_path) + +- Load a pickled representation of cookies from the file +- at provided path. ++ Load cookies from the file at provided path. Tries JSON format ++ first, then falls back to legacy pickle format (using a restricted ++ unpickler that only allows cookie-related types) for backward ++ compatibility with existing cookie files. ++ ++ .. versionchanged:: 3.14 ++ ++ Now loads JSON format by default. Falls back to restricted ++ pickle for files saved by older versions. + + :param file_path: Path to file from where cookies will be + imported, :class:`str` or :class:`pathlib.Path` instance. +diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt +index 7dc09edb1..382ad414e 100644 +--- a/docs/spelling_wordlist.txt ++++ b/docs/spelling_wordlist.txt +@@ -98,6 +98,7 @@ deduplicate + defs + Dependabot + deprecations ++deserialization + DER + dev + Dev +@@ -210,7 +211,8 @@ Multipart + musllinux + mypy + Nagle +-Nagle’s ++Nagle's ++NFS + namedtuple + nameservers + namespace +@@ -232,6 +234,7 @@ param + params + parsers + pathlib ++payloads + peername + performant + pickleable +@@ -351,6 +354,8 @@ unhandled + unicode + unittest + Unittest ++unpickler ++untrusted + unix + unsets + unstripped +diff --git a/tests/conftest.py b/tests/conftest.py +index c299df5aa..bfaa26680 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -95,6 +95,11 @@ def blockbuster(request: pytest.FixtureRequest) -> Iterator[None]: + bb.functions[func].can_block_in( + "aiohttp/web_urldispatcher.py", "add_static" + ) ++ # save/load is not async, so we must allow this: ++ for func in ("io.TextIOWrapper.read", "io.BufferedReader.read"): ++ bb.functions[func].can_block_in("aiohttp/cookiejar.py", "load") ++ for func in ("io.TextIOWrapper.write", "io.BufferedWriter.write"): ++ bb.functions[func].can_block_in("aiohttp/cookiejar.py", "save") + # Note: coverage.py uses locking internally which can cause false positives + # in blockbuster when it instruments code. This is particularly problematic + # on Windows where it can lead to flaky test failures. +diff --git a/tests/test_cookiejar.py b/tests/test_cookiejar.py +index 17e27e8f7..694514067 100644 +--- a/tests/test_cookiejar.py ++++ b/tests/test_cookiejar.py +@@ -9,6 +9,7 @@ import sys + import unittest + from http.cookies import BaseCookie, Morsel, SimpleCookie + from operator import not_ ++from pathlib import Path + from typing import List, Set + from unittest import mock + +@@ -1621,3 +1622,191 @@ async def test_shared_cookie_with_multiple_domains() -> None: + # Verify cache is reused efficiently + assert ("", "") in jar._morsel_cache + assert "universal" in jar._morsel_cache[("", "")] ++ ++ ++# === Security tests for restricted unpickler and JSON save/load === ++ ++ ++async def test_load_rejects_malicious_pickle(tmp_path: Path) -> None: ++ """Verify CookieJar.load() blocks arbitrary code execution via pickle. ++ ++ A crafted pickle payload using os.system (or any non-cookie class) ++ must be rejected by the restricted unpickler. ++ """ ++ import os ++ ++ file_path = tmp_path / "malicious.pkl" ++ ++ class RCEPayload: ++ def __reduce__(self) -> tuple[object, ...]: ++ return (os.system, ("echo PWNED",)) ++ ++ with open(file_path, "wb") as f: ++ pickle.dump(RCEPayload(), f, pickle.HIGHEST_PROTOCOL) ++ ++ jar = CookieJar() ++ with pytest.raises(pickle.UnpicklingError, match="Forbidden class"): ++ jar.load(file_path) ++ ++ ++async def test_load_rejects_eval_payload(tmp_path: Path) -> None: ++ """Verify CookieJar.load() blocks eval-based pickle payloads.""" ++ file_path = tmp_path / "eval_payload.pkl" ++ ++ class EvalPayload: ++ def __reduce__(self) -> tuple[object, ...]: ++ return (eval, ("__import__('os').system('echo PWNED')",)) ++ ++ with open(file_path, "wb") as f: ++ pickle.dump(EvalPayload(), f, pickle.HIGHEST_PROTOCOL) ++ ++ jar = CookieJar() ++ with pytest.raises(pickle.UnpicklingError, match="Forbidden class"): ++ jar.load(file_path) ++ ++ ++async def test_load_rejects_subprocess_payload(tmp_path: Path) -> None: ++ """Verify CookieJar.load() blocks subprocess-based pickle payloads.""" ++ import subprocess ++ ++ file_path = tmp_path / "subprocess_payload.pkl" ++ ++ class SubprocessPayload: ++ def __reduce__(self) -> tuple[object, ...]: ++ return (subprocess.call, (["echo", "PWNED"],)) ++ ++ with open(file_path, "wb") as f: ++ pickle.dump(SubprocessPayload(), f, pickle.HIGHEST_PROTOCOL) ++ ++ jar = CookieJar() ++ with pytest.raises(pickle.UnpicklingError, match="Forbidden class"): ++ jar.load(file_path) ++ ++ ++async def test_load_falls_back_to_pickle( ++ tmp_path: Path, ++ cookies_to_receive: SimpleCookie, ++) -> None: ++ """Verify load() falls back to restricted pickle for legacy cookie files. ++ ++ Existing cookie files saved with older versions of aiohttp used pickle. ++ load() should detect that the file is not JSON and fall back to the ++ restricted pickle unpickler for backward compatibility. ++ """ ++ file_path = tmp_path / "legit.pkl" ++ ++ # Write a legacy pickle file directly (as old aiohttp save() would) ++ jar_save = CookieJar() ++ jar_save.update_cookies(cookies_to_receive) ++ with file_path.open(mode="wb") as f: ++ pickle.dump(jar_save._cookies, f, pickle.HIGHEST_PROTOCOL) ++ ++ jar_load = CookieJar() ++ jar_load.load(file_path=file_path) ++ ++ jar_test = SimpleCookie() ++ for cookie in jar_load: ++ jar_test[cookie.key] = cookie ++ ++ assert jar_test == cookies_to_receive ++ ++ ++async def test_save_load_json_roundtrip( ++ tmp_path: Path, ++ cookies_to_receive: SimpleCookie, ++) -> None: ++ """Verify save/load roundtrip preserves cookies via JSON format.""" ++ file_path = tmp_path / "cookies.json" ++ ++ jar_save = CookieJar() ++ jar_save.update_cookies(cookies_to_receive) ++ jar_save.save(file_path=file_path) ++ ++ jar_load = CookieJar() ++ jar_load.load(file_path=file_path) ++ ++ saved_cookies = SimpleCookie() ++ for cookie in jar_save: ++ saved_cookies[cookie.key] = cookie ++ ++ loaded_cookies = SimpleCookie() ++ for cookie in jar_load: ++ loaded_cookies[cookie.key] = cookie ++ ++ assert saved_cookies == loaded_cookies ++ ++ ++async def test_save_load_json_partitioned_cookies(tmp_path: Path) -> None: ++ """Verify save/load roundtrip works with partitioned cookies.""" ++ file_path = tmp_path / "partitioned.json" ++ ++ jar_save = CookieJar() ++ jar_save.update_cookies_from_headers( ++ ["session=cookie; Partitioned"], URL("https://example.com/") ++ ) ++ jar_save.save(file_path=file_path) ++ ++ jar_load = CookieJar() ++ jar_load.load(file_path=file_path) ++ ++ # Compare individual cookie values (same approach as test_save_load_partitioned_cookies) ++ saved = list(jar_save) ++ loaded = list(jar_load) ++ assert len(saved) == len(loaded) ++ for s, lo in zip(saved, loaded): ++ assert s.key == lo.key ++ assert s.value == lo.value ++ assert s["domain"] == lo["domain"] ++ assert s["path"] == lo["path"] ++ ++ ++async def test_json_format_is_safe(tmp_path: Path) -> None: ++ """Verify the JSON file format cannot execute code on load.""" ++ import json ++ ++ file_path = tmp_path / "safe.json" ++ ++ # Write something that might look dangerous but is just data ++ malicious_data = { ++ "evil.com|/": { ++ "session": { ++ "key": "session", ++ "value": "__import__('os').system('echo PWNED')", ++ "coded_value": "__import__('os').system('echo PWNED')", ++ } ++ } ++ } ++ with open(file_path, "w") as f: ++ json.dump(malicious_data, f) ++ ++ jar = CookieJar() ++ jar.load(file_path=file_path) ++ ++ # The "malicious" string is just a cookie value, not executed code ++ cookies = list(jar) ++ assert len(cookies) == 1 ++ assert cookies[0].value == "__import__('os').system('echo PWNED')" ++ ++ ++async def test_save_load_json_secure_cookies(tmp_path: Path) -> None: ++ """Verify save/load preserves Secure and HttpOnly flags.""" ++ file_path = tmp_path / "secure.json" ++ ++ jar_save = CookieJar() ++ jar_save.update_cookies_from_headers( ++ ["token=abc123; Secure; HttpOnly; Path=/; Domain=example.com"], ++ URL("https://example.com/"), ++ ) ++ jar_save.save(file_path=file_path) ++ ++ jar_load = CookieJar() ++ jar_load.load(file_path=file_path) ++ ++ loaded_cookies = list(jar_load) ++ assert len(loaded_cookies) == 1 ++ cookie = loaded_cookies[0] ++ assert cookie.key == "token" ++ assert cookie.value == "abc123" ++ assert cookie["secure"] is True ++ assert cookie["httponly"] is True ++ assert cookie["domain"] == "example.com" diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb index f3a0fbf557..bce27905aa 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb @@ -6,6 +6,10 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=748073912af33aa59430d3702aa32d41" SRC_URI[sha256sum] = "9d98cc980ecc96be6eb4c1994ce35d28d8b1f5e5208a23b421187d1209dbb7d1" +SRC_URI += " \ + file://CVE-2026-34993.patch \ +" + CVE_PRODUCT = "aiohttp" CVE_STATUS_GROUPS = "CVE_AIOHTTP_FIX_3_13_4" CVE_AIOHTTP_FIX_3_13_4[status] = "fixed-version: fixed in 3.13.4" From patchwork Tue Aug 18 18:15:20 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 95623 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8767C5DF8E for ; Tue, 18 Aug 2026 18:15:37 +0000 (UTC) Received: from alln-iport-4.cisco.com (alln-iport-4.cisco.com [173.37.142.91]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15268.1787076932656748628 for ; Tue, 18 Aug 2026 11:15:32 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=d9rC17yP; spf=pass (domain: cisco.com, ip: 173.37.142.91, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=3812; q=dns/txt; s=iport01; t=1787076932; x=1788286532; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/MsIKiaWmLNFEOG3neyHRSVnbrKm0HPMqMh9rmXs4rc=; b=d9rC17yPVjR72/8VB6qyV7PMAH51LPNP+9+ZuTrEeAM6G9/YFO4weF1B LbXwmJgz6bRaVijz//BvVPz/pMjKQmiGukmQEPapeaZdfuU6esKtuhecw KOIYSJsGhSK+Bs5GlWg6OXvPc6J2syIeiGRk5LqW8r1jzEdSUBHXwD3W+ 05cZlFr00DuaP2UfEvtBtlcmzNs0pSyVvpCxnoIzi+aQuDkm8zD2HhrnT vMWgQz4sE60QxSJREUaEWkVgMcibSv8+vJpsvpc34SbuHzRNVYeodNFUL Ur++wyYfsBdy9TL5q8H+srbXDJ243rNxFAaERE7/+wWwQnmnbQ4rPW8LE w==; X-CSE-ConnectionGUID: R/aRMnl4R3ujNie+VboCsw== X-CSE-MsgGUID: fvXO/oGsQJSNbbBwTytl/A== X-IPAS-Result: A0BHAgBIoIRq/5EQJK1aHgEBCxIMggULgld0XkNJlk2eG4F+DwEBAQ9EDQQBAYQ/RgKNawImNAkOAQIEAwIDAQEBAQEBAQEBAQELAQEFAQEBAgEHBYEOE4ZPDYZaAQIBAzIBGAEtEBwDAQIvKyMIGYMC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1ApNNXr7+XjpDfL03DAbv31ZSRFFG/FwWf rAoB19726StN9/YhAdcLy7VZVoBEmsl6KdgrNhWYtKIjOHhILAFugLhuHfKn/bakjDH4Vmu5 uIHZITNDTYNykdsS+D2njaL/8QhP+a7auvmeDSi11pTQ1sduVcyj0RMHfjLqWzLzM2fqbQ0/ Gnl7J6mwY= X-Talos-CUID: 9a23:KzZxx2ByRcoKdyD6ExMg/XQxHMR5SCbAzlHRLgyGA2FCU6LAHA== X-Talos-MUID: 9a23:2NqLhQ3m9jxOtqLVSDOedahD0TUj7bqeLwcKvo4/mfKiPyZaJAuMkDDwa9py X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.25,230,1779148800"; d="scan'208";a="811841390" Received: from alln-l-core-08.cisco.com ([173.36.16.145]) by alln-iport-4.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 18 Aug 2026 18:15:31 +0000 Received: from sjc-ads-5675.cisco.com (sjc-ads-5675.cisco.com [10.28.88.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by alln-l-core-08.cisco.com (Postfix) with ESMTPS id 87D2018000451; Tue, 18 Aug 2026 18:15:31 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 20847CD02B9; Tue, 18 Aug 2026 11:15:31 -0700 (PDT) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: xe-linux-external@cisco.com, Darsh Kelaiya Subject: [oe][meta-python][wrynose][PATCH 02/10] python3-aiohttp: fix CVE-2026-47265 Date: Tue, 18 Aug 2026 11:15:20 -0700 Message-Id: <20260818181528.3405276-3-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20260818181528.3405276-1-dkelaiya@cisco.com> References: <20260818181528.3405276-1-dkelaiya@cisco.com> MIME-Version: 1.0 X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-Client-TLS: ANONYMOUS;sjc-ads-5675.cisco.com [10.28.88.189];TLSv1.3;TLS_AES_256_GCM_SHA384;256 X-Outbound-SMTP-Client: 10.28.88.189, sjc-ads-5675.cisco.com X-Outbound-Node: alln-l-core-08.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 18 Aug 2026 18:15:37 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/129234 From: Darsh Kelaiya This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. [1] https://github.com/aio-libs/aiohttp/commit/f54c40851b0d6c4bbdab97ba518a223adda32478 [2] https://github.com/advisories/GHSA-hg6j-4rv6-33pg Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-47265.patch | 64 +++++++++++++++++++ .../python/python3-aiohttp_3.13.5.bb | 1 + 2 files changed, 65 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-47265.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-47265.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-47265.patch new file mode 100644 index 0000000000..98e866866b --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-47265.patch @@ -0,0 +1,64 @@ +From 54aaf333cfe59f62d01ed06c8951da268ab2fb18 Mon Sep 17 00:00:00 2001 +From: Sam Bull +Date: Tue, 19 May 2026 01:23:00 +0100 +Subject: [PATCH] Drop cookies on redirect (#12550) (#12640) + +CVE: CVE-2026-47265 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/f54c40851b0d6c4bbdab97ba518a223adda32478] + +(cherry picked from commit d57efb05f5073071ceb2d3b35d72d9d0bc4512a2) +(cherry picked from commit f54c40851b0d6c4bbdab97ba518a223adda32478) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/12540.bugfix.rst | 1 + + aiohttp/client.py | 1 + + tests/test_client_functional.py | 16 ++++++++++++++-- + 3 files changed, 16 insertions(+), 2 deletions(-) + create mode 100644 CHANGES/12540.bugfix.rst + +diff --git a/CHANGES/12540.bugfix.rst b/CHANGES/12540.bugfix.rst +new file mode 100644 +index 000000000..dfd98129e +--- /dev/null ++++ b/CHANGES/12540.bugfix.rst +@@ -0,0 +1 @@ ++Fixed per-request ``cookies`` not being dropped on cross-origin redirects -- by :user:`Dreamsorcerer`. +diff --git a/aiohttp/client.py b/aiohttp/client.py +index 5d10d3e43..0637eff6b 100644 +--- a/aiohttp/client.py ++++ b/aiohttp/client.py +@@ -892,6 +892,7 @@ class ClientSession: + + if url.origin() != redirect_origin: + auth = None ++ cookies = None + headers.pop(hdrs.AUTHORIZATION, None) + headers.pop(hdrs.COOKIE, None) + headers.pop(hdrs.PROXY_AUTHORIZATION, None) +diff --git a/tests/test_client_functional.py b/tests/test_client_functional.py +index 118ce19ca..ea31567c4 100644 +--- a/tests/test_client_functional.py ++++ b/tests/test_client_functional.py +@@ -3564,8 +3564,20 @@ async def test_auth_persist_on_redirect_to_other_host_with_global_auth( + async with aiohttp.ClientSession( + connector=connector, auth=aiohttp.BasicAuth("user", "pass") + ) as client: +- resp = await client.get(url_from) +- assert resp.status == 200 ++ async with client.get( ++ url_from, ++ headers={ ++ "Proxy-Authorization": "Basic dXNlcjpwYXNz", ++ "Cookie": "a=b", ++ }, ++ ) as resp: ++ assert resp.status == 200 ++ async with client.get( ++ url_from, ++ headers={"Proxy-Authorization": "Basic dXNlcjpwYXNz"}, ++ cookies={"a": "b"}, ++ ) as resp: ++ assert resp.status == 200 + + + async def test_drop_auth_on_redirect_to_other_host_with_global_auth_and_base_url( diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb index bce27905aa..d17043bc3e 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb @@ -8,6 +8,7 @@ SRC_URI[sha256sum] = "9d98cc980ecc96be6eb4c1994ce35d28d8b1f5e5208a23b421187d1209 SRC_URI += " \ file://CVE-2026-34993.patch \ + file://CVE-2026-47265.patch \ " CVE_PRODUCT = "aiohttp" From patchwork Tue Aug 18 18:15:21 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 95624 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEC34C5DF8D for ; Tue, 18 Aug 2026 18:15:37 +0000 (UTC) Received: from alln-iport-2.cisco.com (alln-iport-2.cisco.com [173.37.142.89]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.15139.1787076932485178118 for ; Tue, 18 Aug 2026 11:15:32 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=UVrFqAws; spf=pass (domain: cisco.com, ip: 173.37.142.89, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=4460; q=dns/txt; s=iport01; t=1787076932; x=1788286532; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YNx4hI1zFv0AajteU5N/fu4vAxmlNLMr8VPmu0Hp3ns=; b=UVrFqAwsma12zi2IHScThXKnRcYmPvtb4OPnvn2so90Xs/4oHJOAbijx rX7CI6VfLkxP6fvUimA9/PJgnSYVYELZMH3wJoVdt1h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UYCpsZOZawIxPQKqFIHvS3T vr017qw+GXU5X8FUrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQRuukoPD8fwXG8M49m/c3+d/ /0W3XC4YV9B0qQhA43xWTEAe811FfUuFLMqvRFTvOTLp3AqfUcAzN1fV29vEa4A+dxKX1gNy 79BCS9WPw+c0rfeLLKTEoGAh+wqKM3teYdasXZ6wHSBUbAtQIvIROPB4towMDUY358VW62AI ZNHL2MzNXwsYDUXUrsTIJ49keOhh2j2WzZZs1mS46Ew5gA/ySQhiOm1b4uFJoXiqcN9p3ixu Uz3+EHCEjYVN+TG8SKCykuvibqa9c/8cMdIfFGizdZtmFCVy2kZBREaWFf+rfSnh0qWX9NEN 1dS/TIjq6U3/kGnQtTxGRqirxa5UgU0Ut5UFag+rQqK0KeRu1rfDWkfRTkHY9sj3CMreQEXO payt4uBLVRSXHe9ExpxKp/8QeuOBBUo IronPort-HdrOrdr: A9a23:cjkYy64fCiGMGdo6+QPXwBDXdLJyesId70hD6qm+c3Nom6uj5q eTdZsgtCMc5Ax9ZJhko6HjBEDiewK5yXcK2+ks1N6ZNWGM0ldAbrsSiLcKqAePJ8SRzIJgPI 5bAs5D4aXLfDtHpPe/xhWkGNA9x9TC2qWpieDCi0pJd2hRGthdB8MTMHfhLqWwLzM2faYEKA == X-Talos-CUID: 9a23:YLPDGWMn4y5pO+5DaXJJrWI3AsMfTyPkj0mTem6nUjd2V+jA X-Talos-MUID: 9a23:dO4MaA7Mqaj8+yVNq+ng0v+3xoxR3Y2xJnEKtK4WnMaHDXVIIzCltTe4F9o= X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.25,230,1779148800"; d="scan'208";a="809079841" Received: from alln-l-core-04.cisco.com ([173.36.16.141]) by alln-iport-2.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 18 Aug 2026 18:15:31 +0000 Received: from sjc-ads-5675.cisco.com (sjc-ads-5675.cisco.com [10.28.88.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by alln-l-core-04.cisco.com (Postfix) with ESMTPS id 824E7180004A8; Tue, 18 Aug 2026 18:15:31 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 26753CD02BA; Tue, 18 Aug 2026 11:15:31 -0700 (PDT) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: xe-linux-external@cisco.com, Darsh Kelaiya Subject: [oe][meta-python][wrynose][PATCH 03/10] python3-aiohttp: fix CVE-2026-50269 Date: Tue, 18 Aug 2026 11:15:21 -0700 Message-Id: <20260818181528.3405276-4-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20260818181528.3405276-1-dkelaiya@cisco.com> References: <20260818181528.3405276-1-dkelaiya@cisco.com> MIME-Version: 1.0 X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-Client-TLS: ANONYMOUS;sjc-ads-5675.cisco.com [10.28.88.189];TLSv1.3;TLS_AES_256_GCM_SHA384;256 X-Outbound-SMTP-Client: 10.28.88.189, sjc-ads-5675.cisco.com X-Outbound-Node: alln-l-core-04.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 18 Aug 2026 18:15:37 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/129235 From: Darsh Kelaiya This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. [1] https://github.com/aio-libs/aiohttp/commit/bf88077ebb14f4c29924b8e8904cba20c55c28b8 [2] https://github.com/advisories/GHSA-m6qw-4cw2-hm4m Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-50269.patch | 81 +++++++++++++++++++ .../python/python3-aiohttp_3.13.5.bb | 1 + 2 files changed, 82 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-50269.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-50269.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-50269.patch new file mode 100644 index 0000000000..1bde87e4e8 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-50269.patch @@ -0,0 +1,81 @@ +From 7fb9ddce2c1a376ef46f9ec2195e5d75db60c227 Mon Sep 17 00:00:00 2001 +From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> +Date: Thu, 28 May 2026 23:57:41 +0100 +Subject: [PATCH] [PR #12719/879d48d1 backport][3.14] Reject invalid bytes in + multipart/payload headers (#12720) + +**This is a backport of PR #12719 as merged into master +(879d48d1619b9bc3662037afcb8bfa790a205e9b).** + +CVE: CVE-2026-50269 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/bf88077ebb14f4c29924b8e8904cba20c55c28b8] + +Co-authored-by: Sam Bull +(cherry picked from commit bf88077ebb14f4c29924b8e8904cba20c55c28b8) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/12706.bugfix.rst | 1 + + aiohttp/payload.py | 8 +++++--- + tests/test_payload.py | 15 +++++++++++++++ + 3 files changed, 21 insertions(+), 3 deletions(-) + create mode 100644 CHANGES/12706.bugfix.rst + +diff --git a/CHANGES/12706.bugfix.rst b/CHANGES/12706.bugfix.rst +new file mode 100644 +index 000000000..9248585f9 +--- /dev/null ++++ b/CHANGES/12706.bugfix.rst +@@ -0,0 +1 @@ ++Fixed invalid bytes being allowed in multipart/payload headers -- by :user:`Dreamsorcerer`. +diff --git a/aiohttp/payload.py b/aiohttp/payload.py +index 5b88fa094..23d127056 100644 +--- a/aiohttp/payload.py ++++ b/aiohttp/payload.py +@@ -35,6 +35,7 @@ from .helpers import ( + parse_mimetype, + sentinel, + ) ++from .http_writer import _safe_header + from .streams import StreamReader + from .typedefs import JSONEncoder, _CIMultiDict + +@@ -209,9 +210,10 @@ class Payload(ABC): + @property + def _binary_headers(self) -> bytes: + return ( +- "".join([k + ": " + v + "\r\n" for k, v in self.headers.items()]).encode( +- "utf-8" +- ) ++ "".join( ++ _safe_header(k) + ": " + _safe_header(v) + "\r\n" ++ for k, v in self.headers.items() ++ ).encode("utf-8") + + b"\r\n" + ) + +diff --git a/tests/test_payload.py b/tests/test_payload.py +index 9aa97b20d..b60aa7e7c 100644 +--- a/tests/test_payload.py ++++ b/tests/test_payload.py +@@ -101,6 +101,21 @@ def test_payload_content_type() -> None: + assert p.content_type == "application/json" + + ++@pytest.mark.parametrize("bad_byte", ("\r", "\n", "\x00")) ++def test_binary_headers_reject_injection_in_value(bad_byte: str) -> None: ++ p = Payload("test", headers={"X-Custom": f"value{bad_byte}Injected: bad"}) ++ with pytest.raises(ValueError, match="header injection"): ++ p._binary_headers ++ ++ ++@pytest.mark.parametrize("bad_byte", ("\r", "\n", "\x00")) ++def test_binary_headers_reject_injection_in_name(bad_byte: str) -> None: ++ p = Payload("test") ++ p.headers[f"X-Custom{bad_byte}Injected"] = "value" ++ with pytest.raises(ValueError, match="header injection"): ++ p._binary_headers ++ ++ + def test_bytes_payload_default_content_type() -> None: + p = payload.BytesPayload(b"data") + assert p.content_type == "application/octet-stream" diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb index d17043bc3e..33ef64a59b 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb @@ -9,6 +9,7 @@ SRC_URI[sha256sum] = "9d98cc980ecc96be6eb4c1994ce35d28d8b1f5e5208a23b421187d1209 SRC_URI += " \ file://CVE-2026-34993.patch \ file://CVE-2026-47265.patch \ + file://CVE-2026-50269.patch \ " CVE_PRODUCT = "aiohttp" From patchwork Tue Aug 18 18:15:22 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 95617 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88974C5DF86 for ; Tue, 18 Aug 2026 18:15:36 +0000 (UTC) Received: from alln-iport-7.cisco.com (alln-iport-7.cisco.com [173.37.142.94]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15269.1787076932678337791 for ; Tue, 18 Aug 2026 11:15:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=YFbYRkWz; spf=pass (domain: cisco.com, ip: 173.37.142.94, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=8074; q=dns/txt; s=iport01; t=1787076933; x=1788286533; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nMRj8H9APp/MnaAUZYPGAN1fzXsNW2/WOyMfPXETn9c=; b=YFbYRkWzMT88vInbglFMmLJlq0d1NxaprduDt67LQi2g9Pcb4GJcwM6p kJsSnwfAxOH+kPlm9SSGOgXszBgpbEfgtiVMoqGM+k+RmVTRiCRjGvcwH tVO06EKRuOHU5ugCECL+b0jrPokD4jzRwiNXA8Qmd6zBSGyM9+GUv4oW3 ZMHgoZJUW8GZHRCEwwLPLl/hpC2wxjpu/1NFc4WEZVe99vUggmDOqrw9V GvFvnI8t/Z7Qe4PfYr9pgBKOyWSNdxUd5oORKbgJlfNoFSW5/fU7nTrEM /Sk2ww3183ONw2YmCO6ZD31VkGokJqo3YLGXASF/nM0IM24q4g/G3f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wsYDUXUrsTIJ49keOhh2j2WzZZs1mS46Ew5gA/ySQhieG0aIqEIYDiqcN9j2++n 27J4ljAXy4+G8yPkGKH0VmWmbqa9c/8cMdIfFGizdZtmFCVy2kZBREaWFf+rfSnh0qWX9NEN 1dS/TIjq6U3/kGnQtTxGRqirxa5UgU0Ut5UFag+rQqK0KeRu1bfDWkfRTkHY9sj3CMreQEXO payt4uBLVRSXHe9ExpxKp/8QeuOBBUo IronPort-HdrOrdr: A9a23:1jvEwawY34io8bVT56qiKrPw9L1zdoMgy1knxilNoNJuHfBw8P re+8jzuiWUtN98YhwdcJW7Scu9qBDnhPpICPcqXYtKNTOO0ADDEGgh1/qG/9SKIUPDH4BmuZ uIWpIObuEYdWIK7vrS0U2fD8sqxsWB/eSDgOfTyGoocCRRApsQljuQzm2gYzZLrM4sP+tAKK ah X-Talos-CUID: 9a23:3VgamG8A5a9kTw+8HcaVv2oTH5F4bHTy92jBKW2bC3c0VqbNSEDFrQ== X-Talos-MUID: 9a23:7WcM8AlYcH5o/qOA64uzdnpzHeFR76uzNHlQrrEpq9ndbS5TEA2C2WE= X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.25,230,1779148800"; d="scan'208";a="811108934" Received: from alln-l-core-08.cisco.com ([173.36.16.145]) by alln-iport-7.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 18 Aug 2026 18:15:31 +0000 Received: from sjc-ads-5675.cisco.com (sjc-ads-5675.cisco.com [10.28.88.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by alln-l-core-08.cisco.com (Postfix) with ESMTPS id 8659718000207; Tue, 18 Aug 2026 18:15:31 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 2A3AECD02BB; Tue, 18 Aug 2026 11:15:31 -0700 (PDT) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: xe-linux-external@cisco.com, Darsh Kelaiya Subject: [oe][meta-python][wrynose][PATCH 04/10] python3-aiohttp: fix CVE-2026-54274 Date: Tue, 18 Aug 2026 11:15:22 -0700 Message-Id: <20260818181528.3405276-5-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20260818181528.3405276-1-dkelaiya@cisco.com> References: <20260818181528.3405276-1-dkelaiya@cisco.com> MIME-Version: 1.0 X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-Client-TLS: ANONYMOUS;sjc-ads-5675.cisco.com [10.28.88.189];TLSv1.3;TLS_AES_256_GCM_SHA384;256 X-Outbound-SMTP-Client: 10.28.88.189, sjc-ads-5675.cisco.com X-Outbound-Node: alln-l-core-08.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 18 Aug 2026 18:15:36 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/129240 From: Darsh Kelaiya This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. [1] https://github.com/aio-libs/aiohttp/commit/14b6ee851fb16ec199acb950de0c82d476799e7d [2] https://github.com/advisories/GHSA-xcgm-r5h9-7989 Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-54274.patch | 182 ++++++++++++++++++ .../python/python3-aiohttp_3.13.5.bb | 1 + 2 files changed, 183 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54274.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54274.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54274.patch new file mode 100644 index 0000000000..27a2438cc1 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54274.patch @@ -0,0 +1,182 @@ +From f971aaedd8dc9cab84f09b97a412744084115113 Mon Sep 17 00:00:00 2001 +From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> +Date: Sat, 6 Jun 2026 00:05:19 +0100 +Subject: [PATCH] [PR #12817/69344c6e backport][3.14] Improve websocket checks + (#12818) + +**This is a backport of PR #12817 as merged into master +(69344c6efa3e5dd80b1c88079fa06d4e902a3b83).** + +CVE: CVE-2026-54274 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/14b6ee851fb16ec199acb950de0c82d476799e7d] + +Co-authored-by: Sam Bull +(cherry picked from commit 14b6ee851fb16ec199acb950de0c82d476799e7d) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/12817.bugfix.rst | 1 + + aiohttp/_websocket/reader_py.py | 42 +++++++++++++------- + tests/test_websocket_parser.py | 68 +++++++++++++++++++++++++++++++++ + 3 files changed, 98 insertions(+), 13 deletions(-) + create mode 100644 CHANGES/12817.bugfix.rst + +diff --git a/CHANGES/12817.bugfix.rst b/CHANGES/12817.bugfix.rst +new file mode 100644 +index 000000000..c8a35e309 +--- /dev/null ++++ b/CHANGES/12817.bugfix.rst +@@ -0,0 +1 @@ ++Tightened up some websocket parser checks -- by :user:`Dreamsorcerer`. +diff --git a/aiohttp/_websocket/reader_py.py b/aiohttp/_websocket/reader_py.py +index 5166d7ec2..16c5f3be6 100644 +--- a/aiohttp/_websocket/reader_py.py ++++ b/aiohttp/_websocket/reader_py.py +@@ -202,12 +202,6 @@ class WebSocketReader: + if opcode != OP_CODE_CONTINUATION: + self._opcode = opcode + self._partial += payload +- if self._max_msg_size and len(self._partial) >= self._max_msg_size: +- raise WebSocketError( +- WSCloseCode.MESSAGE_TOO_BIG, +- f"Message size {len(self._partial)} " +- f"exceeds limit {self._max_msg_size}", +- ) + return + + has_partial = bool(self._partial) +@@ -230,13 +224,6 @@ class WebSocketReader: + else: + assembled_payload = payload + +- if self._max_msg_size and len(assembled_payload) >= self._max_msg_size: +- raise WebSocketError( +- WSCloseCode.MESSAGE_TOO_BIG, +- f"Message size {len(assembled_payload)} " +- f"exceeds limit {self._max_msg_size}", +- ) +- + # Decompress process must to be done after all packets + # received. + if compressed: +@@ -361,6 +348,19 @@ class WebSocketReader: + "Received frame with non-zero reserved bits", + ) + ++ if opcode not in { ++ OP_CODE_CONTINUATION, ++ OP_CODE_TEXT, ++ OP_CODE_BINARY, ++ OP_CODE_CLOSE, ++ OP_CODE_PING, ++ OP_CODE_PONG, ++ }: ++ raise WebSocketError( ++ WSCloseCode.PROTOCOL_ERROR, ++ f"Unexpected opcode={opcode!r}", ++ ) ++ + if opcode > 0x7 and fin == 0: + raise WebSocketError( + WSCloseCode.PROTOCOL_ERROR, +@@ -413,6 +413,22 @@ class WebSocketReader: + else: + self._payload_bytes_to_read = len_flag + ++ # Reject oversized data frames before buffering any payload ++ # bytes. Control frames are capped at 125 bytes (checked in ++ # READ_HEADER) so only text/binary/continuation need this. ++ if self._max_msg_size and self._frame_opcode in { ++ OP_CODE_TEXT, ++ OP_CODE_BINARY, ++ OP_CODE_CONTINUATION, ++ }: ++ projected_size = self._payload_bytes_to_read + len(self._partial) ++ if projected_size >= self._max_msg_size: ++ raise WebSocketError( ++ WSCloseCode.MESSAGE_TOO_BIG, ++ f"Message size {projected_size} " ++ f"exceeds limit {self._max_msg_size}", ++ ) ++ + self._state = READ_PAYLOAD_MASK if self._has_mask else READ_PAYLOAD + + # read payload mask +diff --git a/tests/test_websocket_parser.py b/tests/test_websocket_parser.py +index 603310958..3a283e0a3 100644 +--- a/tests/test_websocket_parser.py ++++ b/tests/test_websocket_parser.py +@@ -643,6 +643,74 @@ def test_compressed_msg_too_large(out) -> None: + assert ctx.value.code == WSCloseCode.MESSAGE_TOO_BIG + + ++@pytest.mark.parametrize("fin", (0x80, 0x00), ids=("fin", "non-fin")) ++def test_msg_too_large_at_header(out: WebSocketDataQueue, fin: int) -> None: ++ max_msg_size = 256 ++ parser = WebSocketReader(out, max_msg_size, compress=False) ++ ++ # Header alone: TEXT, 64-bit length, declares 1 MiB of payload. ++ header = PACK_LEN3(fin | WSMsgType.TEXT, 127, 1024 * 1024) ++ with pytest.raises( ++ WebSocketError, match=r"^Message size 1048576 exceeds limit 256$" ++ ) as ctx: ++ parser._feed_data(header) ++ assert ctx.value.code == WSCloseCode.MESSAGE_TOO_BIG ++ ++ ++def test_msg_too_large_across_fragments(out: WebSocketDataQueue) -> None: ++ # Individual fragments fit under max_msg_size but accumulate past it. ++ max_msg_size = 256 ++ parser = WebSocketReader(out, max_msg_size, compress=False) ++ ++ first = build_frame(b"a" * 100, WSMsgType.TEXT, is_fin=False) ++ parser._feed_data(first) ++ middle = build_frame(b"b" * 100, WSMsgType.CONTINUATION, is_fin=False) ++ parser._feed_data(middle) ++ ++ # Third 100-byte fragment would push the accumulated total to 300. ++ last = build_frame(b"c" * 100, WSMsgType.CONTINUATION, is_fin=False) ++ with pytest.raises( ++ WebSocketError, match=r"^Message size 300 exceeds limit 256$" ++ ) as ctx: ++ parser._feed_data(last) ++ assert ctx.value.code == WSCloseCode.MESSAGE_TOO_BIG ++ ++ ++def test_msg_too_large_text_after_non_fin_text(out: WebSocketDataQueue) -> None: ++ # Protocol-violating sequence: a fresh TEXT arrives while a fragmented ++ # message is still open. ++ max_msg_size = 256 ++ parser = WebSocketReader(out, max_msg_size, compress=False) ++ ++ first = build_frame(b"a" * 200, WSMsgType.TEXT, is_fin=False) ++ parser._feed_data(first) ++ ++ # Second TEXT header alone announces 100 bytes; 100 + 200 partial = 300. ++ second_header = PACK_LEN1(WSMsgType.TEXT, 100) ++ with pytest.raises( ++ WebSocketError, match=r"^Message size 300 exceeds limit 256$" ++ ) as ctx: ++ parser._feed_data(second_header) ++ assert ctx.value.code == WSCloseCode.MESSAGE_TOO_BIG ++ ++ ++@pytest.mark.parametrize( ++ "opcode", ++ (0x3, 0x4, 0x5, 0x6, 0x7, 0xB, 0xC, 0xD, 0xE, 0xF), ++ ids=lambda v: f"0x{v:x}", ++) ++def test_reserved_opcode_rejected_at_header( ++ out: WebSocketDataQueue, opcode: int ++) -> None: ++ # RFC 6455 reserves opcodes 0x3-0x7 (non-control) and 0xB-0xF (control). ++ parser = WebSocketReader(out, max_msg_size=256, compress=False) ++ ++ header = PACK_LEN3(0x80 | opcode, 127, 1024 * 1024) ++ with pytest.raises(WebSocketError, match=rf"^Unexpected opcode={opcode}$") as ctx: ++ parser._feed_data(header) ++ assert ctx.value.code == WSCloseCode.PROTOCOL_ERROR ++ ++ + class TestWebSocketError: + def test_ctor(self) -> None: + err = WebSocketError(WSCloseCode.PROTOCOL_ERROR, "Something invalid") diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb index 33ef64a59b..a40f522e4d 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb @@ -10,6 +10,7 @@ SRC_URI += " \ file://CVE-2026-34993.patch \ file://CVE-2026-47265.patch \ file://CVE-2026-50269.patch \ + file://CVE-2026-54274.patch \ " CVE_PRODUCT = "aiohttp" From patchwork Tue Aug 18 18:15:23 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 95622 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C40DC5DF8B for ; Tue, 18 Aug 2026 18:15:37 +0000 (UTC) Received: from alln-iport-2.cisco.com (alln-iport-2.cisco.com [173.37.142.89]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.15139.1787076932485178118 for ; Tue, 18 Aug 2026 11:15:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=RTFFIM3m; spf=pass (domain: cisco.com, ip: 173.37.142.89, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=5978; q=dns/txt; s=iport01; t=1787076933; x=1788286533; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zfLXM7wTd/0TsiKOHyjHFWTJAhUKIqmQyyNFHkzwayA=; b=RTFFIM3mDNoeYvT+kVurtkvNdj02KdPGzMvEP4X63V8lALmVPM2Yq4iw +/pz1kGiFOjy9ykNkZYijsB3qftz3JyBXdP72j4ME3jCc/M34Pn3nz6KP mIzMSmMRVZd5jNUrFOcGvmvy/RAr5NblObdJStAwllm/7hDUygRwfA8c9 nv4CZIs9QC18A8Am4hR14Vy4CnJQQwub4D9ZzqzIemNkWlX9Zr+ssAuxQ YAvW7DQHPCFuJiAQaoSeMCDjRkHH/+BAbARssoP0BBXpKiZNIin1ka4FM Bz7tejXGup/eMgNITAmEe0luxl67yczWaniPW9gtrrwlymCKm+aTBtdPB w==; X-CSE-ConnectionGUID: UsGMiHA5SYaOaipdqiQj9A== X-CSE-MsgGUID: 71vvEeqYSP2MbgFbIL1rqA== X-IPAS-Result: A0BIAgDJn4Rq/44QJK1aglmCV3ReQ0mWSgOeG4F+DwEBAQ9EDQQBAYQwD0YCjWsCJjQJDgECBAMCAwEBAQEBAQEBAQEBCwEBBQEBAQIBBwWBDhOGTw2GWgECAQMnCwEZLRAcAwECLysjCBmDAgGCcQMDEQPEHIF5M4EBgymBVNswAQsUAQWBM4Fzg0yIIl0YAYR8JxsbgXKBFYE7gi6BBU2BDwKBOBCGXQSCIoEMgVqRVkiBHgNZLAFVEw0KCwcFgWYDNRIqFW4yHYEjPheBDRsGBYEdgSiENyMZNnqBCV6BKyphARIXgQmCCgKCc4IGAgFJRQ4LGA1IESw3FBkEPm4H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GthdB8MTMHfhLqWwLzM2faYEKA == X-Talos-CUID: 9a23:j2HJGWH38v7uMWavqmJa72ExG+AML0bsxVDZIle0EGdQSuy8HAo= X-Talos-MUID: 9a23:eW7b8AaYdiIa7+BT6GbymhxvLfZT2/6LAk8jm7Qi4tOdHHkl X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.25,230,1779148800"; d="scan'208";a="809079855" Received: from alln-l-core-05.cisco.com ([173.36.16.142]) by alln-iport-2.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 18 Aug 2026 18:15:32 +0000 Received: from sjc-ads-5675.cisco.com (sjc-ads-5675.cisco.com [10.28.88.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by alln-l-core-05.cisco.com (Postfix) with ESMTPS id 03A66180004AA; Tue, 18 Aug 2026 18:15:32 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 2E33DCD02BC; Tue, 18 Aug 2026 11:15:31 -0700 (PDT) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: xe-linux-external@cisco.com, Darsh Kelaiya Subject: [oe][meta-python][wrynose][PATCH 05/10] python3-aiohttp: fix CVE-2026-54275 Date: Tue, 18 Aug 2026 11:15:23 -0700 Message-Id: <20260818181528.3405276-6-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20260818181528.3405276-1-dkelaiya@cisco.com> References: <20260818181528.3405276-1-dkelaiya@cisco.com> MIME-Version: 1.0 X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-Client-TLS: ANONYMOUS;sjc-ads-5675.cisco.com [10.28.88.189];TLSv1.3;TLS_AES_256_GCM_SHA384;256 X-Outbound-SMTP-Client: 10.28.88.189, sjc-ads-5675.cisco.com X-Outbound-Node: alln-l-core-05.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 18 Aug 2026 18:15:37 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/129237 From: Darsh Kelaiya This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. [1] https://github.com/aio-libs/aiohttp/commit/0ca2b6c28a25726527a8b60f25960262a91ed0e0 [2] https://github.com/advisories/GHSA-4m7w-qmgq-4wj5 Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-54275.patch | 115 ++++++++++++++++++ .../python/python3-aiohttp_3.13.5.bb | 1 + 2 files changed, 116 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54275.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54275.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54275.patch new file mode 100644 index 0000000000..f6e748b2f6 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54275.patch @@ -0,0 +1,115 @@ +From 23328dc1950071dd1e05ac6aeb631874ef94afe3 Mon Sep 17 00:00:00 2001 +From: "J. Nick Koston" +Date: Sun, 7 Jun 2026 00:30:30 -0500 +Subject: [PATCH] [PR #12835/1e94b3e8 backport][3.14] Tls server hostname pool + key (#12847) + +CVE: CVE-2026-54275 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/0ca2b6c28a25726527a8b60f25960262a91ed0e0] + +(cherry picked from commit 0ca2b6c28a25726527a8b60f25960262a91ed0e0) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/12835.bugfix.rst | 1 + + aiohttp/client_reqrep.py | 2 ++ + tests/test_client_functional.py | 31 +++++++++++++++++++++++++++++++ + tests/test_client_request.py | 16 ++++++++++++++++ + 4 files changed, 50 insertions(+) + create mode 100644 CHANGES/12835.bugfix.rst + +diff --git a/CHANGES/12835.bugfix.rst b/CHANGES/12835.bugfix.rst +new file mode 100644 +index 000000000..84a8ae006 +--- /dev/null ++++ b/CHANGES/12835.bugfix.rst +@@ -0,0 +1 @@ ++Included the per-request ``server_hostname`` override in the :class:`~aiohttp.TCPConnector` connection pool key, so a pooled TLS connection is no longer reused for a request that sets ``server_hostname`` to a different value -- by :user:`bdraco`. +diff --git a/aiohttp/client_reqrep.py b/aiohttp/client_reqrep.py +index a9e079589..5fe83fa88 100644 +--- a/aiohttp/client_reqrep.py ++++ b/aiohttp/client_reqrep.py +@@ -255,6 +255,7 @@ class ConnectionKey(NamedTuple): + proxy: Optional[URL] + proxy_auth: Optional[BasicAuth] + proxy_headers_hash: Optional[int] # hash(CIMultiDict) ++ server_hostname: str | None = None + + + def _is_expected_content_type( +@@ -964,6 +965,7 @@ class ClientRequest: + self.proxy, + self.proxy_auth, + h, ++ self.server_hostname, + ), + ) + +diff --git a/tests/test_client_functional.py b/tests/test_client_functional.py +index ea31567c4..60caf6e2a 100644 +--- a/tests/test_client_functional.py ++++ b/tests/test_client_functional.py +@@ -720,6 +720,37 @@ async def test_ssl_client( + assert txt == "Test message" + + ++async def test_server_hostname_override_not_reused( ++ aiohttp_server: AiohttpServer, ++) -> None: ++ """A pooled TLS connection must not be reused for a different server_hostname.""" ++ trustme = pytest.importorskip("trustme") ++ ++ ca = trustme.CA() ++ cert = ca.issue_cert("first.example") ++ server_ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) ++ cert.configure_cert(server_ctx) ++ client_ctx = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH) ++ ca.configure_trust(client_ctx) ++ ++ async def handler(request: web.Request) -> web.Response: ++ return web.Response(text="ok") ++ ++ app = web.Application() ++ app.router.add_route("GET", "/", handler) ++ server = await aiohttp_server(app, ssl=server_ctx) ++ url = server.make_url("/") ++ ++ connector = aiohttp.TCPConnector(ssl=client_ctx, limit=1, limit_per_host=1) ++ async with aiohttp.ClientSession(connector=connector) as session: ++ async with session.get(url, server_hostname="first.example") as resp: ++ assert resp.status == 200 ++ await resp.read() ++ ++ with pytest.raises(aiohttp.ClientConnectorCertificateError): ++ await session.get(url, server_hostname="second.example") ++ ++ + @pytest.mark.skipif( + sys.version_info < (3, 11), reason="ssl_shutdown_timeout requires Python 3.11+" + ) +diff --git a/tests/test_client_request.py b/tests/test_client_request.py +index e3cdc1c62..4c91245a5 100644 +--- a/tests/test_client_request.py ++++ b/tests/test_client_request.py +@@ -1611,6 +1611,22 @@ async def test_connection_key_without_proxy() -> None: + await req.close() + + ++async def test_connection_key_includes_server_hostname( ++ make_request: _RequestMaker, ++) -> None: ++ """A server_hostname override must be part of the connection reuse key.""" ++ url = URL("https://127.0.0.1:8443/") ++ none_req = make_request("GET", url) ++ first = make_request("GET", url, server_hostname="first.example") ++ first_again = make_request("GET", url, server_hostname="first.example") ++ second = make_request("GET", url, server_hostname="second.example") ++ ++ assert first.connection_key.server_hostname == "first.example" ++ assert first.connection_key != none_req.connection_key ++ assert first.connection_key != second.connection_key ++ assert first.connection_key == first_again.connection_key ++ ++ + def test_request_info_back_compat() -> None: + """Test RequestInfo can be created without real_url.""" + url = URL("http://example.com") diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb index a40f522e4d..c70e4d025f 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb @@ -11,6 +11,7 @@ SRC_URI += " \ file://CVE-2026-47265.patch \ file://CVE-2026-50269.patch \ file://CVE-2026-54274.patch \ + file://CVE-2026-54275.patch \ " CVE_PRODUCT = "aiohttp" From patchwork Tue Aug 18 18:15:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 95615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D36B5C5DF82 for ; Tue, 18 Aug 2026 18:15:35 +0000 (UTC) Received: from alln-iport-3.cisco.com (alln-iport-3.cisco.com [173.37.142.90]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15271.1787076933814970910 for ; Tue, 18 Aug 2026 11:15:34 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=M0+oa52w; spf=pass (domain: cisco.com, ip: 173.37.142.90, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=13577; q=dns/txt; s=iport01; t=1787076933; x=1788286533; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9j1C0MEoD6qAQi2ne/WUkGVE1aX/ioma3IqyiJhHKcs=; b=M0+oa52wxecV4MUtQ4gWKu0W4cQMMhTxIiQ7WMrqqEsm/clyqN8Ijpkt qD+eKPEs77SYLwR28cMu1I/m7W3Zlx+b4Zcsnu2E1eGFLiOg+tjdJZOF8 mZVKsJK0lA6vQivcza4p2t7hge/DfEzwCEf1EPtlyr+QB3drHtIZ7DKlF f7CZg+edo6fUv11e113wMx4F3xsiknFf1+oh9A0OYbS/EeHMVHKpsAFFk 9m2HNeiVG10amA2YtA0obT//XzB8wpMA1KHgOea6O6A4uT3TQINbkPcWe ov5pzP06HDrF9mE6u2FT69c405CbCyfkq1vBJvlgQk4MBwomeWIptdDpW g==; X-CSE-ConnectionGUID: 2LJuUFIDQ9mKqWyQbZjM9Q== X-CSE-MsgGUID: CJiMdX54Q5uQ4O9aPzFCzw== X-IPAS-Result: A0BKAgDJn4Rq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8Gaio3uUlMHkjzyuDer+E5X9rJaGmma7wXQeDhATX1a3rfS1z0KzRd9bA 0gV4TY1668q+UqmS9PwUxG1rDiDpBF0ZjZLO+Q+7AfIzu/f5ByUQzBUCDVAc9ch8sQxQFTGy 2O0oj8gPhQ32JX9dJ5X3uz8Qe+aUcTNEVI/WA== IronPort-HdrOrdr: A9a23:UPbCFKsClY9q52wi0CWg0fPJ7skDrtV00zEX/kB9WHVpmwKj+P xG+85rsiMc5wxxZJhNo7290ey7MBHhHP1OkO0s1MmZPDUO0VHAROoJ0WKh+UyEJ8SUzIBgPM lbH5SWIeeAa2SS9fyKgzWQIpIH3MSN9ryuiKP1yndgShwvVoRbhj0Jczpy1iZNNXJ77V1TLu vl2vZ6 X-Talos-CUID: 9a23:GwonYWoeqJy1hwlvZiQ1x2XmUZoBUGDg4lb8Gh69Kn9WWYSfe121qZoxxg== X-Talos-MUID: 9a23:i0CkSg8hQYLVlP2OFcl58HiQf+xK4oGiOB1RqMgbgpWjZCVIKRm2niviFw== X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.25,230,1779148800"; d="scan'208";a="827335780" Received: from alln-l-core-08.cisco.com ([173.36.16.145]) by alln-iport-3.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 18 Aug 2026 18:15:32 +0000 Received: from sjc-ads-5675.cisco.com (sjc-ads-5675.cisco.com [10.28.88.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by alln-l-core-08.cisco.com (Postfix) with ESMTPS id F096118000203; Tue, 18 Aug 2026 18:15:31 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 34B40CD02BD; Tue, 18 Aug 2026 11:15:31 -0700 (PDT) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: xe-linux-external@cisco.com, Darsh Kelaiya Subject: [oe][meta-python][wrynose][PATCH 06/10] python3-aiohttp: fix CVE-2026-54276 Date: Tue, 18 Aug 2026 11:15:24 -0700 Message-Id: <20260818181528.3405276-7-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20260818181528.3405276-1-dkelaiya@cisco.com> References: <20260818181528.3405276-1-dkelaiya@cisco.com> MIME-Version: 1.0 X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-Client-TLS: ANONYMOUS;sjc-ads-5675.cisco.com [10.28.88.189];TLSv1.3;TLS_AES_256_GCM_SHA384;256 X-Outbound-SMTP-Client: 10.28.88.189, sjc-ads-5675.cisco.com X-Outbound-Node: alln-l-core-08.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 18 Aug 2026 18:15:35 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/129243 From: Darsh Kelaiya This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. [1] https://github.com/aio-libs/aiohttp/commit/38d16060037e1bfcd6d677abababa3c2a4bb58fa [2] https://github.com/advisories/GHSA-hpj7-wq8m-9hgp Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-54276.patch | 287 ++++++++++++++++++ .../python/python3-aiohttp_3.13.5.bb | 1 + 2 files changed, 288 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54276.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54276.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54276.patch new file mode 100644 index 0000000000..7d7fc0785a --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54276.patch @@ -0,0 +1,287 @@ +From cc464f0ffe7ac8054f3992f8f53bb78b66632aca Mon Sep 17 00:00:00 2001 +From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> +Date: Sun, 7 Jun 2026 00:30:39 -0500 +Subject: [PATCH] [PR #12825/cb1d6a53 backport][3.14] Scope + DigestAuthMiddleware credentials to the request origin (#12839) + +CVE: CVE-2026-54276 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/38d16060037e1bfcd6d677abababa3c2a4bb58fa] + +Co-authored-by: J. Nick Koston +Co-authored-by: J. Nick Koston +(cherry picked from commit 38d16060037e1bfcd6d677abababa3c2a4bb58fa) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/12825.bugfix.rst | 1 + + aiohttp/client_middleware_digest_auth.py | 21 +++ + docs/client_reference.rst | 14 ++ + tests/test_client_middleware_digest_auth.py | 170 ++++++++++++++++++++ + 4 files changed, 206 insertions(+) + create mode 100644 CHANGES/12825.bugfix.rst + +diff --git a/CHANGES/12825.bugfix.rst b/CHANGES/12825.bugfix.rst +new file mode 100644 +index 000000000..88d1bfe8c +--- /dev/null ++++ b/CHANGES/12825.bugfix.rst +@@ -0,0 +1 @@ ++Scoped :class:`~aiohttp.DigestAuthMiddleware` credentials to the origin of the first request it handles, so a redirect to a different origin no longer triggers a digest response computed from the configured credentials; a challenge from another origin is only answered when that origin falls within a protection space advertised by the anchor origin through the RFC 7616 ``domain`` directive -- by :user:`bdraco`. +diff --git a/aiohttp/client_middleware_digest_auth.py b/aiohttp/client_middleware_digest_auth.py +index d7f2f1eb9..a818e57cd 100644 +--- a/aiohttp/client_middleware_digest_auth.py ++++ b/aiohttp/client_middleware_digest_auth.py +@@ -171,6 +171,15 @@ class DigestAuthMiddleware: + - Includes replay attack protection with client nonce count tracking + - Supports preemptive authentication per RFC 7616 Section 3.6 + ++ Origin scoping: ++ The credentials are scoped to the origin of the first request the ++ middleware handles. A request to a different origin is passed through ++ untouched, so it never receives a digest response computed from those ++ credentials, unless that origin falls within a protection space the ++ anchor origin advertised through the RFC 7616 ``domain`` directive. Make ++ the first request through the middleware against the intended origin, as ++ the anchor is pinned to it and not reset for the life of the instance. ++ + Standards compliance: + - RFC 7616: HTTP Digest Access Authentication (primary reference) + - RFC 2617: HTTP Authentication (deprecated by RFC 7616) +@@ -207,6 +216,8 @@ class DigestAuthMiddleware: + self._preemptive: bool = preemptive + # Set of URLs defining the protection space + self._protection_space: List[str] = [] ++ # Origin the credentials are scoped to; set on the first request. ++ self._origin: URL | None = None + + async def _encode( + self, method: str, url: URL, body: Union[Payload, Literal[b""]] +@@ -454,6 +465,16 @@ class DigestAuthMiddleware: + self, request: ClientRequest, handler: ClientHandlerType + ) -> ClientResponse: + """Run the digest auth middleware.""" ++ # Credentials are scoped to the first request's origin. Other origins ++ # pass through untouched unless a challenge from the anchor origin ++ # advertised them via RFC 7616 domain; mirrors aiohttp stripping ++ # Authorization on cross-origin redirects. ++ origin = request.url.origin() ++ if self._origin is None: ++ self._origin = origin ++ elif origin != self._origin and not self._in_protection_space(request.url): ++ return await handler(request) ++ + response = None + for retry_count in range(2): + # Apply authorization header if: +diff --git a/docs/client_reference.rst b/docs/client_reference.rst +index 374796f40..63ee375ca 100644 +--- a/docs/client_reference.rst ++++ b/docs/client_reference.rst +@@ -2367,6 +2367,16 @@ Utilities + The server may still respond with a 401 status and ``stale=true`` if the nonce + has expired, in which case the middleware will automatically retry with the new nonce. + ++ **Origin scoping** ++ ++ The credentials are scoped to the origin of the first request the middleware ++ handles. A request to a different origin is passed through untouched, so it ++ never receives a digest response computed from those credentials, unless that ++ origin falls within a protection space the anchor origin advertised through ++ the RFC 7616 ``domain`` directive. Make the first request through the ++ middleware against the intended origin, as the anchor is pinned to it and not ++ reset for the life of the instance. ++ + To disable preemptive authentication and require a 401 challenge for every request, + set ``preemptive=False``:: + +@@ -2392,6 +2402,10 @@ Utilities + .. versionadded:: 3.12 + .. versionchanged:: 3.12.8 + Added ``preemptive`` parameter to enable/disable preemptive authentication. ++ .. versionchanged:: 3.14.1 ++ Credentials are scoped to the origin of the first request the middleware ++ handles; other origins are passed through untouched unless covered by an ++ RFC 7616 ``domain`` directive from the anchor origin. + + + .. class:: CookieJar(*, unsafe=False, quote_cookie=True, treat_as_secure_origin = []) +diff --git a/tests/test_client_middleware_digest_auth.py b/tests/test_client_middleware_digest_auth.py +index 65e7d667e..03fab2691 100644 +--- a/tests/test_client_middleware_digest_auth.py ++++ b/tests/test_client_middleware_digest_auth.py +@@ -1156,6 +1156,176 @@ async def test_preemptive_auth_without_domain_uses_origin( + ) # Second request - preemptive auth (entire origin) + + ++async def test_does_not_answer_cross_origin_redirect_challenge( ++ aiohttp_server: AiohttpServer, ++) -> None: ++ """A cross-origin redirect target must not receive a digest response. ++ ++ aiohttp strips the Authorization header on cross-origin redirects; the ++ digest middleware must not re-add one for the redirect target, otherwise ++ the configured credentials leak to an origin the caller never targeted. ++ """ ++ target_auth_headers: list[str | None] = [] ++ ++ async def target_handler(request: Request) -> Response: ++ auth_header = request.headers.get(hdrs.AUTHORIZATION) ++ target_auth_headers.append(auth_header) ++ assert auth_header is None ++ return Response( ++ status=401, ++ headers={ ++ hdrs.WWW_AUTHENTICATE: 'Digest realm="evil", nonce="cross-origin"' ++ }, ++ ) ++ ++ target_app = Application() ++ target_app.router.add_get("/", target_handler) ++ target_server = await aiohttp_server(target_app) ++ ++ async def source_handler(request: Request) -> Response: ++ return Response( ++ status=302, headers={hdrs.LOCATION: str(target_server.make_url("/"))} ++ ) ++ ++ source_app = Application() ++ source_app.router.add_get("/", source_handler) ++ source_server = await aiohttp_server(source_app) ++ ++ digest_auth = DigestAuthMiddleware("victim", "secret") ++ async with ( ++ ClientSession(middlewares=(digest_auth,)) as session, ++ session.get(source_server.make_url("/")) as response, ++ ): ++ await response.text() ++ ++ assert target_auth_headers == [None] ++ ++ ++async def test_answers_same_origin_redirect_challenge( ++ aiohttp_server: AiohttpServer, ++) -> None: ++ """A same-origin redirect that issues a challenge must still authenticate.""" ++ auth_headers: list[str | None] = [] ++ ++ async def handler(request: Request) -> Response: ++ if request.path == "/start": ++ return Response(status=302, headers={hdrs.LOCATION: "/protected"}) ++ auth_header = request.headers.get(hdrs.AUTHORIZATION) ++ auth_headers.append(auth_header) ++ if auth_header is None: ++ return Response( ++ status=401, ++ headers={hdrs.WWW_AUTHENTICATE: 'Digest realm="good", nonce="abc"'}, ++ ) ++ return Response(text="OK") ++ ++ app = Application() ++ app.router.add_get("/start", handler) ++ app.router.add_get("/protected", handler) ++ server = await aiohttp_server(app) ++ ++ digest_auth = DigestAuthMiddleware("user", "pass") ++ async with ( ++ ClientSession(middlewares=(digest_auth,)) as session, ++ session.get(server.make_url("/start")) as response, ++ ): ++ assert response.status == 200 ++ assert await response.text() == "OK" ++ ++ assert auth_headers[0] is None ++ assert auth_headers[1] is not None ++ assert auth_headers[1].startswith("Digest") ++ ++ ++async def test_answers_cross_origin_within_domain_protection_space( ++ aiohttp_server: AiohttpServer, ++) -> None: ++ """A different origin advertised via the ``domain`` directive is honored. ++ ++ RFC 7616 allows a challenge to define a protection space spanning other ++ servers through the ``domain`` directive. The anchor origin vouches for ++ those URIs, so preemptive auth to them is expected. ++ """ ++ other_auth_headers: list[str | None] = [] ++ ++ async def other_handler(request: Request) -> Response: ++ other_auth_headers.append(request.headers.get(hdrs.AUTHORIZATION)) ++ return Response(text="other") ++ ++ other_app = Application() ++ other_app.router.add_get("/", other_handler) ++ other_server = await aiohttp_server(other_app) ++ other_origin = str(other_server.make_url("/").origin()) ++ ++ async def anchor_handler(request: Request) -> Response: ++ if request.headers.get(hdrs.AUTHORIZATION) is None: ++ challenge = f'Digest realm="anchor", nonce="n1", domain="{other_origin}/"' ++ return Response(status=401, headers={hdrs.WWW_AUTHENTICATE: challenge}) ++ return Response(text="anchor") ++ ++ anchor_app = Application() ++ anchor_app.router.add_get("/", anchor_handler) ++ anchor_server = await aiohttp_server(anchor_app) ++ ++ digest_auth = DigestAuthMiddleware("user", "pass") ++ async with ClientSession(middlewares=(digest_auth,)) as session: ++ async with session.get(anchor_server.make_url("/")) as response: ++ assert response.status == 200 ++ async with session.get(other_server.make_url("/")) as response: ++ assert response.status == 200 ++ ++ assert other_auth_headers[0] is not None ++ assert other_auth_headers[0].startswith("Digest") ++ ++ ++async def test_does_not_answer_cross_origin_challenge_without_redirect( ++ aiohttp_server: AiohttpServer, ++) -> None: ++ """Origin scoping applies to any cross-origin request, not just redirects. ++ ++ After authenticating against the anchor origin, a direct request to a ++ different origin that issues its own challenge must not be answered with a ++ digest response computed from the configured credentials. ++ """ ++ other_auth_headers: list[str | None] = [] ++ ++ async def other_handler(request: Request) -> Response: ++ auth_header = request.headers.get(hdrs.AUTHORIZATION) ++ other_auth_headers.append(auth_header) ++ assert auth_header is None ++ return Response( ++ status=401, ++ headers={hdrs.WWW_AUTHENTICATE: 'Digest realm="evil", nonce="x"'}, ++ ) ++ ++ other_app = Application() ++ other_app.router.add_get("/", other_handler) ++ other_server = await aiohttp_server(other_app) ++ ++ async def anchor_handler(request: Request) -> Response: ++ if request.headers.get(hdrs.AUTHORIZATION) is None: ++ return Response( ++ status=401, ++ headers={hdrs.WWW_AUTHENTICATE: 'Digest realm="anchor", nonce="n1"'}, ++ ) ++ return Response(text="anchor") ++ ++ anchor_app = Application() ++ anchor_app.router.add_get("/", anchor_handler) ++ anchor_server = await aiohttp_server(anchor_app) ++ ++ digest_auth = DigestAuthMiddleware("user", "pass") ++ async with ClientSession(middlewares=(digest_auth,)) as session: ++ async with session.get(anchor_server.make_url("/")) as response: ++ assert response.status == 200 ++ async with session.get(other_server.make_url("/")) as response: ++ assert response.status == 401 ++ ++ # The other origin only ever saw the unauthenticated request; the ++ # middleware never answered its challenge. ++ assert other_auth_headers == [None] ++ ++ + @pytest.mark.parametrize( + ("status", "headers", "expected"), + [ diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb index c70e4d025f..3c07933200 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb @@ -12,6 +12,7 @@ SRC_URI += " \ file://CVE-2026-50269.patch \ file://CVE-2026-54274.patch \ file://CVE-2026-54275.patch \ + file://CVE-2026-54276.patch \ " CVE_PRODUCT = "aiohttp" From patchwork Tue Aug 18 18:15:25 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 95619 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E412BC5DF81 for ; Tue, 18 Aug 2026 18:15:35 +0000 (UTC) Received: from alln-iport-7.cisco.com (alln-iport-7.cisco.com [173.37.142.94]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15269.1787076932678337791 for ; Tue, 18 Aug 2026 11:15:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=RAoE9977; spf=pass (domain: cisco.com, ip: 173.37.142.94, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=13606; q=dns/txt; s=iport01; t=1787076933; x=1788286533; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Zoaup8cpMWLANorYOCcsY/i0tfPtLcfqVXEHNbSL2Z4=; b=RAoE9977rw2sMaq5q3b2Kgh0L3cbegQXToHwlo2JZKVHscaS+yfTe4i4 SZE1FXneOii7fQ9OPcqx5OtqTL+u319mMWay9LvF0O4I9mW23Vb40QBGL cf1/73ayU0KwquYsqsfMQcFkrtSc2fS8yj+RAMzS31QM8OAE/gTrk8L6c oYsHe8yd72sj25tmCI3pWLja2ddUCA4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eJ OJl7vRcQS9xVkHFdX90vxNwS0mSNoUekFPLzOTWXcG7lyX7n3XQL/pGBWMvZ7Ig9PZLW3xL7 /UjKmsUbSGpvrfjqF67YrEEasULJc3vOsYb/3pn1zycVKxgSpHYSKKM7thdtNsyrpkRRrCFO YxAN3w2MEWojx5nYj/7DLoyn+qsj3juehVTqUmeouw85G27IAlZgOG0aYKFK4DVLSlTthm3t HrdzV2hPiNAbNqOwxCGwFnywdaayEsXX6pXTtVU7MVCh0WewGEWAhAaWVa35PW0lEO6c9ZeM FAPvC02oK4/8UamQtXwU1u/unHsg/IHc9NUF+t/7ESGzbDZpl/DQGMFVTVGLtchsafaWAAX6 7NApPuxbRQHjVFfYSj1Gmu8xd9qBRUoEA== IronPort-HdrOrdr: A9a23:dnXh86pim1GLDp4hzh0Nm+caV5r1eYIsimQD101hICG9vPb2qy nIpoV86faUskd3ZJhOo7G90cW7LE80sKQFg7X5Xo3SODUOxlHJEGgK1+KLqFfd8m/Fh4tgPM xbHZSWZuedMbFSt7eC3ODBKadC/PC3tIa1mOzZ03BhCStua61m8kNFLzzzKDwPeOGDbqBJbq Z1IaF81kGdRUg= X-Talos-CUID: 9a23:E0mXOWhbXVvW4pbU+6zc4B6iGTJue1/ElkjoLV+EU3tsUrSuSwSJ+5JOqp87 X-Talos-MUID: 9a23:/8JazASha1DVhvHARXSzqyN6L/VRu5icUhgLgJ8suPuva2tJbmI= X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.25,230,1779148800"; d="scan'208";a="811108947" Received: from alln-l-core-12.cisco.com ([173.36.16.149]) by alln-iport-7.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 18 Aug 2026 18:15:32 +0000 Received: from sjc-ads-5675.cisco.com (sjc-ads-5675.cisco.com [10.28.88.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by alln-l-core-12.cisco.com (Postfix) with ESMTPS id F13E818000159; Tue, 18 Aug 2026 18:15:31 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 38103CD02BE; Tue, 18 Aug 2026 11:15:31 -0700 (PDT) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: xe-linux-external@cisco.com, Darsh Kelaiya Subject: [oe][meta-python][wrynose][PATCH 07/10] python3-aiohttp: fix CVE-2026-54277 Date: Tue, 18 Aug 2026 11:15:25 -0700 Message-Id: <20260818181528.3405276-8-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20260818181528.3405276-1-dkelaiya@cisco.com> References: <20260818181528.3405276-1-dkelaiya@cisco.com> MIME-Version: 1.0 X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-Client-TLS: ANONYMOUS;sjc-ads-5675.cisco.com [10.28.88.189];TLSv1.3;TLS_AES_256_GCM_SHA384;256 X-Outbound-SMTP-Client: 10.28.88.189, sjc-ads-5675.cisco.com X-Outbound-Node: alln-l-core-12.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 18 Aug 2026 18:15:35 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/129242 From: Darsh Kelaiya This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. [1] https://github.com/aio-libs/aiohttp/commit/5ab61bb4cd88f19b712f12c7c9295fe262bf804d [2] https://github.com/advisories/GHSA-63hw-fmq6-xxg2 Signed-off-by: Darsh Kelaiya --- Changes in v2 - Added the corresponding generated aiohttp/_http_parser.c changes. - Updated cb_on_url() and cb_on_status() in the generated C parser to enforce max_line_size against the accumulated parser buffer. - Ensured the security fix is included when Wrynose builds the generated C parser without regenerating it from the patched .pyx. - Documented the Wrynose-specific backport changes in the patch metadata. --- .../python3-aiohttp/CVE-2026-54277.patch | 249 ++++++++++++++++++ .../python/python3-aiohttp_3.13.5.bb | 1 + 2 files changed, 250 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54277.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54277.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54277.patch new file mode 100644 index 0000000000..db50155d33 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54277.patch @@ -0,0 +1,249 @@ +From f61e8949f10a0e77ceba28a6639627e6e57bf167 Mon Sep 17 00:00:00 2001 +From: "J. Nick Koston" +Date: Sun, 7 Jun 2026 00:33:03 -0500 +Subject: [PATCH] [PR #12826/36df6c13 backport][3.14] Enforce max_line_size on + fragmented request target and reason in C parser (#12837) + +CVE: CVE-2026-54277 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/5ab61bb4cd88f19b712f12c7c9295fe262bf804d] + +Backport Changes: +- Added aiohttp/_http_parser.c because Wrynose builds the + pre-generated C parser without running Cython. +- Updated cb_on_url() and cb_on_status() to enforce max_line_size + against the accumulated parser buffer. + +(cherry picked from commit 5ab61bb4cd88f19b712f12c7c9295fe262bf804d) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/12826.bugfix.rst | 1 + + aiohttp/_http_parser.c | 36 ++++++++++++++++++------------------ + aiohttp/_http_parser.pyx | 4 ++-- + tests/test_http_parser.py | 22 ++++++++++++++++++++++ + 4 files changed, 43 insertions(+), 20 deletions(-) + create mode 100644 CHANGES/12826.bugfix.rst + +diff --git a/CHANGES/12826.bugfix.rst b/CHANGES/12826.bugfix.rst +new file mode 100644 +index 000000000..7e095615d +--- /dev/null ++++ b/CHANGES/12826.bugfix.rst +@@ -0,0 +1 @@ ++Fixed the C HTTP parser not enforcing ``max_line_size`` on a request target or response reason phrase that is split across multiple reads; each fragment was checked on its own, so an accumulated line could exceed the limit without raising ``LineTooLong``. The accumulated length is now checked, matching the pure-Python parser -- by :user:`bdraco`. +diff --git a/aiohttp/_http_parser.c b/aiohttp/_http_parser.c +index 911c9aa65..14c5b3350 100644 +--- a/aiohttp/_http_parser.c ++++ b/aiohttp/_http_parser.c +@@ -14760,7 +14760,7 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_url(llhttp_t *__pyx_v_parser, c + * const char *at, size_t length) except -1: + * cdef HttpParser pyparser = parser.data # <<<<<<<<<<<<<< + * try: +- * if length > pyparser._max_line_size: ++ * if len(pyparser._buf) + length > pyparser._max_line_size: + */ + __pyx_t_1 = ((PyObject *)__pyx_v_parser->data); + __Pyx_INCREF(__pyx_t_1); +@@ -14771,7 +14771,7 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_url(llhttp_t *__pyx_v_parser, c + * const char *at, size_t length) except -1: + * cdef HttpParser pyparser = parser.data + * try: # <<<<<<<<<<<<<< +- * if length > pyparser._max_line_size: ++ * if len(pyparser._buf) + length > pyparser._max_line_size: + * status = pyparser._buf + at[:length] + */ + { +@@ -14786,16 +14786,16 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_url(llhttp_t *__pyx_v_parser, c + /* "aiohttp/_http_parser.pyx":721 + * cdef HttpParser pyparser = parser.data + * try: +- * if length > pyparser._max_line_size: # <<<<<<<<<<<<<< ++ * if len(pyparser._buf) + length > pyparser._max_line_size: # <<<<<<<<<<<<<< + * status = pyparser._buf + at[:length] + * raise LineTooLong(status[:100] + b"...", pyparser._max_line_size) + */ +- __pyx_t_5 = (__pyx_v_length > __pyx_v_pyparser->_max_line_size); ++ __pyx_t_5 = ((__Pyx_PyByteArray_GET_SIZE(__pyx_v_pyparser->_buf) + __pyx_v_length) > __pyx_v_pyparser->_max_line_size); + if (unlikely(__pyx_t_5)) { + + /* "aiohttp/_http_parser.pyx":722 + * try: +- * if length > pyparser._max_line_size: ++ * if len(pyparser._buf) + length > pyparser._max_line_size: + * status = pyparser._buf + at[:length] # <<<<<<<<<<<<<< + * raise LineTooLong(status[:100] + b"...", pyparser._max_line_size) + * extend(pyparser._buf, at, length) +@@ -14809,7 +14809,7 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_url(llhttp_t *__pyx_v_parser, c + __pyx_t_6 = 0; + + /* "aiohttp/_http_parser.pyx":723 +- * if length > pyparser._max_line_size: ++ * if len(pyparser._buf) + length > pyparser._max_line_size: + * status = pyparser._buf + at[:length] + * raise LineTooLong(status[:100] + b"...", pyparser._max_line_size) # <<<<<<<<<<<<<< + * extend(pyparser._buf, at, length) +@@ -14854,7 +14854,7 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_url(llhttp_t *__pyx_v_parser, c + /* "aiohttp/_http_parser.pyx":721 + * cdef HttpParser pyparser = parser.data + * try: +- * if length > pyparser._max_line_size: # <<<<<<<<<<<<<< ++ * if len(pyparser._buf) + length > pyparser._max_line_size: # <<<<<<<<<<<<<< + * status = pyparser._buf + at[:length] + * raise LineTooLong(status[:100] + b"...", pyparser._max_line_size) + */ +@@ -14878,7 +14878,7 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_url(llhttp_t *__pyx_v_parser, c + * const char *at, size_t length) except -1: + * cdef HttpParser pyparser = parser.data + * try: # <<<<<<<<<<<<<< +- * if length > pyparser._max_line_size: ++ * if len(pyparser._buf) + length > pyparser._max_line_size: + * status = pyparser._buf + at[:length] + */ + } +@@ -14968,7 +14968,7 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_url(llhttp_t *__pyx_v_parser, c + * const char *at, size_t length) except -1: + * cdef HttpParser pyparser = parser.data + * try: # <<<<<<<<<<<<<< +- * if length > pyparser._max_line_size: ++ * if len(pyparser._buf) + length > pyparser._max_line_size: + * status = pyparser._buf + at[:length] + */ + __pyx_L5_except_error:; +@@ -15045,7 +15045,7 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_status(llhttp_t *__pyx_v_parser + * const char *at, size_t length) except -1: + * cdef HttpParser pyparser = parser.data # <<<<<<<<<<<<<< + * try: +- * if length > pyparser._max_line_size: ++ * if len(pyparser._buf) + length > pyparser._max_line_size: + */ + __pyx_t_1 = ((PyObject *)__pyx_v_parser->data); + __Pyx_INCREF(__pyx_t_1); +@@ -15056,7 +15056,7 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_status(llhttp_t *__pyx_v_parser + * const char *at, size_t length) except -1: + * cdef HttpParser pyparser = parser.data + * try: # <<<<<<<<<<<<<< +- * if length > pyparser._max_line_size: ++ * if len(pyparser._buf) + length > pyparser._max_line_size: + * reason = pyparser._buf + at[:length] + */ + { +@@ -15071,16 +15071,16 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_status(llhttp_t *__pyx_v_parser + /* "aiohttp/_http_parser.pyx":736 + * cdef HttpParser pyparser = parser.data + * try: +- * if length > pyparser._max_line_size: # <<<<<<<<<<<<<< ++ * if len(pyparser._buf) + length > pyparser._max_line_size: # <<<<<<<<<<<<<< + * reason = pyparser._buf + at[:length] + * raise LineTooLong(reason[:100] + b"...", pyparser._max_line_size) + */ +- __pyx_t_5 = (__pyx_v_length > __pyx_v_pyparser->_max_line_size); ++ __pyx_t_5 = ((__Pyx_PyByteArray_GET_SIZE(__pyx_v_pyparser->_buf) + __pyx_v_length) > __pyx_v_pyparser->_max_line_size); + if (unlikely(__pyx_t_5)) { + + /* "aiohttp/_http_parser.pyx":737 + * try: +- * if length > pyparser._max_line_size: ++ * if len(pyparser._buf) + length > pyparser._max_line_size: + * reason = pyparser._buf + at[:length] # <<<<<<<<<<<<<< + * raise LineTooLong(reason[:100] + b"...", pyparser._max_line_size) + * extend(pyparser._buf, at, length) +@@ -15094,7 +15094,7 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_status(llhttp_t *__pyx_v_parser + __pyx_t_6 = 0; + + /* "aiohttp/_http_parser.pyx":738 +- * if length > pyparser._max_line_size: ++ * if len(pyparser._buf) + length > pyparser._max_line_size: + * reason = pyparser._buf + at[:length] + * raise LineTooLong(reason[:100] + b"...", pyparser._max_line_size) # <<<<<<<<<<<<<< + * extend(pyparser._buf, at, length) +@@ -15139,7 +15139,7 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_status(llhttp_t *__pyx_v_parser + /* "aiohttp/_http_parser.pyx":736 + * cdef HttpParser pyparser = parser.data + * try: +- * if length > pyparser._max_line_size: # <<<<<<<<<<<<<< ++ * if len(pyparser._buf) + length > pyparser._max_line_size: # <<<<<<<<<<<<<< + * reason = pyparser._buf + at[:length] + * raise LineTooLong(reason[:100] + b"...", pyparser._max_line_size) + */ +@@ -15163,7 +15163,7 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_status(llhttp_t *__pyx_v_parser + * const char *at, size_t length) except -1: + * cdef HttpParser pyparser = parser.data + * try: # <<<<<<<<<<<<<< +- * if length > pyparser._max_line_size: ++ * if len(pyparser._buf) + length > pyparser._max_line_size: + * reason = pyparser._buf + at[:length] + */ + } +@@ -15253,7 +15253,7 @@ static int __pyx_f_7aiohttp_12_http_parser_cb_on_status(llhttp_t *__pyx_v_parser + * const char *at, size_t length) except -1: + * cdef HttpParser pyparser = parser.data + * try: # <<<<<<<<<<<<<< +- * if length > pyparser._max_line_size: ++ * if len(pyparser._buf) + length > pyparser._max_line_size: + * reason = pyparser._buf + at[:length] + */ + __pyx_L5_except_error:; +diff --git a/aiohttp/_http_parser.pyx b/aiohttp/_http_parser.pyx +index 5da835bc6..e1edee310 100644 +--- a/aiohttp/_http_parser.pyx ++++ b/aiohttp/_http_parser.pyx +@@ -718,7 +718,7 @@ cdef int cb_on_url(cparser.llhttp_t* parser, + const char *at, size_t length) except -1: + cdef HttpParser pyparser = parser.data + try: +- if length > pyparser._max_line_size: ++ if len(pyparser._buf) + length > pyparser._max_line_size: + status = pyparser._buf + at[:length] + raise LineTooLong(status[:100] + b"...", pyparser._max_line_size) + extend(pyparser._buf, at, length) +@@ -733,7 +733,7 @@ cdef int cb_on_status(cparser.llhttp_t* parser, + const char *at, size_t length) except -1: + cdef HttpParser pyparser = parser.data + try: +- if length > pyparser._max_line_size: ++ if len(pyparser._buf) + length > pyparser._max_line_size: + reason = pyparser._buf + at[:length] + raise LineTooLong(reason[:100] + b"...", pyparser._max_line_size) + extend(pyparser._buf, at, length) +diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py +index 25604dbcc..8cb591f20 100644 +--- a/tests/test_http_parser.py ++++ b/tests/test_http_parser.py +@@ -1272,6 +1272,17 @@ def test_http_request_max_status_line_under_limit(parser: HttpRequestParser) -> + assert msg.url == URL("/path" + path.decode()) + + ++def test_http_request_max_status_line_fragmented( ++ parser: HttpRequestParser, ++) -> None: ++ # Split an overlong request target across reads so that each callback ++ # fragment is under the limit but the accumulated target is not. ++ match = "400, message:\n Got more than 8190 bytes when reading" ++ with pytest.raises(http_exceptions.LineTooLong, match=match): ++ parser.feed_data(b"GET /" + b"a" * 8000) ++ parser.feed_data(b"a" * 8000 + b" HTTP/1.1\r\nHost: a\r\n\r\n") ++ ++ + def test_http_response_parser_utf8(response) -> None: + text = "HTTP/1.1 200 Ok\r\nx-test:тест\r\n\r\n".encode() + +@@ -1349,6 +1360,17 @@ def test_http_response_parser_status_line_under_limit( + assert msg.reason == reason.decode() + + ++def test_http_response_parser_status_line_too_long_fragmented( ++ response: HttpResponseParser, ++) -> None: ++ # Split an overlong reason phrase across reads so that each callback ++ # fragment is under the limit but the accumulated reason is not. ++ match = "400, message:\n Got more than 8190 bytes when reading" ++ with pytest.raises(http_exceptions.LineTooLong, match=match): ++ response.feed_data(b"HTTP/1.1 200 " + b"a" * 8000) ++ response.feed_data(b"a" * 8000 + b"\r\n\r\n") ++ ++ + def test_http_response_parser_bad_version(response) -> None: + with pytest.raises(http_exceptions.BadHttpMessage): + response.feed_data(b"HT/11 200 Ok\r\n\r\n") +-- +2.35.6 + diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb index 3c07933200..1a6baebfe9 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb @@ -13,6 +13,7 @@ SRC_URI += " \ file://CVE-2026-54274.patch \ file://CVE-2026-54275.patch \ file://CVE-2026-54276.patch \ + file://CVE-2026-54277.patch \ " CVE_PRODUCT = "aiohttp" From patchwork Tue Aug 18 18:15:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 95620 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3F0FC5DF8C for ; Tue, 18 Aug 2026 18:15:37 +0000 (UTC) Received: from alln-iport-6.cisco.com (alln-iport-6.cisco.com [173.37.142.93]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.15142.1787076933147785365 for ; Tue, 18 Aug 2026 11:15:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=Azuyfi6k; spf=pass (domain: cisco.com, ip: 173.37.142.93, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=8162; q=dns/txt; s=iport01; t=1787076933; x=1788286533; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VpCWzxAAJhCY7rPV/MKoAmbVsGzpn5sjdKYOE+h9wRU=; b=Azuyfi6k1PnDeTXUVFsPYLhwqLw/gUuUs0NDru/S7/g46r75AQkBYoaw libkf09ZYd/I8Cl3TdjcFxz9+1mkMTWtAfwU/Nb+Mzz0PFhK9SwOtYaOV oIJONUC5pT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KqE8NvK6X evK0Iai9Wrf+Ro3Yvv9+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+vpT2M4nVKtio27hc+adZ zl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CCe5xWuTpfi/xlhJHkkJJco+NhXOktXx 6IkFGoHfg+EqsvjldpXSsE07igiBMDvOIVavjRryivUSK57B5vCWK7No9Rf2V/chOgXQq2YP JRfMGQpNUiaC/FMEg9/5JYWkOSlgnD+YjRwo1OOrq1x6G/WpOB0+Oi0aIqOJ43XGK25mG6co n77vDvCWCsfd8Oa5jmB9GioprDAyHaTtIU6UefQGuRRqFqLy2oeDRcbWVe2rby1h1CzX/pbK lcI4WwptaU0+UmhQ9XxUhH+p2SL1iPwQPJZF+k8rQXIwa3O7kPBWy4PTyVKb5ots8peqSEW6 2JlVujBXVRH2IB5g1rHnltIhVte4RQoEFI= IronPort-HdrOrdr: A9a23:P5aFX6xgf2TKD8ApxzMvKrPw9L1zdoMgy1knxilNoNJuHfBw8P re+8jzuiWUtN98YhwdcJW7Scu9qBDnhPpICPcqXYtKNTOO0ADDEGgh1/qG/9SKIUPDH4BmuZ uIWpIObuEYdWIK7vrS0U2fD8sqxsWB/eSDgOfTyGoocCRRApsQljuQzm2gYzZLrM4sP+tAKK ah X-Talos-CUID: 9a23:gaetWGG1+us+ZGLzqmJf5lcOKsIbUkb31UWOH3PiA3Z2T5C8HAo= X-Talos-MUID: 9a23:4rzzKAb7DeERDOBTszvwuXI9D51S5uexDW8OlZMcv+nbOnkl X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.25,230,1779148800"; d="scan'208";a="810835955" Received: from alln-l-core-05.cisco.com ([173.36.16.142]) by alln-iport-6.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 18 Aug 2026 18:15:32 +0000 Received: from sjc-ads-5675.cisco.com (sjc-ads-5675.cisco.com [10.28.88.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by alln-l-core-05.cisco.com (Postfix) with ESMTPS id 04A33180004B9; Tue, 18 Aug 2026 18:15:32 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 3BF69CD02BF; Tue, 18 Aug 2026 11:15:31 -0700 (PDT) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: xe-linux-external@cisco.com, Darsh Kelaiya Subject: [oe][meta-python][wrynose][PATCH 08/10] python3-aiohttp: fix CVE-2026-54278 Date: Tue, 18 Aug 2026 11:15:26 -0700 Message-Id: <20260818181528.3405276-9-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20260818181528.3405276-1-dkelaiya@cisco.com> References: <20260818181528.3405276-1-dkelaiya@cisco.com> MIME-Version: 1.0 X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-Client-TLS: ANONYMOUS;sjc-ads-5675.cisco.com [10.28.88.189];TLSv1.3;TLS_AES_256_GCM_SHA384;256 X-Outbound-SMTP-Client: 10.28.88.189, sjc-ads-5675.cisco.com X-Outbound-Node: alln-l-core-05.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 18 Aug 2026 18:15:37 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/129239 From: Darsh Kelaiya This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. [1] https://github.com/aio-libs/aiohttp/commit/4f7480e474cccc6a8cc2c92ad3f17a31dedf8232 [2] https://github.com/advisories/GHSA-g3cq-j2xw-wf74 Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-54278.patch | 182 ++++++++++++++++++ .../python/python3-aiohttp_3.13.5.bb | 1 + 2 files changed, 183 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54278.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54278.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54278.patch new file mode 100644 index 0000000000..13a3cecd21 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54278.patch @@ -0,0 +1,182 @@ +From 0a0f845786316ed4dd9fdd785f5f694dee74bba5 Mon Sep 17 00:00:00 2001 +From: "J. Nick Koston" +Date: Sun, 7 Jun 2026 00:39:29 -0500 +Subject: [PATCH] [PR #12828/13b635d7 backport][3.14] Bounded unread compressed + drain (#12845) + +CVE: CVE-2026-54278 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/4f7480e474cccc6a8cc2c92ad3f17a31dedf8232] + +(cherry picked from commit 4f7480e474cccc6a8cc2c92ad3f17a31dedf8232) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/12828.bugfix.rst | 1 + + aiohttp/streams.py | 17 +++++++--- + tests/test_streams.py | 28 ++++++++++++++++ + tests/test_web_functional.py | 63 ++++++++++++++++++++++++++++++++++++ + 4 files changed, 104 insertions(+), 5 deletions(-) + create mode 100644 CHANGES/12828.bugfix.rst + +diff --git a/CHANGES/12828.bugfix.rst b/CHANGES/12828.bugfix.rst +new file mode 100644 +index 000000000..9893577a5 +--- /dev/null ++++ b/CHANGES/12828.bugfix.rst +@@ -0,0 +1 @@ ++Fixed :meth:`~aiohttp.StreamReader.readany` and :meth:`~aiohttp.StreamReader.read_nowait` joining data fed back into the buffer during the call (when draining below the low water mark resumes reading) into a single unbounded :class:`bytes`; a call now returns only the chunks that were buffered when it started, keeping the drain of an unread auto-decompressed request body bounded by the read buffer -- by :user:`bdraco`. +diff --git a/aiohttp/streams.py b/aiohttp/streams.py +index 921827eb3..b52c20742 100644 +--- a/aiohttp/streams.py ++++ b/aiohttp/streams.py +@@ -572,14 +572,21 @@ class StreamReader(AsyncStreamReaderMixin): + """Read not more than n bytes, or whole buffer if n == -1""" + self._timer.assert_timeout() + +- chunks = [] ++ if n == -1: ++ # Drain only chunks present now; _read_nowait_chunk() can ++ # re-entrantly resume_reading() and refill the buffer. ++ count = len(self._buffer) ++ if count == 1: ++ return self._read_nowait_chunk(-1) ++ return b"".join([self._read_nowait_chunk(-1) for _ in range(count)]) ++ ++ chunks: list[bytes] = [] + while self._buffer: + chunk = self._read_nowait_chunk(n) + chunks.append(chunk) +- if n != -1: +- n -= len(chunk) +- if n == 0: +- break ++ n -= len(chunk) ++ if n == 0: ++ break + + return b"".join(chunks) if chunks else b"" + +diff --git a/tests/test_streams.py b/tests/test_streams.py +index 93686746e..8b4fcf322 100644 +--- a/tests/test_streams.py ++++ b/tests/test_streams.py +@@ -1723,3 +1723,31 @@ async def test_stream_reader_small_limit_resumes_reading( + + protocol.resume_reading.assert_called() + assert protocol._reading_paused is False ++ ++ ++async def test_readany_does_not_drain_reentrant_refill( ++ protocol: mock.Mock, ++) -> None: ++ """A single readany() must not reassemble data fed re-entrantly. ++ ++ Draining below the low water mark resumes reading, which can synchronously ++ refill the buffer (e.g. decompressing another chunk). Joining that refill in ++ one call would reassemble an unbounded body. ++ """ ++ loop = asyncio.get_running_loop() ++ stream = streams.StreamReader(protocol, limit=4, loop=loop) ++ ++ refills = [b"second", b"third"] ++ ++ def resume_reading() -> None: ++ if refills: ++ stream.feed_data(refills.pop(0)) ++ ++ protocol.resume_reading.side_effect = resume_reading ++ ++ stream.feed_data(b"first") ++ ++ # Popping "first" refills "second", but this readany() returns only "first". ++ assert await stream.readany() == b"first" ++ assert await stream.readany() == b"second" ++ assert await stream.readany() == b"third" +diff --git a/tests/test_web_functional.py b/tests/test_web_functional.py +index fe9cce27b..e2fd40432 100644 +--- a/tests/test_web_functional.py ++++ b/tests/test_web_functional.py +@@ -5,6 +5,8 @@ import pathlib + import socket + import sys + from typing import Any, Dict, Generator, NoReturn, Optional, Tuple ++import zlib ++from contextlib import suppress + from unittest import mock + + import pytest +@@ -23,7 +25,9 @@ from aiohttp import ( + ) + from aiohttp.compression_utils import ZLibBackend, ZLibCompressObjProtocol + from aiohttp.hdrs import CONTENT_LENGTH, CONTENT_TYPE, TRANSFER_ENCODING ++from aiohttp.helpers import DEFAULT_CHUNK_SIZE + from aiohttp.pytest_plugin import AiohttpClient, AiohttpServer ++from aiohttp.streams import StreamReader + from aiohttp.typedefs import Handler + from aiohttp.web_protocol import RequestHandler + +@@ -1683,6 +1687,65 @@ async def test_response_prepared_with_clone(aiohttp_client) -> None: + await resp.release() + + ++@pytest.mark.parametrize("decompressed_size", [4 * 1024 * 1024, 32 * 1024 * 1024]) ++async def test_unread_compressed_body_drain_is_bounded( ++ aiohttp_server: AiohttpServer, ++ monkeypatch: pytest.MonkeyPatch, ++ decompressed_size: int, ++) -> None: ++ """Draining an unread compressed body stays bounded by the read buffer. ++ ++ A handler that rejects before reading still drains the payload during ++ lingering close; a small compressed body must not force a large transient ++ allocation (a deflate-bomb style DoS). ++ """ ++ drain_reads: list[int] = [] ++ drained = asyncio.Event() ++ readany = StreamReader.readany ++ ++ async def record_readany(self: StreamReader) -> bytes: ++ data = await readany(self) ++ assert data ++ drain_reads.append(len(data)) ++ drained.set() ++ return data ++ ++ monkeypatch.setattr(StreamReader, "readany", record_readany) ++ ++ async def handler(request: web.Request) -> web.Response: ++ return web.Response(status=401) ++ ++ app = web.Application(client_max_size=1024) ++ app.router.add_post("/", handler) ++ server = await aiohttp_server(app) ++ ++ body = zlib.compress(b"a" * decompressed_size) ++ assert len(body) < decompressed_size ++ head = ( ++ b"POST / HTTP/1.1\r\n" ++ b"Host: localhost\r\n" ++ b"Content-Encoding: deflate\r\n" ++ b"Content-Length: %d\r\n" ++ b"Connection: keep-alive\r\n\r\n" ++ ) % len(body) ++ ++ reader, writer = await asyncio.open_connection(server.host, server.port) ++ try: ++ writer.write(head + body) ++ await writer.drain() ++ status_line = await asyncio.wait_for(reader.readline(), 5) ++ assert status_line.startswith(b"HTTP/1.1 401 ") ++ await asyncio.wait_for(drained.wait(), 5) ++ finally: ++ writer.close() ++ with suppress(ConnectionResetError, BrokenPipeError): ++ await writer.wait_closed() ++ ++ # Bounded by the buffer, not the decompressed size. ++ assert max(drain_reads) <= 3 * DEFAULT_CHUNK_SIZE ++ assert max(drain_reads) < decompressed_size ++ ++ + async def test_app_max_client_size(aiohttp_client) -> None: + async def handler(request): + await request.post() diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb index 1a6baebfe9..9a53c3b518 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb @@ -14,6 +14,7 @@ SRC_URI += " \ file://CVE-2026-54275.patch \ file://CVE-2026-54276.patch \ file://CVE-2026-54277.patch \ + file://CVE-2026-54278.patch \ " CVE_PRODUCT = "aiohttp" From patchwork Tue Aug 18 18:15:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 95621 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD4A0C5DF89 for ; Tue, 18 Aug 2026 18:15:36 +0000 (UTC) Received: from alln-iport-4.cisco.com (alln-iport-4.cisco.com [173.37.142.91]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15268.1787076932656748628 for ; Tue, 18 Aug 2026 11:15:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=JbW2KfcH; spf=pass (domain: cisco.com, ip: 173.37.142.91, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=13294; q=dns/txt; s=iport01; t=1787076932; x=1788286532; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yLVKO7VW872JoOexyAtmmHCJQH4L+tFY1t3dUbULZIY=; b=JbW2KfcH/6Ooba5IWAPWeBAn84/AGm8ohQS60X9Qcu9O9VSel06yaB9N RCDfDnOsxwCv0BZVKcIE/tS6ID0jZodmPcm+LrIsshM/9472wbcLwe6V8 UbxXmBsh4YJNveNK6nEHbaZsuOCSC/Ox9QgZUwWzMaz/WaRMMkjkpCWrH xyY753Xg23K711+OLld97hoSoGtJsaDytN4+jHBkE+WRq8U2TLGYsiyty BPV3sugRk3MphI0Op1RJaVs72s3dl3eHDSHcBfpFL9Qlh57ZIeZG8GQv8 djx0LoMrbtwS23kfHX2rtWJteUOTdF6B63FIDVYsSxykSz0Jx0s/InaAF w==; X-CSE-ConnectionGUID: 7vsDNPuQSIy2sqZ4UZwOUQ== X-CSE-MsgGUID: J7X82p63Sju/rpzGQhu3Ig== X-IPAS-Result: A0BJAgBIoIRq/48QJK1aHgEBCxIMggULgld0XkNJA5ZHA5lthC6Bfg8BAQEPRA0EAQGEP0YCjWsCJjQJDgECBAMCAwEBAQEBAQEBAQEBCwEBBQEBAQIBBwWBDhOGTw2GWgECAQMnCwEYAS0QHAMBAhcBFysjCBmDAgGCdAMRxEaBeTOBAYMoAYFU2zABCxQBBYEzhT+IIl0YAYR8JxsbgXKBFYE7gi6BBYFcAoIoAoV7BIIigQyBWpFWSIEeA1ksAVUTDQoLBwWBZgM1EioVbjIdgSM+F4ENGwYFgR2BKIQ3Ixk2eoEJXoErKmEBEheBCYIKAoJzggYCAUlFDgsYDUgRLDcUGQQ+bgeOOCCBUXItEEQNASsEUgE6BwhYEwI7BhiScpApgiGBNZ9aCiiDdowhjg2HLRozhVulEQuYfYkBgjaCU4oNi0l6hGmBaDyBWXAVgyIJShkPV41WCwuDYIVkxlUnMgIIAQooAQEHAgcOAwuBaJACLW9gAQE IronPort-Data: A9a23:WqLQtatOH5YZIX0Hd//2b5GZWufnVAdfMUV32f8akzHdYApBsoF/q tZmKTiGPazfZDSgLdskOt6/80wOv5WAytZrTQNq+382QnkSgMeUXt7xwmUckM+xwmwvaGo9s q3yv/GZdJhcokf0/0nrav666yEgiclkf5KkYMbcICd9WAR4fykojBNnioYRj5Vh6TSDK1vlV eja/YuFZTdJ5xYuajhKs/La90s01BjPkGpwUmIWNKgjUGD2zxH5PLpHTYmtIn3xRJVjH+LSb 47r0LGj82rFyAwmA9Wjn6yTWhVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0NS+7vw60c+VZk 72hg3AfpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn3bEm51T4E8K0YIwpfhsLUd26 MUjCSFXdQmx29+E35WGc7w57igjBJGD0II3s3Vky3TdSP0hW52GG/uM7t5D1zB2jcdLdRrcT 5NGMnw0MlKZPVsWZgx/5JEWxI9EglHzcDBcoVOErII84nPYy0p6172F3N/9KoXTFZkMwh7Bz o7A10amMkFALILE8jiYtWi0lMD2nT6geY1HQdVU8dYv2jV/3Fc7DwUbU1a+q/S1hkOyHt5SN UEQ0i4vtrQpskuzQ9/wWhe1rHKJslgbQdU4LgEhwAiJzqyR50OSAXIJC2YfLtcnr8QxAzct0 zdlgu/UONCmi5XNIVr1y1tehWja1fQ9RYPaWRI5cA== IronPort-HdrOrdr: A9a23:agQFQapZ3ejJbO47vuvrcHkaV5rzeYIsimQD101hICG9vPb2qy nIpoV96faaslcssR0b9OxofZPwI080lqQFhbX5Q43DYOCOggLBR+tfBMnZsljd8kbFmNK1u5 0NT0FWMqyXMbEDt7eY3CCIV/A93dKA7Kekwc3az3trUEVWTpsI1XYBNu5eeXcGPzWvwvECZe Kh2vY= X-Talos-CUID: 9a23:s8aZVWplcuAT7CyoxzkabhjmUZ87aVH79GrpGG6pU31weuGoe0C3xZoxxg== X-Talos-MUID: 9a23:t1JB9ggihp+uN2iSUUv27MMpFphYs/62Vhs2k4hBodGWGhVwJmy8g2Hi X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.25,230,1779148800"; d="scan'208";a="811841401" Received: from alln-l-core-06.cisco.com ([173.36.16.143]) by alln-iport-4.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 18 Aug 2026 18:15:32 +0000 Received: from sjc-ads-5675.cisco.com (sjc-ads-5675.cisco.com [10.28.88.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by alln-l-core-06.cisco.com (Postfix) with ESMTPS id F2D9618000589; Tue, 18 Aug 2026 18:15:31 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 406BACD03C3; Tue, 18 Aug 2026 11:15:31 -0700 (PDT) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: xe-linux-external@cisco.com, Darsh Kelaiya Subject: [oe][meta-python][wrynose][PATCH 09/10] python3-aiohttp: fix CVE-2026-54279 Date: Tue, 18 Aug 2026 11:15:27 -0700 Message-Id: <20260818181528.3405276-10-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20260818181528.3405276-1-dkelaiya@cisco.com> References: <20260818181528.3405276-1-dkelaiya@cisco.com> MIME-Version: 1.0 X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-Client-TLS: ANONYMOUS;sjc-ads-5675.cisco.com [10.28.88.189];TLSv1.3;TLS_AES_256_GCM_SHA384;256 X-Outbound-SMTP-Client: 10.28.88.189, sjc-ads-5675.cisco.com X-Outbound-Node: alln-l-core-06.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 18 Aug 2026 18:15:36 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/129236 From: Darsh Kelaiya This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. [1] https://github.com/aio-libs/aiohttp/commit/a329a7aacad5284f087af36103aff778746da0f2 [2] https://github.com/advisories/GHSA-2fqr-mr3j-6wp8 Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-54279.patch | 295 ++++++++++++++++++ .../python/python3-aiohttp_3.13.5.bb | 1 + 2 files changed, 296 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54279.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54279.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54279.patch new file mode 100644 index 0000000000..9dd96d49e3 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54279.patch @@ -0,0 +1,295 @@ +From 9fff50c82e4fd6baa8252cb573d4a5f3df1a9dcb Mon Sep 17 00:00:00 2001 +From: "J. Nick Koston" +Date: Sun, 7 Jun 2026 00:40:24 -0500 +Subject: [PATCH] [PR #12824/60b85e98 backport][3.14] Preserve host-only cookie + scope across CookieJar save/load (#12833) + +CVE: CVE-2026-54279 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/a329a7aacad5284f087af36103aff778746da0f2] + +(cherry picked from commit a329a7aacad5284f087af36103aff778746da0f2) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/12824.bugfix.rst | 1 + + aiohttp/cookiejar.py | 52 ++++++++++----- + tests/test_cookiejar.py | 135 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 171 insertions(+), 17 deletions(-) + create mode 100644 CHANGES/12824.bugfix.rst + +diff --git a/CHANGES/12824.bugfix.rst b/CHANGES/12824.bugfix.rst +new file mode 100644 +index 000000000..f8dbd169c +--- /dev/null ++++ b/CHANGES/12824.bugfix.rst +@@ -0,0 +1 @@ ++Fixed :class:`~aiohttp.CookieJar` dropping the host-only flag of cookies when persisted with :meth:`~aiohttp.CookieJar.save` and reloaded with :meth:`~aiohttp.CookieJar.load`, so a cookie set without a ``Domain`` attribute is again scoped to the exact host that set it after a reload; the absolute expiration deadline is now persisted as well, so a reloaded cookie keeps its original lifetime instead of being rescheduled from the load time. :meth:`~aiohttp.CookieJar.load` now replaces the jar contents rather than merging onto prior state, and loaded cookies pass through the same acceptance rules as :meth:`~aiohttp.CookieJar.update_cookies`, so a cookie for an IP-address host is dropped when loaded into a jar created without ``unsafe=True`` -- by :user:`bdraco`. +diff --git a/aiohttp/cookiejar.py b/aiohttp/cookiejar.py +index 757cc10e8..b07d1fd50 100644 +--- a/aiohttp/cookiejar.py ++++ b/aiohttp/cookiejar.py +@@ -48,6 +48,9 @@ _FORMAT_DOMAIN_REVERSED = "{1}.{0}".format + _MIN_SCHEDULED_COOKIE_EXPIRATION = 100 + _SIMPLE_COOKIE = SimpleCookie() + ++# Not persisted; the absolute deadline is saved instead. ++_RELATIVE_EXPIRY_ATTRS = frozenset(("max-age", "expires")) ++ + + class _RestrictedCookieUnpickler(pickle.Unpickler): + """A restricted unpickler that only allows cookie-related types. +@@ -165,21 +168,28 @@ class CookieJar(AbstractCookieJar): + :class:`str` or :class:`pathlib.Path` instance. + """ + file_path = pathlib.Path(file_path) +- data: dict[str, dict[str, dict[str, str | bool]]] = {} ++ data: dict[str, dict[str, dict[str, str | bool | float]]] = {} + for (domain, path), cookie in self._cookies.items(): + key = f"{domain}|{path}" + data[key] = {} + for name, morsel in cookie.items(): +- morsel_data: dict[str, str | bool] = { ++ morsel_data: dict[str, str | bool | float] = { + "key": morsel.key, + "value": morsel.value, + "coded_value": morsel.coded_value, + } +- # Save all morsel attributes that have values ++ # Skip relative expiry; the absolute deadline is saved below. + for attr in morsel._reserved: # type: ignore[attr-defined] ++ if attr in _RELATIVE_EXPIRY_ATTRS: ++ continue + attr_val = morsel[attr] + if attr_val: + morsel_data[attr] = attr_val ++ # Persist or it reloads as a domain cookie and leaks to subdomains. ++ if (domain, name) in self._host_only_cookies: ++ morsel_data["host_only"] = True ++ if (exp := self._expirations.get((domain, path, name))) is not None: ++ morsel_data["expires_timestamp"] = exp + data[key][name] = morsel_data + with file_path.open(mode="w", encoding="utf-8") as f: + json.dump(data, f, indent=2) +@@ -191,6 +201,9 @@ class CookieJar(AbstractCookieJar): + pickle format (using a restricted unpickler) for backward + compatibility with existing cookie files. + ++ Replaces the current jar contents; loaded cookies pass through the ++ same acceptance rules as :meth:`update_cookies`. ++ + :param file_path: Path to file from where cookies will be + imported, :class:`str` or :class:`pathlib.Path` instance. + """ +@@ -199,32 +212,28 @@ class CookieJar(AbstractCookieJar): + try: + with file_path.open(mode="r", encoding="utf-8") as f: + data = json.load(f) +- self._cookies = self._load_json_data(data) ++ self._load_json_data(data) + except (json.JSONDecodeError, UnicodeDecodeError, ValueError): + # Fall back to legacy pickle format with restricted unpickler + with file_path.open(mode="rb") as f: + self._cookies = _RestrictedCookieUnpickler(f).load() + + def _load_json_data( +- self, data: dict[str, dict[str, dict[str, str | bool]]] +- ) -> defaultdict[tuple[str, str], SimpleCookie]: +- """Load cookies from parsed JSON data.""" +- cookies: defaultdict[tuple[str, str], SimpleCookie] = defaultdict(SimpleCookie) ++ self, data: dict[str, dict[str, dict[str, str | bool | float]]] ++ ) -> None: ++ """Replace contents, routing cookies through update_cookies().""" ++ self.clear() + for compound_key, cookie_data in data.items(): + domain, path = compound_key.split("|", 1) +- key = (domain, path) + for name, morsel_data in cookie_data.items(): + morsel: Morsel[str] = Morsel() +- morsel_key = morsel_data["key"] +- morsel_value = morsel_data["value"] +- morsel_coded_value = morsel_data["coded_value"] + # Use __setstate__ to bypass validation, same pattern + # used in _build_morsel and _cookie_helpers. + morsel.__setstate__( # type: ignore[attr-defined] + { +- "key": morsel_key, +- "value": morsel_value, +- "coded_value": morsel_coded_value, ++ "key": morsel_data["key"], ++ "value": morsel_data["value"], ++ "coded_value": morsel_data["coded_value"], + } + ) + # Restore morsel attributes +@@ -235,8 +244,17 @@ class CookieJar(AbstractCookieJar): + "coded_value", + ): + morsel[attr] = morsel_data[attr] +- cookies[key][name] = morsel +- return cookies ++ # Drop the domain so update_cookies() re-marks it host-only. ++ if morsel_data.get("host_only"): ++ morsel["domain"] = "" ++ response_url = ( ++ URL.build(scheme="https", host=domain) if domain else URL() ++ ) ++ self.update_cookies({name: morsel}, response_url) ++ # Restore the absolute deadline; update_cookies() schedules none. ++ if (exp := morsel_data.get("expires_timestamp")) is not None: ++ self._expire_cookie(float(exp), domain, path, name) ++ self._do_expiration() + + def clear(self, predicate: Optional[ClearCookiePredicate] = None) -> None: + if predicate is None: +diff --git a/tests/test_cookiejar.py b/tests/test_cookiejar.py +index 694514067..ba7ee3220 100644 +--- a/tests/test_cookiejar.py ++++ b/tests/test_cookiejar.py +@@ -2,6 +2,7 @@ import asyncio + import datetime + import heapq + import itertools ++import json + import logging + import pathlib + import pickle +@@ -1760,6 +1761,140 @@ async def test_save_load_json_partitioned_cookies(tmp_path: Path) -> None: + assert s["path"] == lo["path"] + + ++async def test_save_load_json_preserves_host_only_scope(tmp_path: Path) -> None: ++ """Verify save/load keeps host-only cookies off subdomains.""" ++ file_path = tmp_path / "host_only.json" ++ issuer = URL("https://auth.example.com/login") ++ subdomain = URL("https://sub.auth.example.com/") ++ ++ jar_save = CookieJar() ++ jar_save.update_cookies({"sid": "hostonly"}, response_url=issuer) ++ assert "sid" not in jar_save.filter_cookies(subdomain) ++ jar_save.save(file_path=file_path) ++ ++ jar_load = CookieJar() ++ jar_load.load(file_path=file_path) ++ ++ assert jar_load.host_only_cookies == frozenset({("auth.example.com", "sid")}) ++ assert "sid" not in jar_load.filter_cookies(subdomain) ++ assert "sid" in jar_load.filter_cookies(issuer) ++ ++ ++async def test_save_load_json_domain_cookie_still_matches_subdomain( ++ tmp_path: Path, ++) -> None: ++ """Verify save/load keeps an explicit Domain cookie valid for subdomains.""" ++ file_path = tmp_path / "domain.json" ++ subdomain = URL("https://sub.example.com/") ++ ++ jar_save = CookieJar() ++ jar_save.update_cookies_from_headers( ++ ["sid=domaincookie; Domain=example.com"], URL("https://example.com/") ++ ) ++ jar_save.save(file_path=file_path) ++ ++ jar_load = CookieJar() ++ jar_load.load(file_path=file_path) ++ ++ assert jar_load.host_only_cookies == frozenset() ++ assert "sid" in jar_load.filter_cookies(subdomain) ++ ++ ++async def test_save_load_json_preserves_max_age_deadline(tmp_path: Path) -> None: ++ """Verify save/load restores the absolute deadline without resetting it.""" ++ file_path = tmp_path / "max_age.json" ++ url = URL("https://example.com/") ++ ++ jar_save = CookieJar() ++ jar_save.update_cookies_from_headers( ++ ["sid=x; Max-Age=3600; Domain=example.com"], url ++ ) ++ expirations = dict(jar_save._expirations) ++ jar_save.save(file_path=file_path) ++ ++ jar_load = CookieJar() ++ jar_load.load(file_path=file_path) ++ ++ # The deadline is restored as the original absolute time, not now + Max-Age. ++ assert dict(jar_load._expirations) == expirations ++ assert "sid" in jar_load.filter_cookies(url) ++ ++ ++async def test_save_load_json_drops_expired_cookie(tmp_path: Path) -> None: ++ """Verify a cookie whose persisted deadline is in the past is dropped on load.""" ++ file_path = tmp_path / "expired.json" ++ url = URL("https://example.com/") ++ ++ # Save a future-expiring cookie, then rewrite its persisted deadline to the ++ # past so the cookie survives save() and the drop happens on the load path. ++ jar_save = CookieJar() ++ jar_save.update_cookies_from_headers( ++ ["sid=x; Expires=Tue, 1 Jan 2999 12:00:00 GMT; Domain=example.com"], url ++ ) ++ jar_save.save(file_path=file_path) ++ data = json.loads(file_path.read_text()) ++ _, cookies = next(iter(data.items())) ++ cookies["sid"]["expires_timestamp"] = 0.0 ++ file_path.write_text(json.dumps(data)) ++ ++ jar_load = CookieJar() ++ jar_load.load(file_path=file_path) ++ ++ assert len(jar_load) == 0 ++ assert "sid" not in jar_load.filter_cookies(url) ++ ++ ++async def test_save_load_json_preserves_expires_deadline(tmp_path: Path) -> None: ++ """Verify a future Expires deadline survives a save/load roundtrip.""" ++ file_path = tmp_path / "expires.json" ++ url = URL("https://example.com/") ++ ++ jar_save = CookieJar() ++ jar_save.update_cookies_from_headers( ++ ["sid=x; Expires=Tue, 1 Jan 2999 12:00:00 GMT; Domain=example.com"], url ++ ) ++ expirations = dict(jar_save._expirations) ++ jar_save.save(file_path=file_path) ++ ++ jar_load = CookieJar() ++ jar_load.load(file_path=file_path) ++ ++ assert dict(jar_load._expirations) == expirations ++ assert "sid" in jar_load.filter_cookies(url) ++ ++ ++async def test_load_json_old_format_without_new_keys(tmp_path: Path) -> None: ++ """Verify a file written by an older version (no host_only/expires_timestamp) loads.""" ++ file_path = tmp_path / "old.json" ++ # Old schema: no host_only, no expires_timestamp; relative max-age morsel attr. ++ file_path.write_text( ++ json.dumps( ++ { ++ "example.com|/": { ++ "sid": { ++ "key": "sid", ++ "value": "x", ++ "coded_value": "x", ++ "domain": "example.com", ++ "max-age": "3600", ++ } ++ } ++ } ++ ) ++ ) ++ url = URL("https://example.com/") ++ ++ jar_load = CookieJar() ++ # No exception when the new keys are absent. ++ jar_load.load(file_path=file_path) ++ ++ # A host-only cookie saved without Domain by an older version had no domain ++ # field, so it now loads as a domain cookie (the documented migration loss). ++ assert "sid" in jar_load.filter_cookies(url) ++ # max-age is rescheduled from load time rather than an absolute deadline. ++ assert any(key[2] == "sid" for key in jar_load._expirations) ++ ++ + async def test_json_format_is_safe(tmp_path: Path) -> None: + """Verify the JSON file format cannot execute code on load.""" + import json diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb index 9a53c3b518..9102175f24 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb @@ -15,6 +15,7 @@ SRC_URI += " \ file://CVE-2026-54276.patch \ file://CVE-2026-54277.patch \ file://CVE-2026-54278.patch \ + file://CVE-2026-54279.patch \ " CVE_PRODUCT = "aiohttp" From patchwork Tue Aug 18 18:15:28 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 95616 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA227C5DF8A for ; Tue, 18 Aug 2026 18:15:36 +0000 (UTC) Received: from alln-iport-8.cisco.com (alln-iport-8.cisco.com [173.37.142.95]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.15141.1787076933083490512 for ; Tue, 18 Aug 2026 11:15:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=MaTFXPFi; spf=pass (domain: cisco.com, ip: 173.37.142.95, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=6561; q=dns/txt; s=iport01; t=1787076933; x=1788286533; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kdZu2S2Q5gHx05tTUWlI3x4rHUC0tEEZThxlELtBwME=; b=MaTFXPFiuNTaS2fEIBeqrBMRwgObegpuaRa+sHEWmNYKyUjusyzjAn1a DPHDliTzIHgJnD474MMNYd0JYIq0TKwUiJ/8zSkiTRYQzSF9NqPIxrHLb ARYUiPqxtjjt55bP9XzYG+4O633UOgMe0eWEhI5nA410dJ8MxI9tl4t0X dNG5bMZ/bNEWlEcbuIyafIBuTpLUDM3CzWgAJ62ot+dE2Qx7e5GggoXjv y97t5oFZf9g79y+5UgZ+XXgIunDhPIft8OnEzZ7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QL/pGLl8KYd1D495OIl5v7 L86ITVXSgrYvrfjqF67YrEEasULJc3vOsYb/3pn1zycVatgSpHYSKKM7thdtNsyrpkRRrCFO YxAN3w2ME6ojx5nYj/7DLoyn+qsj3juehVTqUmeouw85G27IAlZgOG3YIaJIY3bLSlTtk2ov 3KF8XzFPiNEKv7P2BrY9GvvjMaayEsXX6pXTtVU7MVCh0WewGEWAhAaWVa35PW0lEO6c9ZeM FAPvC02oK4/8UamQtXwU1u/unHsg/IHc9NUF+t/7ESGzbDZpl7EQGMFVTVGLtchsafaWAAX6 7NApPuxbRQHjVFfYSv1Gmu8xd9qBRUoEA== IronPort-HdrOrdr: A9a23:+q0Dka4vFXxEbg7y6APXwBDXdLJyesId70hD6qm+c3Nom6uj5q eTdZsgtCMc5Ax9ZJhko6HjBEDiewK5yXcK2+ks1N6ZNWGM0ldAbrsSiLcKqAePJ8SRzIJgPI 5bAs5D4aXLfDtHpPe/xhWkGNA9x9TC2qWpieDCi0pJd2hRGthdB8MTMHfhLqWwLzM2faYEKA == X-Talos-CUID: 9a23:kGDVLm3Q/ySg671sv7PcAbxfON4ZLi2G1U/pAHCZECVLQbjPbUXLwfYx X-Talos-MUID: 9a23:BYrBwg1gY1dMT/n/C+v8D2fR2jUj6JS3GAMDiak6iZeaF3xhG2qblXe9a9py X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.25,230,1779148800"; d="scan'208";a="812844399" Received: from alln-l-core-05.cisco.com ([173.36.16.142]) by alln-iport-8.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 18 Aug 2026 18:15:32 +0000 Received: from sjc-ads-5675.cisco.com (sjc-ads-5675.cisco.com [10.28.88.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by alln-l-core-05.cisco.com (Postfix) with ESMTPS id F33D41800017F; Tue, 18 Aug 2026 18:15:31 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 47056CD03C5; Tue, 18 Aug 2026 11:15:31 -0700 (PDT) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: xe-linux-external@cisco.com, Darsh Kelaiya Subject: [oe][meta-python][wrynose][PATCH 10/10] python3-aiohttp: fix CVE-2026-54280 Date: Tue, 18 Aug 2026 11:15:28 -0700 Message-Id: <20260818181528.3405276-11-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20260818181528.3405276-1-dkelaiya@cisco.com> References: <20260818181528.3405276-1-dkelaiya@cisco.com> MIME-Version: 1.0 X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-Client-TLS: ANONYMOUS;sjc-ads-5675.cisco.com [10.28.88.189];TLSv1.3;TLS_AES_256_GCM_SHA384;256 X-Outbound-SMTP-Client: 10.28.88.189, sjc-ads-5675.cisco.com X-Outbound-Node: alln-l-core-05.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 18 Aug 2026 18:15:36 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/129238 From: Darsh Kelaiya This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. [1] https://github.com/aio-libs/aiohttp/commit/a762eda5242f6490d6ba667533193f8b473ad587 [2] https://github.com/advisories/GHSA-9x8q-7h8h-wcw9 Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-54280.patch | 138 ++++++++++++++++++ .../python/python3-aiohttp_3.13.5.bb | 1 + 2 files changed, 139 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54280.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54280.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54280.patch new file mode 100644 index 0000000000..c598a5194c --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-54280.patch @@ -0,0 +1,138 @@ +From 724ae4d652417c4490a71ea0b16b8804dad3004f Mon Sep 17 00:00:00 2001 +From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> +Date: Sun, 7 Jun 2026 05:47:16 +0000 +Subject: [PATCH] [PR #12831/1ac92dae backport][3.14] Payload close on + disconnect (#12843) + +CVE: CVE-2026-54280 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/a762eda5242f6490d6ba667533193f8b473ad587] + +Co-authored-by: J. Nick Koston +(cherry picked from commit a762eda5242f6490d6ba667533193f8b473ad587) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/12831.bugfix.rst | 1 + + aiohttp/web_response.py | 6 ++-- + tests/test_web_response.py | 73 +++++++++++++++++++++++++++++++++++++- + 3 files changed, 77 insertions(+), 3 deletions(-) + create mode 100644 CHANGES/12831.bugfix.rst + +diff --git a/CHANGES/12831.bugfix.rst b/CHANGES/12831.bugfix.rst +new file mode 100644 +index 000000000..bf460ffcc +--- /dev/null ++++ b/CHANGES/12831.bugfix.rst +@@ -0,0 +1 @@ ++Fixed :meth:`aiohttp.web.Response.write_eof` skipping ``Payload.close()`` when the body write was interrupted by an error or cancellation, for example when a client disconnects mid-response; the payload close hook now runs in a ``finally`` so a :class:`~aiohttp.payload.Payload` body always releases its resources -- by :user:`bdraco`. +diff --git a/aiohttp/web_response.py b/aiohttp/web_response.py +index 364270e4d..cea5d4b45 100644 +--- a/aiohttp/web_response.py ++++ b/aiohttp/web_response.py +@@ -779,8 +779,10 @@ class Response(StreamResponse): + if body is None or self._must_be_empty_body: + await super().write_eof() + elif isinstance(self._body, Payload): +- await self._body.write(self._payload_writer) +- await self._body.close() ++ try: ++ await self._body.write(self._payload_writer) ++ finally: ++ await self._body.close() + await super().write_eof() + else: + await super().write_eof(cast(bytes, body)) +diff --git a/tests/test_web_response.py b/tests/test_web_response.py +index 5a4fb7e66..f094cd3d2 100644 +--- a/tests/test_web_response.py ++++ b/tests/test_web_response.py +@@ -1,3 +1,4 @@ ++import asyncio + import collections.abc + import datetime + import gzip +@@ -18,7 +19,7 @@ from aiohttp.abc import AbstractStreamWriter + from aiohttp.helpers import ETag + from aiohttp.http_writer import StreamWriter, _serialize_headers + from aiohttp.multipart import BodyPartReader, MultipartWriter +-from aiohttp.payload import BytesPayload, StringPayload ++from aiohttp.payload import BytesPayload, Payload, StringPayload + from aiohttp.test_utils import make_mocked_request + from aiohttp.web import ContentCoding, Response, StreamResponse, json_response + +@@ -1370,6 +1371,76 @@ async def test_consecutive_write_eof() -> None: + writer.write_eof.assert_called_once_with(data) + + ++class _ClosingPayload(Payload): ++ """Payload test double that records whether close() ran.""" ++ ++ def __init__(self) -> None: ++ super().__init__(None) ++ self.close_called = False ++ self.started = asyncio.Event() ++ self.release = asyncio.Event() ++ self.fail = False ++ ++ async def write(self, writer: AbstractStreamWriter) -> None: ++ self.started.set() ++ if self.fail: ++ raise ConnectionResetError("client gone") ++ await self.release.wait() ++ ++ async def close(self) -> None: ++ self.close_called = True ++ await super().close() ++ ++ def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: ++ assert False ++ ++ ++async def test_write_eof_closes_payload_on_success() -> None: ++ writer = mock.create_autospec(AbstractStreamWriter, spec_set=True, instance=True) ++ req = make_request("GET", "/", writer=writer) ++ payload = _ClosingPayload() ++ payload.release.set() ++ resp = web.Response(body=payload) ++ ++ await resp.prepare(req) ++ await resp.write_eof() ++ ++ assert payload.close_called ++ assert writer.write_eof.called ++ ++ ++async def test_write_eof_closes_payload_on_write_error() -> None: ++ writer = mock.create_autospec(AbstractStreamWriter, spec_set=True, instance=True) ++ req = make_request("GET", "/", writer=writer) ++ payload = _ClosingPayload() ++ payload.fail = True ++ resp = web.Response(body=payload) ++ ++ await resp.prepare(req) ++ with pytest.raises(ConnectionResetError): ++ await resp.write_eof() ++ ++ assert payload.close_called ++ assert not writer.write_eof.called ++ ++ ++async def test_write_eof_closes_payload_on_cancel() -> None: ++ writer = mock.create_autospec(AbstractStreamWriter, spec_set=True, instance=True) ++ req = make_request("GET", "/", writer=writer) ++ payload = _ClosingPayload() ++ resp = web.Response(body=payload) ++ ++ await resp.prepare(req) ++ task = asyncio.ensure_future(resp.write_eof()) ++ await payload.started.wait() ++ task.cancel() ++ with pytest.raises(asyncio.CancelledError): ++ await task ++ ++ assert payload.close_called ++ assert not writer.write_eof.called ++ ++ + def test_set_text_with_content_type() -> None: + resp = Response() + resp.content_type = "text/html" diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb index 9102175f24..b9d08ac97b 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.13.5.bb @@ -16,6 +16,7 @@ SRC_URI += " \ file://CVE-2026-54277.patch \ file://CVE-2026-54278.patch \ file://CVE-2026-54279.patch \ + file://CVE-2026-54280.patch \ " CVE_PRODUCT = "aiohttp"