public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-aiohttp] f45: Backport fix for CVE-2026-128130
@ 2026-11-20 20:06 Benjamin A. Beasley
  0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-11-20 20:06 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/python-aiohttp
Branch : f45
Commit : 799726959e611c1207c959394dab46b100a6c160
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date   : 2026-11-20T17:15:44+00:00
Stats  : +167/-4 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/python-aiohttp/c/799726959e611c1207c959394dab46b100a6c160?branch=f45

Log:
Backport fix for CVE-2026-128130

---
diff --git a/0001-Fix-Cython-3.3.0-compiler-crash-when-compiling-the-W.patch b/0001-Fix-Cython-3.3.0-compiler-crash-when-compiling-the-W.patch
index 050a767..c2e1820 100644
--- a/0001-Fix-Cython-3.3.0-compiler-crash-when-compiling-the-W.patch
+++ b/0001-Fix-Cython-3.3.0-compiler-crash-when-compiling-the-W.patch
@@ -1,8 +1,8 @@
-From 110336d7669893d05b21566724caef4f89dc2a6f Mon Sep 17 00:00:00 2001
+From 5ff2f56281b190a00a44e57cfad1027a5a691063 Mon Sep 17 00:00:00 2001
 From: Georgefifth <yapisaac0@gmail.com>
 Date: Mon, 24 Aug 2026 09:18:43 +0800
-Subject: [PATCH] Fix Cython 3.3.0 compiler crash when compiling the WebSocket
- reader (#13521)
+Subject: [PATCH 1/2] Fix Cython 3.3.0 compiler crash when compiling the
+ WebSocket reader (#13521)
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
@@ -128,5 +128,5 @@ index ff5a5b362..0b0b8ab10 100644
          data_cstr = data
  
 -- 
-2.55.0
+2.56.1
 

diff --git a/0002-PR-13356-72eaa429-backport-3.14-Stop-handing-back-pi.patch b/0002-PR-13356-72eaa429-backport-3.14-Stop-handing-back-pi.patch
new file mode 100644
index 0000000..27a27d7
--- /dev/null
+++ b/0002-PR-13356-72eaa429-backport-3.14-Stop-handing-back-pi.patch
@@ -0,0 +1,155 @@
+From 368757dfc86a93f7227774befbdbe85eab931418 Mon Sep 17 00:00:00 2001
+From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com>
+Date: Sun, 9 Aug 2026 17:17:34 +0100
+Subject: [PATCH 2/2] [PR #13356/72eaa429 backport][3.14] Stop handing back
+ pipelined requests the parser buffered (#13360)
+
+**This is a backport of PR #13356 as merged into master
+(72eaa429cf89b1e20212590f3e704444239569fb).**
+
+---------
+
+Co-authored-by: Rodrigo Nogueira <rodrigo.b.nogueira@gmail.com>
+---
+ CHANGES/13356.bugfix.rst     |  4 +++
+ aiohttp/http_parser.py       |  2 ++
+ aiohttp/web_protocol.py      |  6 +++++
+ tests/test_http_parser.py    | 18 +++++++++++++
+ tests/test_web_functional.py | 51 ++++++++++++++++++++++++++++++++++++
+ 5 files changed, 81 insertions(+)
+ create mode 100644 CHANGES/13356.bugfix.rst
+
+diff --git a/CHANGES/13356.bugfix.rst b/CHANGES/13356.bugfix.rst
+new file mode 100644
+index 000000000..a96172311
+--- /dev/null
++++ b/CHANGES/13356.bugfix.rst
+@@ -0,0 +1,4 @@
++Fixed requests pipelined behind a request whose upgrade the handler declined
++going unanswered once there were more of them than the per-connection queue
++holds. With the pure-Python parser the same requests were also served more
++than once -- by :user:`rodrigobnogueira`.
+diff --git a/aiohttp/http_parser.py b/aiohttp/http_parser.py
+index 0c9fd086b..79deaf527 100644
+--- a/aiohttp/http_parser.py
++++ b/aiohttp/http_parser.py
+@@ -371,6 +371,8 @@ class HttpParser(abc.ABC, Generic[_MsgT]):
+                     # any preceding body is consumed before the next request
+                     # line. Resumes via feed_data(b"") when the queue drains.
+                     self._tail = data[start_pos:]
++                    # The remainder now lives in self._tail only. Don't return it.
++                    data = EMPTY
+                     break
+                 pos = data.find(SEP, start_pos)
+                 # consume \r\n
+diff --git a/aiohttp/web_protocol.py b/aiohttp/web_protocol.py
+index f1b384434..0fa9c26ac 100644
+--- a/aiohttp/web_protocol.py
++++ b/aiohttp/web_protocol.py
+@@ -774,6 +774,12 @@ class RequestHandler(BaseProtocol):
+                 for msg, payload in messages:
+                     self._request_count += 1
+                     self._messages.append((msg, payload))
++                # Pause the transport, like in data_received().
++                if (
++                    not self._msg_queue_paused
++                    and len(self._messages) >= self._max_msg_queue_size
++                ):
++                    self._pause_msg_queue_reading()
+                 # This shouldn't be possible. If a future refactor results in this
+                 # failing, then the code may need to be updated to set the waiter.
+                 assert self._waiter is None
+diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py
+index fcc1b6018..1ace5a5af 100644
+--- a/tests/test_http_parser.py
++++ b/tests/test_http_parser.py
+@@ -190,6 +190,24 @@ def test_max_msg_queue_size_caps_emitted_messages(
+     assert not upgraded
+ 
+ 
++async def test_max_msg_queue_size_keeps_tail_to_itself(
++    request_cls: type[HttpRequestParser],
++    protocol: BaseProtocol,
++) -> None:
++    """The remainder is buffered for the next feed, so it must not be returned.
++
++    Handing it back as well gives the caller a second copy of bytes the parser
++    is already holding, and both copies get parsed.
++    """
++    loop = asyncio.get_running_loop()
++    parser = _build_request_parser(request_cls, protocol, loop, 4)
++
++    messages, _upgraded, tail = parser.feed_data(_PIPELINED_GET * 10)
++
++    assert len(messages) == 4
++    assert tail == b""
++
++
+ def test_max_msg_queue_size_resumes_after_consume(
+     request_cls: type[HttpRequestParser],
+     protocol: BaseProtocol,
+diff --git a/tests/test_web_functional.py b/tests/test_web_functional.py
+index d126347aa..4298eb70a 100644
+--- a/tests/test_web_functional.py
++++ b/tests/test_web_functional.py
+@@ -1845,6 +1845,57 @@ async def test_http1_pipelined_queue_resumes_after_drain(
+     assert len(handled) == pipelined_requests + 1
+ 
+ 
++async def test_http1_pipelined_behind_declined_upgrade_served_once(
++    aiohttp_server: AiohttpServer,
++) -> None:
++    """Requests pipelined behind a declined upgrade are each served once.
++
++    The bytes following an upgrade request are buffered whole, then re-fed once
++    the handler answers it normally. More of them than the queue holds must
++    still be served, and none of them twice.
++    """
++    pipelined_requests = MAX_MSG_QUEUE_SIZE + 8
++    handled: list[str] = []
++    all_handled = asyncio.Event()
++
++    async def handler(request: web.Request) -> web.Response:
++        handled.append(request.path)
++        if len(handled) == pipelined_requests + 1:
++            all_handled.set()
++        return web.Response()
++
++    app = web.Application()
++    app.router.add_get("/{tail:.*}", handler)
++    server = await aiohttp_server(app)
++
++    def raw_get(path: str) -> bytes:
++        return (
++            f"GET {path} HTTP/1.1\r\nHost: localhost\r\n"
++            "Connection: keep-alive\r\n\r\n"
++        ).encode("ascii")
++
++    # An upgrade the handler answers normally, then the pipeline, in one write.
++    upgrade = (
++        b"GET /upgrade HTTP/1.1\r\nHost: localhost\r\n"
++        b"Connection: Upgrade\r\nUpgrade: websocket\r\n\r\n"
++    )
++
++    reader, writer = await asyncio.open_connection(server.host, server.port)
++    try:
++        writer.write(
++            upgrade + b"".join(raw_get(f"/r{i}") for i in range(pipelined_requests))
++        )
++        await writer.drain()
++        await asyncio.wait_for(all_handled.wait(), 10)
++    finally:
++        writer.close()
++        with suppress(ConnectionResetError, BrokenPipeError):
++            await writer.wait_closed()
++
++    assert len(handled) == pipelined_requests + 1
++    assert len(set(handled)) == len(handled)
++
++
+ async def test_declined_websocket_upgrade_reads_body(
+     aiohttp_server: AiohttpServer,
+ ) -> None:
+-- 
+2.56.1
+

diff --git a/python-aiohttp.spec b/python-aiohttp.spec
index 9156d83..6172af2 100644
--- a/python-aiohttp.spec
+++ b/python-aiohttp.spec
@@ -21,6 +21,14 @@ Source:         %{url}/archive/v%{version}/aiohttp-%{version}.tar.gz
 # Cherry-picked on v3.14.3.
 Patch:          0001-Fix-Cython-3.3.0-compiler-crash-when-compiling-the-W.patch
 
+# [PR #13356/72eaa429 backport][3.14] Stop handing back pipelined requests the
+# parser buffered (#13360)
+#
+# Cherry-picked on v3.14.3.
+#
+# Fixes CVE-2026-128130.
+Patch:          0002-PR-13356-72eaa429-backport-3.14-Stop-handing-back-pi.patch
+
 BuildSystem:    pyproject
 BuildOption(generate_buildrequires): %{shrink:
     requirements/cython.in

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-20 20:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 20:06 [rpms/python-aiohttp] f45: Backport fix for CVE-2026-128130 Benjamin A. Beasley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox