python3-aiohttp: patch CVE-2025-69224
PATCH 1/7 python3-aiohttp: patch CVE-2025-69224
Details: https://nvd.nist.gov/vuln/detail/CVE-2025-69224
Backport the patch indicated by the NVD advisory. Only a part of the tests were backported, because some of the new tests require a compression method that is not supported yet by this version.
--- .../python3-aiohttp/CVE-2025-69224.patch | 93 +++++++++++++++++++ .../python/python3-aiohttp_3.12.15.bb | 1 + 2 files changed, 94 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69224.patch
meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69224.patch new file +93 -0
@@ -0,0 +1,93 @@ +From 225412b13f66a76a7222d7719777e6162638faa3 Mon Sep 17 00:00:00 2001 +From: Sam Bull <[email protected]> +Date: Sat, 3 Jan 2026 00:02:45 +0000 +Subject: [PATCH] Reject non-ascii characters in some headers (#11886) (#11902) + +(cherry picked from commit 5affd64f86d28a16a8f8e6fea2d217c99bf7831f) + +CVE: CVE-2025-69224 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/32677f2adfd907420c078dda6b79225c6f4ebce0] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + aiohttp/_http_parser.pyx | 6 +++--- + aiohttp/http_parser.py | 8 ++++++-- + tests/test_http_parser.py | 16 +++++++++++++++- + 3 files changed, 24 insertions(+), 6 deletions(-) + +diff --git a/aiohttp/_http_parser.pyx b/aiohttp/_http_parser.pyx +index 16893f0..23f1dd1 100644 +--- a/aiohttp/_http_parser.pyx ++++ b/aiohttp/_http_parser.pyx +@@ -421,7 +421,8 @@ cdef class HttpParser: + headers = CIMultiDictProxy(CIMultiDict(self._headers)) + + if self._cparser.type == cparser.HTTP_REQUEST: +- allowed = upgrade and headers.get("upgrade", "").lower() in ALLOWED_UPGRADES ++ h_upg = headers.get("upgrade", "") ++ allowed = upgrade and h_upg.isascii() and h_upg.lower() in ALLOWED_UPGRADES + if allowed or self._cparser.method == cparser.HTTP_CONNECT: + self._upgraded = True + else: +@@ -436,8 +437,7 @@ cdef class HttpParser: + enc = self._content_encoding + if enc is not None: + self._content_encoding = None +- enc = enc.lower() +- if enc in ('gzip', 'deflate', 'br'): ++ if enc.isascii() and enc.lower() in {"gzip", "deflate", "br"}: + encoding = enc + + if self._cparser.type == cparser.HTTP_REQUEST: +diff --git a/aiohttp/http_parser.py b/aiohttp/http_parser.py +index 9f864b2..bc8f7da 100644 +--- a/aiohttp/http_parser.py ++++ b/aiohttp/http_parser.py +@@ -232,7 +232,9 @@ class HeadersParser: + + def _is_supported_upgrade(headers: CIMultiDictProxy[str]) -> bool: + """Check if the upgrade header is supported.""" +- return headers.get(hdrs.UPGRADE, "").lower() in {"tcp", "websocket"} ++ u = headers.get(hdrs.UPGRADE, "") ++ # .lower() can transform non-ascii characters. ++ return u.isascii() and u.lower() in {"tcp", "websocket"} + + + class HttpParser(abc.ABC, Generic[_MsgT]): +@@ -664,7 +666,9 @@ class HttpRequestParser(HttpParser[RawRequestMessage]): + ) + + def _is_chunked_te(self, te: str) -> bool: +- if te.rsplit(",", maxsplit=1)[-1].strip(" \t").lower() == "chunked": ++ te = te.rsplit(",", maxsplit=1)[-1].strip(" \t") ++ # .lower() transforms some non-ascii chars, so must check first. ++ if te.isascii() and te.lower() == "chunked": + return True + # https://www.rfc-editor.org/rfc/rfc9112#section-6.3-2.4.3 + raise BadHttpMessage("Request has invalid `Transfer-Encoding`") +diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py +index 385452c..d4c1768 100644 +--- a/tests/test_http_parser.py ++++ b/tests/test_http_parser.py +@@ -468,7 +468,21 @@ def test_request_chunked(parser) -> None: + assert isinstance(payload, streams.StreamReader) + + +-def test_request_te_chunked_with_content_length(parser: Any) -> None: ++def test_te_header_non_ascii(parser: HttpRequestParser) -> None: ++ # K = Kelvin sign, not valid ascii. ++ text = "GET /test HTTP/1.1\r\nTransfer-Encoding: chunKed\r\n\r\n" ++ with pytest.raises(http_exceptions.BadHttpMessage): ++ parser.feed_data(text.encode()) ++ ++ ++def test_upgrade_header_non_ascii(parser: HttpRequestParser) -> None: ++ # K = Kelvin sign, not valid ascii. ++ text = "GET /test HTTP/1.1\r\nUpgrade: websocKet\r\n\r\n" ++ messages, upgrade, tail = parser.feed_data(text.encode()) ++ assert not upgrade ++ ++ ++def test_request_te_chunked_with_content_length(parser: HttpRequestParser) -> None: + text = ( + b"GET /test HTTP/1.1\r\n" + b"content-length: 1234\r\n"
meta-python/recipes-devtools/python/python3-aiohttp_3.12.15.bb +1 -0
@@ -4,6 +4,7 @@ HOMEPAGE = "https://github.com/aio-libs/aiohttp" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=748073912af33aa59430d3702aa32d41" +SRC_URI += "file://CVE-2025-69224.patch" SRC_URI[sha256sum] = "4fc61385e9c98d72fcdf47e6dd81833f47b2f77c114c29cd64a361be57a763a2" inherit python_setuptools_build_meta pypi
PATCH 2/7 python3-aiohttp: patch CVE-2025-69225
Details: https://nvd.nist.gov/vuln/detail/CVE-2025-69225
Backport the patch that is referenced by the NVD report.
--- .../python3-aiohttp/CVE-2025-69225.patch | 49 +++++++++++++++++++ .../python/python3-aiohttp_3.12.15.bb | 4 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69225.patch
meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69225.patch new file +49 -0
@@ -0,0 +1,49 @@ +From a4be27fe28e6cd833fa3045cca10404472d6878d Mon Sep 17 00:00:00 2001 +From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> +Date: Sat, 3 Jan 2026 00:39:41 +0000 +Subject: [PATCH] Reject non-ascii digits in Range header (#11903) + +**This is a backport of PR #11887 as merged into master +(7a067d1905e1eeb921a50010dd0004990dbb3bf0).** + +Co-authored-by: Sam Bull <[email protected]> + +CVE: CVE-2025-69225 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/c7b7a044f88c71cefda95ec75cdcfaa4792b3b96] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + aiohttp/web_request.py | 2 +- + tests/test_web_request.py | 7 +++++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/aiohttp/web_request.py b/aiohttp/web_request.py +index 0bc69b7..6e09027 100644 +--- a/aiohttp/web_request.py ++++ b/aiohttp/web_request.py +@@ -607,7 +607,7 @@ class BaseRequest(MutableMapping[str, Any], HeadersMixin): + if rng is not None: + try: + pattern = r"^bytes=(\d*)-(\d*)$" +- start, end = re.findall(pattern, rng)[0] ++ start, end = re.findall(pattern, rng, re.ASCII)[0] + except IndexError: # pattern was not found in header + raise ValueError("range not in acceptable format") + +diff --git a/tests/test_web_request.py b/tests/test_web_request.py +index e706e18..da80ca9 100644 +--- a/tests/test_web_request.py ++++ b/tests/test_web_request.py +@@ -243,6 +243,13 @@ def test_range_to_slice_tail_stop() -> None: + assert req.content[req.http_range] == payload[-500:] + + ++def test_range_non_ascii() -> None: ++ # ५ = DEVANAGARI DIGIT FIVE ++ req = make_mocked_request("GET", "/", headers=CIMultiDict([("RANGE", "bytes=4-५")])) ++ with pytest.raises(ValueError, match="range not in acceptable format"): ++ req.http_range ++ ++ + def test_non_keepalive_on_http10() -> None: + req = make_mocked_request("GET", "/", version=HttpVersion(1, 0)) + assert not req.keep_alive
meta-python/recipes-devtools/python/python3-aiohttp_3.12.15.bb +3 -1
@@ -4,7 +4,9 @@ HOMEPAGE = "https://github.com/aio-libs/aiohttp" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=748073912af33aa59430d3702aa32d41" -SRC_URI += "file://CVE-2025-69224.patch" +SRC_URI += "file://CVE-2025-69224.patch \ + file://CVE-2025-69225.patch \ +" SRC_URI[sha256sum] = "4fc61385e9c98d72fcdf47e6dd81833f47b2f77c114c29cd64a361be57a763a2" inherit python_setuptools_build_meta pypi
PATCH 3/7 python3-aiohttp: patch CVE-2025-69226
In reply to Gyorgy SarvariDetails: https://nvd.nist.gov/vuln/detail/CVE-2025-69226
Backport the patch that is referenced by the NVD advisory.
--- .../python3-aiohttp/CVE-2025-69226.patch | 134 ++++++++++++++++++ .../python/python3-aiohttp_3.12.15.bb | 1 + 2 files changed, 135 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69226.patch
meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69226.patch new file +134 -0
@@ -0,0 +1,134 @@ +From b330573c65db35ee1228615ec257619b49b918c7 Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Sat, 3 Jan 2026 01:55:05 +0000 +Subject: [PATCH] Reject static URLs that traverse outside static root (#11888) + (#11906) + +From: Sam Bull <[email protected]> + +(cherry picked from commit 63961fa77fa2443109f25c3d8ab94772d3878626) + +Co-authored-by: J. Nick Koston <[email protected]> + +CVE: CVE-2025-69226 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/f2a86fd5ac0383000d1715afddfa704413f0711e] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + aiohttp/web_urldispatcher.py | 18 +++++++++--------- + tests/test_urldispatch.py | 18 +++++++++++++++++- + tests/test_web_sendfile_functional.py | 2 +- + tests/test_web_urldispatcher.py | 4 ++-- + 4 files changed, 29 insertions(+), 13 deletions(-) + +diff --git a/aiohttp/web_urldispatcher.py b/aiohttp/web_urldispatcher.py +index 28ae251..a121656 100644 +--- a/aiohttp/web_urldispatcher.py ++++ b/aiohttp/web_urldispatcher.py +@@ -7,6 +7,7 @@ import html + import inspect + import keyword + import os ++import platform + import re + import sys + import warnings +@@ -94,6 +95,7 @@ ROUTE_RE: Final[Pattern[str]] = re.compile( + ) + PATH_SEP: Final[str] = re.escape("/") + ++IS_WINDOWS: Final[bool] = platform.system() == "Windows" + + _ExpectHandler = Callable[[Request], Awaitable[Optional[StreamResponse]]] + _Resolve = Tuple[Optional["UrlMappingMatchInfo"], Set[str]] +@@ -649,7 +651,12 @@ class StaticResource(PrefixResource): + async def resolve(self, request: Request) -> _Resolve: + path = request.rel_url.path_safe + method = request.method +- if not path.startswith(self._prefix2) and path != self._prefix: ++ # We normalise here to avoid matches that traverse below the static root. ++ # e.g. /static/../../../../home/user/webapp/static/ ++ norm_path = os.path.normpath(path) ++ if IS_WINDOWS: ++ norm_path = norm_path.replace("\\", "/") ++ if not norm_path.startswith(self._prefix2) and norm_path != self._prefix: + return None, set() + + allowed_methods = self._allowed_methods +@@ -666,14 +673,7 @@ class StaticResource(PrefixResource): + return iter(self._routes.values()) + + async def _handle(self, request: Request) -> StreamResponse: +- rel_url = request.match_info["filename"] +- filename = Path(rel_url) +- if filename.anchor: +- # rel_url is an absolute name like +- # /static/\\machine_name\c$ or /static/D:\path +- # where the static dir is totally different +- raise HTTPForbidden() +- ++ filename = request.match_info["filename"] + unresolved_path = self._directory.joinpath(filename) + loop = asyncio.get_running_loop() + return await loop.run_in_executor( +diff --git a/tests/test_urldispatch.py b/tests/test_urldispatch.py +index ba6bdff..e329ea2 100644 +--- a/tests/test_urldispatch.py ++++ b/tests/test_urldispatch.py +@@ -1,4 +1,5 @@ + import pathlib ++import platform + import re + from collections.abc import Container, Iterable, Mapping, MutableMapping, Sized + from typing import NoReturn +@@ -1041,7 +1042,22 @@ async def test_405_for_resource_adapter(router) -> None: + assert (None, {"HEAD", "GET"}) == ret + + +-async def test_check_allowed_method_for_found_resource(router) -> None: [email protected](platform.system() == "Windows", reason="Different path formats") ++async def test_static_resource_outside_traversal(router: web.UrlDispatcher) -> None: ++ """Test relative path traversing outside root does not resolve.""" ++ static_file = pathlib.Path(aiohttp.__file__) ++ request_path = "/st" + "/.." * (len(static_file.parts) - 2) + str(static_file) ++ assert pathlib.Path(request_path).resolve() == static_file ++ ++ resource = router.add_static("/st", static_file.parent) ++ ret = await resource.resolve(make_mocked_request("GET", request_path)) ++ # Should not resolve, otherwise filesystem information may be leaked. ++ assert (None, set()) == ret ++ ++ ++async def test_check_allowed_method_for_found_resource( ++ router: web.UrlDispatcher, ++) -> None: + handler = make_handler() + resource = router.add_resource("/") + resource.add_route("GET", handler) +diff --git a/tests/test_web_sendfile_functional.py b/tests/test_web_sendfile_functional.py +index 0325a46..3207623 100644 +--- a/tests/test_web_sendfile_functional.py ++++ b/tests/test_web_sendfile_functional.py +@@ -638,7 +638,7 @@ async def test_static_file_directory_traversal_attack(aiohttp_client) -> None: + + url_abspath = "/static/" + str(full_path.resolve()) + resp = await client.get(url_abspath) +- assert 403 == resp.status ++ assert resp.status == 404 + await resp.release() + + await client.close() +diff --git a/tests/test_web_urldispatcher.py b/tests/test_web_urldispatcher.py +index ee60b69..7de3ea5 100644 +--- a/tests/test_web_urldispatcher.py ++++ b/tests/test_web_urldispatcher.py +@@ -838,8 +838,8 @@ async def test_static_absolute_url( + here = pathlib.Path(__file__).parent + app.router.add_static("/static", here) + client = await aiohttp_client(app) +- resp = await client.get("/static/" + str(file_path.resolve())) +- assert resp.status == 403 ++ async with client.get("/static/" + str(file_path.resolve())) as resp: ++ assert resp.status == 404 + + + async def test_for_issue_5250(
meta-python/recipes-devtools/python/python3-aiohttp_3.12.15.bb +1 -0
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=748073912af33aa59430d3702aa32d41" SRC_URI += "file://CVE-2025-69224.patch \ file://CVE-2025-69225.patch \ + file://CVE-2025-69226.patch \ " SRC_URI[sha256sum] = "4fc61385e9c98d72fcdf47e6dd81833f47b2f77c114c29cd64a361be57a763a2"
PATCH 4/7 python3-aiohttp: patch CVE-2025-69227
In reply to Gyorgy SarvariDetails: https://nvd.nist.gov/vuln/detail/CVE-2025-69227
Backport the patch that is referenced by teh NVD advisory.
--- .../python3-aiohttp/CVE-2025-69227.patch | 148 ++++++++++++++++++ .../python/python3-aiohttp_3.12.15.bb | 1 + 2 files changed, 149 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69227.patch
meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69227.patch new file +148 -0
@@ -0,0 +1,148 @@ +From 635c8c03b609b1099d93fb8ea8c8691624237b0f Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Sat, 3 Jan 2026 04:53:29 +0000 +Subject: [PATCH] Replace asserts with exceptions (#11897) (#11914) + +From: Sam Bull <[email protected]> + +(cherry picked from commit d5bf65f15c0c718b6b95e9bc9d0914a92c51e60f) + +Co-authored-by: J. Nick Koston <[email protected]> + +CVE: CVE-2025-69227 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/bc1319ec3cbff9438a758951a30907b072561259] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + aiohttp/multipart.py | 10 ++++------ + aiohttp/web_request.py | 8 +++----- + tests/test_multipart.py | 12 +++++++++++- + tests/test_web_request.py | 24 +++++++++++++++++++++++- + 4 files changed, 41 insertions(+), 13 deletions(-) + +diff --git a/aiohttp/multipart.py b/aiohttp/multipart.py +index 54dfd48..7783ac5 100644 +--- a/aiohttp/multipart.py ++++ b/aiohttp/multipart.py +@@ -357,11 +357,8 @@ class BodyPartReader: + self._read_bytes += len(chunk) + if self._read_bytes == self._length: + self._at_eof = True +- if self._at_eof: +- clrf = await self._content.readline() +- assert ( +- b"\r\n" == clrf +- ), "reader did not read all the data or it is malformed" ++ if self._at_eof and await self._content.readline() != b"\r\n": ++ raise ValueError("Reader did not read all the data or it is malformed") + return chunk + + async def _read_chunk_from_length(self, size: int) -> bytes: +@@ -390,7 +387,8 @@ class BodyPartReader: + while len(chunk) < self._boundary_len: + chunk += await self._content.read(size) + self._content_eof += int(self._content.at_eof()) +- assert self._content_eof < 3, "Reading after EOF" ++ if self._content_eof > 2: ++ raise ValueError("Reading after EOF") + if self._content_eof: + break + if len(chunk) > size: +diff --git a/aiohttp/web_request.py b/aiohttp/web_request.py +index 6e09027..96222b0 100644 +--- a/aiohttp/web_request.py ++++ b/aiohttp/web_request.py +@@ -721,13 +721,13 @@ class BaseRequest(MutableMapping[str, Any], HeadersMixin): + multipart = await self.multipart() + max_size = self._client_max_size + +- field = await multipart.next() +- while field is not None: ++ while (field := await multipart.next()) is not None: + size = 0 + field_ct = field.headers.get(hdrs.CONTENT_TYPE) + + if isinstance(field, BodyPartReader): +- assert field.name is not None ++ if field.name is None: ++ raise ValueError("Multipart field missing name.") + + # Note that according to RFC 7578, the Content-Type header + # is optional, even for files, so we can't assume it's +@@ -779,8 +779,6 @@ class BaseRequest(MutableMapping[str, Any], HeadersMixin): + raise ValueError( + "To decode nested multipart you need to use custom reader", + ) +- +- field = await multipart.next() + else: + data = await self.read() + if data: +diff --git a/tests/test_multipart.py b/tests/test_multipart.py +index 75b73a7..5351945 100644 +--- a/tests/test_multipart.py ++++ b/tests/test_multipart.py +@@ -221,11 +221,21 @@ class TestPartReader: + with Stream(data) as stream: + obj = aiohttp.BodyPartReader(BOUNDARY, {}, stream) + result = b"" +- with pytest.raises(AssertionError): ++ with pytest.raises(ValueError): + for _ in range(4): + result += await obj.read_chunk(7) + assert data == result + ++ async def test_read_with_content_length_malformed_crlf(self) -> None: ++ # Content-Length is correct but data after content is not \r\n ++ content = b"Hello" ++ h = CIMultiDictProxy(CIMultiDict({"CONTENT-LENGTH": str(len(content))})) ++ # Malformed: "XX" instead of "\r\n" after content ++ with Stream(content + b"XX--:--") as stream: ++ obj = aiohttp.BodyPartReader(BOUNDARY, h, stream) ++ with pytest.raises(ValueError, match="malformed"): ++ await obj.read() ++ + async def test_read_boundary_with_incomplete_chunk(self) -> None: + with Stream(b"") as stream: + +diff --git a/tests/test_web_request.py b/tests/test_web_request.py +index da80ca9..125b95e 100644 +--- a/tests/test_web_request.py ++++ b/tests/test_web_request.py +@@ -10,6 +10,7 @@ from multidict import CIMultiDict, CIMultiDictProxy, MultiDict + from yarl import URL + + from aiohttp import HttpVersion ++from aiohttp.base_protocol import BaseProtocol + from aiohttp.http_parser import RawRequestMessage + from aiohttp.streams import StreamReader + from aiohttp.test_utils import make_mocked_request +@@ -815,7 +816,28 @@ async def test_multipart_formdata(protocol) -> None: + assert dict(result) == {"a": "b", "c": "d"} + + +-async def test_multipart_formdata_file(protocol) -> None: ++async def test_multipart_formdata_field_missing_name(protocol: BaseProtocol) -> None: ++ # Ensure ValueError is raised when Content-Disposition has no name ++ payload = StreamReader(protocol, 2**16, loop=asyncio.get_event_loop()) ++ payload.feed_data( ++ b"-----------------------------326931944431359\r\n" ++ b"Content-Disposition: form-data\r\n" # Missing name! ++ b"\r\n" ++ b"value\r\n" ++ b"-----------------------------326931944431359--\r\n" ++ ) ++ content_type = ( ++ "multipart/form-data; boundary=---------------------------326931944431359" ++ ) ++ payload.feed_eof() ++ req = make_mocked_request( ++ "POST", "/", headers={"CONTENT-TYPE": content_type}, payload=payload ++ ) ++ with pytest.raises(ValueError, match="Multipart field missing name"): ++ await req.post() ++ ++ ++async def test_multipart_formdata_file(protocol: BaseProtocol) -> None: + # Make sure file uploads work, even without a content type + payload = StreamReader(protocol, 2**16, loop=asyncio.get_event_loop()) + payload.feed_data(
meta-python/recipes-devtools/python/python3-aiohttp_3.12.15.bb +1 -0
@@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=748073912af33aa59430d3702aa32d41" SRC_URI += "file://CVE-2025-69224.patch \ file://CVE-2025-69225.patch \ file://CVE-2025-69226.patch \ + file://CVE-2025-69227.patch \ " SRC_URI[sha256sum] = "4fc61385e9c98d72fcdf47e6dd81833f47b2f77c114c29cd64a361be57a763a2"
PATCH 5/7 python3-aiohttp: patch CVE-2025-69228
In reply to Gyorgy SarvariDetails: https://nvd.nist.gov/vuln/detail/CVE-2025-69228
Backport the patch that is referenced by the NVD advisory.
--- .../python3-aiohttp/CVE-2025-69228.patch | 47 +++++++++++++++++++ .../python/python3-aiohttp_3.12.15.bb | 1 + 2 files changed, 48 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69228.patch
meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69228.patch new file +47 -0
@@ -0,0 +1,47 @@ +From 8426e0e6df8a3481c7482d4fbce749bfe77e2e44 Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Sat, 3 Jan 2026 02:48:45 +0000 +Subject: [PATCH] Enforce client_max_size over entire multipart form (#11889) + (#11908) + +From: Sam Bull <[email protected]> + +(cherry picked from commit ed90718fab5d34c127a283e10385f19440df7dd0) + +CVE: CVE-2025-69228 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/b7dbd35375aedbcd712cbae8ad513d56d11cce60] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + aiohttp/web_request.py | 2 +- + tests/test_web_functional.py | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/aiohttp/web_request.py b/aiohttp/web_request.py +index 96222b0..b5fa40c 100644 +--- a/aiohttp/web_request.py ++++ b/aiohttp/web_request.py +@@ -721,8 +721,8 @@ class BaseRequest(MutableMapping[str, Any], HeadersMixin): + multipart = await self.multipart() + max_size = self._client_max_size + ++ size = 0 + while (field := await multipart.next()) is not None: +- size = 0 + field_ct = field.headers.get(hdrs.CONTENT_TYPE) + + if isinstance(field, BodyPartReader): +diff --git a/tests/test_web_functional.py b/tests/test_web_functional.py +index c33b3ce..8ec237b 100644 +--- a/tests/test_web_functional.py ++++ b/tests/test_web_functional.py +@@ -1705,8 +1705,8 @@ async def test_app_max_client_size(aiohttp_client) -> None: + await resp.release() + + +-async def test_app_max_client_size_adjusted(aiohttp_client) -> None: +- async def handler(request): ++async def test_app_max_client_size_adjusted(aiohttp_client: AiohttpClient) -> None: ++ async def handler(request: web.Request) -> web.Response: + await request.post() + return web.Response(body=b"ok") +
meta-python/recipes-devtools/python/python3-aiohttp_3.12.15.bb +1 -0
@@ -8,6 +8,7 @@ SRC_URI += "file://CVE-2025-69224.patch \ file://CVE-2025-69225.patch \ file://CVE-2025-69226.patch \ file://CVE-2025-69227.patch \ + file://CVE-2025-69228.patch \ " SRC_URI[sha256sum] = "4fc61385e9c98d72fcdf47e6dd81833f47b2f77c114c29cd64a361be57a763a2"
PATCH 6/7 python3-aiohttp: patch CVE-2025-69229
In reply to Gyorgy SarvariDetails: https://nvd.nist.gov/vuln/detail/CVE-2025-69229
Backport the patches referenced by the NVD advisory.
--- .../python3-aiohttp/CVE-2025-69229-1.patch | 111 ++++++++ .../python3-aiohttp/CVE-2025-69229-2.patch | 255 ++++++++++++++++++ .../python/python3-aiohttp_3.12.15.bb | 2 + 3 files changed, 368 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69229-1.patch create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69229-2.patch
meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69229-1.patch new file +111 -0
@@ -0,0 +1,111 @@ +From 9e03b5732805f3cf3c5c249761e2fb8ace2223d3 Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Sat, 3 Jan 2026 03:57:17 +0000 +Subject: [PATCH 1/2] Use collections.deque for chunk splits (#11892) (#11912) + +From: Sam Bull <[email protected]> + +(cherry picked from commit 271532ea355c65480c8ecc14137dfbb72aec8f6f) + +--------- + +Co-authored-by: Finder <[email protected]> + +CVE: CVE-2025-69229 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/dc3170b56904bdf814228fae70a5501a42a6c712] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + aiohttp/streams.py | 8 ++++---- + tests/test_http_parser.py | 14 +++++++++----- + 2 files changed, 13 insertions(+), 9 deletions(-) + +diff --git a/aiohttp/streams.py b/aiohttp/streams.py +index 7a3f64d..108257e 100644 +--- a/aiohttp/streams.py ++++ b/aiohttp/streams.py +@@ -148,7 +148,7 @@ class StreamReader(AsyncStreamReaderMixin): + self._loop = loop + self._size = 0 + self._cursor = 0 +- self._http_chunk_splits: Optional[List[int]] = None ++ self._http_chunk_splits: Optional[Deque[int]] = None + self._buffer: Deque[bytes] = collections.deque() + self._buffer_offset = 0 + self._eof = False +@@ -295,7 +295,7 @@ class StreamReader(AsyncStreamReaderMixin): + raise RuntimeError( + "Called begin_http_chunk_receiving when some data was already fed" + ) +- self._http_chunk_splits = [] ++ self._http_chunk_splits = collections.deque() + + def end_http_chunk_receiving(self) -> None: + if self._http_chunk_splits is None: +@@ -454,7 +454,7 @@ class StreamReader(AsyncStreamReaderMixin): + raise self._exception + + while self._http_chunk_splits: +- pos = self._http_chunk_splits.pop(0) ++ pos = self._http_chunk_splits.popleft() + if pos == self._cursor: + return (b"", True) + if pos > self._cursor: +@@ -527,7 +527,7 @@ class StreamReader(AsyncStreamReaderMixin): + chunk_splits = self._http_chunk_splits + # Prevent memory leak: drop useless chunk splits + while chunk_splits and chunk_splits[0] < self._cursor: +- chunk_splits.pop(0) ++ chunk_splits.popleft() + + if self._size < self._low_water and self._protocol._reading_paused: + self._protocol.resume_reading() +diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py +index d4c1768..b9d917f 100644 +--- a/tests/test_http_parser.py ++++ b/tests/test_http_parser.py +@@ -1223,7 +1223,8 @@ def test_http_request_chunked_payload(parser) -> None: + parser.feed_data(b"4\r\ndata\r\n4\r\nline\r\n0\r\n\r\n") + + assert b"dataline" == b"".join(d for d in payload._buffer) +- assert [4, 8] == payload._http_chunk_splits ++ assert payload._http_chunk_splits is not None ++ assert [4, 8] == list(payload._http_chunk_splits) + assert payload.is_eof() + + +@@ -1238,7 +1239,8 @@ def test_http_request_chunked_payload_and_next_message(parser) -> None: + ) + + assert b"dataline" == b"".join(d for d in payload._buffer) +- assert [4, 8] == payload._http_chunk_splits ++ assert payload._http_chunk_splits is not None ++ assert [4, 8] == list(payload._http_chunk_splits) + assert payload.is_eof() + + assert len(messages) == 1 +@@ -1262,12 +1264,13 @@ def test_http_request_chunked_payload_chunks(parser) -> None: + parser.feed_data(b"test: test\r\n") + + assert b"dataline" == b"".join(d for d in payload._buffer) +- assert [4, 8] == payload._http_chunk_splits ++ assert payload._http_chunk_splits is not None ++ assert [4, 8] == list(payload._http_chunk_splits) + assert not payload.is_eof() + + parser.feed_data(b"\r\n") + assert b"dataline" == b"".join(d for d in payload._buffer) +- assert [4, 8] == payload._http_chunk_splits ++ assert [4, 8] == list(payload._http_chunk_splits) + assert payload.is_eof() + + +@@ -1278,7 +1281,8 @@ def test_parse_chunked_payload_chunk_extension(parser) -> None: + parser.feed_data(b"4;test\r\ndata\r\n4\r\nline\r\n0\r\ntest: test\r\n\r\n") + + assert b"dataline" == b"".join(d for d in payload._buffer) +- assert [4, 8] == payload._http_chunk_splits ++ assert payload._http_chunk_splits is not None ++ assert [4, 8] == list(payload._http_chunk_splits) + assert payload.is_eof() + +
meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69229-2.patch new file +255 -0
255 lines not on this page · raw message
meta-python/recipes-devtools/python/python3-aiohttp_3.12.15.bb +2 -0
@@ -9,6 +9,8 @@ SRC_URI += "file://CVE-2025-69224.patch \ file://CVE-2025-69226.patch \ file://CVE-2025-69227.patch \ file://CVE-2025-69228.patch \ + file://CVE-2025-69229-1.patch \ + file://CVE-2025-69229-2.patch \ " SRC_URI[sha256sum] = "4fc61385e9c98d72fcdf47e6dd81833f47b2f77c114c29cd64a361be57a763a2"
PATCH 7/7 python3-aiohttp: patch CVE-2025-69230
In reply to Gyorgy SarvariDetails: https://nvd.nist.gov/vuln/detail/CVE-2025-69230
Backport the patch referenced by the NVD advisory.
The tests were only partially backported, as the original patch touched some tests that don't exist in this version.
--- .../python3-aiohttp/CVE-2025-69230.patch | 85 +++++++++++++++++++ .../python/python3-aiohttp_3.12.15.bb | 1 + 2 files changed, 86 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69230.patch
meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69230.patch new file +85 -0
@@ -0,0 +1,85 @@ +From 811f8df8521b0850f5c79931e2e8c17113dda421 Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Sat, 3 Jan 2026 02:53:03 +0000 +Subject: [PATCH] Log once per cookie header (#11909) + +From: patchback[bot] <45432694+patchback[bot]@users.noreply.github.com> + +**This is a backport of PR #11890 as merged into master +(384a173022c9d057110c1418c5c4ff83a321900f).** + +Co-authored-by: Sam Bull <[email protected]> + +CVE: CVE-2025-69230 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/64629a0834f94e46d9881f4e99c41a137e1f3326] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + aiohttp/_cookie_helpers.py | 8 +++++++- + tests/test_cookie_helpers.py | 8 ++++++-- + tests/test_web_request.py | 17 +++++++++++++++++ + 3 files changed, 30 insertions(+), 3 deletions(-) + +diff --git a/aiohttp/_cookie_helpers.py b/aiohttp/_cookie_helpers.py +index 4e9fc96..4edaa31 100644 +--- a/aiohttp/_cookie_helpers.py ++++ b/aiohttp/_cookie_helpers.py +@@ -181,6 +181,7 @@ def parse_cookie_header(header: str) -> List[Tuple[str, Morsel[str]]]: + i = 0 + n = len(header) + ++ invalid_names = [] + while i < n: + # Use the same pattern as parse_set_cookie_headers to find cookies + match = _COOKIE_PATTERN.match(header, i) +@@ -193,7 +194,7 @@ def parse_cookie_header(header: str) -> List[Tuple[str, Morsel[str]]]: + + # Validate the name + if not key or not _COOKIE_NAME_RE.match(key): +- internal_logger.warning("Can not load cookie: Illegal cookie name %r", key) ++ invalid_names.append(key) + continue + + # Create new morsel +@@ -209,6 +210,11 @@ def parse_cookie_header(header: str) -> List[Tuple[str, Morsel[str]]]: + + cookies.append((key, morsel)) + ++ if invalid_names: ++ internal_logger.debug( ++ "Cannot load cookie. Illegal cookie names: %r", invalid_names ++ ) ++ + return cookies + + +diff --git a/tests/test_cookie_helpers.py b/tests/test_cookie_helpers.py +index 6deef65..28addb2 100644 +--- a/tests/test_cookie_helpers.py ++++ b/tests/test_cookie_helpers.py +@@ -1,5 +1,7 @@ + """Tests for internal cookie helper functions.""" + ++import logging ++ + from http.cookies import ( + CookieError, + Morsel, +@@ -1374,14 +1376,16 @@ def test_parse_cookie_header_illegal_names(caplog: pytest.LogCaptureFixture) -> + """Test parse_cookie_header warns about illegal cookie names.""" + # Cookie name with comma (not allowed in _COOKIE_NAME_RE) + header = "good=value; invalid,cookie=bad; another=test" +- result = parse_cookie_header(header) ++ with caplog.at_level(logging.DEBUG): ++ result = parse_cookie_header(header) + # Should skip the invalid cookie but continue parsing + assert len(result) == 2 + assert result[0][0] == "good" + assert result[0][1].value == "value" + assert result[1][0] == "another" + assert result[1][1].value == "test" +- assert "Can not load cookie: Illegal cookie name 'invalid,cookie'" in caplog.text ++ assert "Cannot load cookie. Illegal cookie name" in caplog.text ++ assert "'invalid,cookie'" in caplog.text + + + @pytest.mark.parametrize(
meta-python/recipes-devtools/python/python3-aiohttp_3.12.15.bb +1 -0
@@ -11,6 +11,7 @@ SRC_URI += "file://CVE-2025-69224.patch \ file://CVE-2025-69228.patch \ file://CVE-2025-69229-1.patch \ file://CVE-2025-69229-2.patch \ + file://CVE-2025-69230.patch \ " SRC_URI[sha256sum] = "4fc61385e9c98d72fcdf47e6dd81833f47b2f77c114c29cd64a361be57a763a2"