From patchwork Wed Nov 25 05:18:03 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: 105513 Received: from aer-iport-5.cisco.com (aer-iport-5.cisco.com [173.38.203.67]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.36133.1795583897026423651 for ; Tue, 24 Nov 2026 21:18:17 -0800 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=Gzy1PcIG; spf=pass (domain: cisco.com, ip: 173.38.203.67, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=5185; q=dns/txt; s=iport01; t=1795583897; x=1796793497; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8/9+i3uOT09R+6A2wijibB+5/OuslK7r+zgFKyR/a7o=; b=Gzy1PcIGHaiHjAwEhti6exjoNpFYQeT4dD9eY+JYRmbTm/yZD7JhlM0/ FnBl9JBoM1lTUzkonV5vMhd1DsjI2FrURfEZRXTJ4IZpAQgkDBzp4CAga 81NXuAY6VL/Rq9uPk1Jk+tdyyinODLwURQoTBg1FOs7U8z6gWE8LBu5CZ 66GbsbZZh7L98/ucIgJ5cstsPgl0IIm3k14E3Y41H4bobaCmiLmgXiqwO FQ8Ooan/s1MEmGNni7IY81GJAyr1HvKiY3P5dP8EZGogX1veJNVzm0Ock X9c5WFzFCee8Si4GBHQ4aCEqbUXHw6miTWDTd2BqJM2KFkphBdalFPVvo w==; X-CSE-ConnectionGUID: 3hbUYyqwTdukOLt0URVLig== X-CSE-MsgGUID: +gzZ2VvITZ25mfAtpFvWDg== X-IPAS-Result: A0BJAgAhbQZr/9VK/pBaglmCV3VgQ0kDlkgDkVCMWYF+DwEBAQ9EDQQBAYQ/RgKOIgImNAkOAQIEAwIDAQEBAQEBAQEBAQEBCgEBBQEBAQIBBwWBDhOGTw2QEgECAQMnCwEYAS0QHAMBAi8rIwgQCYMCAYJ0AxG6A4F5M4EBgykBgVTbMwELFAGBOIVCiCVdGAGEficbG4FygRWBO4IvgQWBXAICgU+GVQSCIoEMgVSNEwKBSYhSSIEeA1ksAVUTDQoLBwWBaAM1EioVbjIdgSM7F4EHGwYFgRyBHoESgQNdgSsoXQEhgQiBdQKCUYIAAgFJQQ4HRVMJJUMSRyQiCBIJARMaLAqBGjU8CSY/FQxnCxoFYQgCDQx0ORAwHCQvBRkmPBsKgQwnHR4ZDgIpBhYhCzQYDUgRLDcVGQQ+bgeUE4MbgQ4BKgGBNHgWBqM4giGhEQoog3mMJJU6GjOqcguYfY4KlgEDTYRqgWg8gVlwFYMiCUoZD445g2uFE8lIJjICAQgDLwEBBwIHDgMLgWiQAoF8AQE IronPort-Data: A9a23:QPyF5aywDtiVhf35OTN6t+dgxyrEfRIJ4+MujC+fZmUNrF6WrkVSy GROWzvQaP/eNDf9LtAgb4mz9h9QucTQmoc1SlBvrFhgHilAwSbn6Xt1DatR0we6dJCroJdPt p1GAjX4BJlqCCKa/lH9aOWJQUBUjcmgXqD7BPPPJhd/TAplTDZJoR94kobVuKYw6TSCK13L4 4yaT/H3Ygf/hWctaD9MsspvlTs21BjMkGJA1rABTagjUG/2zxE9EJ8ZLKetGHr0KqE8NvK6X evK0Iai9Wrf+Ro3Yvv9+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+vpT2M4nVKtio27hc+adZ zl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CCe5xWuTpfi/xlhJBo2N7Ap6/9oPW1T9 ts8NGgwVC6nhu3jldpXSsE07igiBMDmJsYb/3pn1zycVKxgSpHYSKKM7thdtNsyrpkSQbCEO pZfNmYpNk2bC/FMEg9/5JYWkOSlgnD+YjRwo1OOrq1x6G/WpOB0+Oa1a4GKKozULSlTtgWXt FCcwXrYPiNAadmR4Cad3GyTquCayEsXX6pXTtVU7MVCh0WewGEWAhAaWVa35PW0lEO6c9ZeM FAPvC02oK4/8UamQtXwU1u/unHsg/IHc9NdCag+rQqK0KeRulzfDWkfRTkHY9sj3CMreQEXO payt4uBLVRSXHe9EBpxKp/8QeuOBBUo IronPort-HdrOrdr: A9a23:4CJyU67sqO4nmGH9WgPXwOrXdLJyesId70hD6qm+c3Nom6uj5q eTdZsgtCMc5Ax9ZJhko6HjBEDiewK5yXcK2+ks1N6ZNWGM0ldAbrsSiLcKqAePJ8SRzIJgPN 9bAstDIey1K0RmhsDn5wT9OdMhzN6btJ2Mv47lvhFQpcUAUdAZ0++/YTzra3FLeA== X-Talos-CUID: 9a23:vTgPwmGeb9CYXF1WqmI89EQpK9E8bUHR0XT3B1PgNFxXbLyaHAo= X-Talos-MUID: 9a23:pqVGqw9D6Jh0fxiSnKjhxc6Qf4Rn8Zb0Nl4sradc5syKHDBoFSmioDviFw== X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,232,1787011200"; d="scan'208";a="60337886" Received: from aer-l-core-12.cisco.com ([144.254.74.213]) by aer-iport-5.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 25 Nov 2026 05:18:15 +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 aer-l-core-12.cisco.com (Postfix) with ESMTPS id C3BB718000206; Wed, 25 Nov 2026 05:18:14 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 69465CBF201; Tue, 24 Nov 2026 21:18:13 -0800 (PST) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: Darsh Kelaiya Subject: [oe][meta-python][scarthgap][PATCH 1/9] python3-aiohttp: fix CVE-2026-111750 Date: Tue, 24 Nov 2026 21:18:03 -0800 Message-Id: <20261125051811.2524271-2-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261125051811.2524271-1-dkelaiya@cisco.com> References: <20261125051811.2524271-1-dkelaiya@cisco.com> MIME-Version: 1.0 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: aer-l-core-12.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 25 Nov 2026 05:18:19 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132965 From: Darsh Kelaiya Backport the upstream HEAD request parsing fix [1] to aiohttp 3.9.5, as identified by [2]. Only responses to HEAD may skip their body; incoming HEAD requests must consume the declared request body. Retain the upstream regression that embeds a request in a HEAD body and verifies that the following request remains correctly framed. The pure-Python parser remains available with extensions installed. [1] https://github.com/aio-libs/aiohttp/commit/9b27347e61454d9f8ca2055f4c67a37dee336e83 [2] https://github.com/aio-libs/aiohttp/security/advisories/GHSA-pqxq-w44r-73xw Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-111750.patch | 84 +++++++++++++++++++ .../python/python3-aiohttp_3.9.5.bb | 1 + 2 files changed, 85 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111750.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111750.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111750.patch new file mode 100644 index 0000000000..860b7aec03 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111750.patch @@ -0,0 +1,84 @@ +From 9b27347e61454d9f8ca2055f4c67a37dee336e83 Mon Sep 17 00:00:00 2001 +From: Sam Bull +Date: Wed, 9 Sep 2026 01:25:13 +0100 +Subject: [PATCH] Fix head request parsing (#13671) (#13673) + +CVE: CVE-2026-111750 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/9b27347e61454d9f8ca2055f4c67a37dee336e83] + +Backport Changes: +- Use the existing empty-body helper functions instead of the newer + EMPTY_BODY_* constants, and adapt the explanatory comment. + +(cherry picked from commit 5789546e37fe35af27d0a2f840870b22bc15bfc4) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/13671.bugfix.rst | 1 + + aiohttp/http_parser.py | 6 +++++- + tests/test_http_parser.py | 27 ++++++++++++++++++++++++++- + 3 files changed, 32 insertions(+), 2 deletions(-) + create mode 100644 CHANGES/13671.bugfix.rst + +diff --git a/CHANGES/13671.bugfix.rst b/CHANGES/13671.bugfix.rst +new file mode 100644 +index 0000000..e6fbc70 +--- /dev/null ++++ b/CHANGES/13671.bugfix.rst +@@ -0,0 +1 @@ ++Fixed pure-Python request parser not reading a body in a ``HEAD`` request -- by :user:`Dreamsorcerer`. +diff --git a/aiohttp/http_parser.py b/aiohttp/http_parser.py +index 37a0dff..58f0a50 100644 +--- a/aiohttp/http_parser.py ++++ b/aiohttp/http_parser.py +@@ -420,8 +420,12 @@ class HttpParser(abc.ABC, Generic[_MsgT]): + + assert self.protocol is not None + # calculate payload ++ # https://www.rfc-editor.org/info/rfc9112/#name-message-body-length ++ # https://www.rfc-editor.org/info/rfc9110/#section-9.3.1-6 ++ # Empty-body methods should only apply to responses. ++ # self.method is None on request parser. + empty_body = status_code_must_be_empty_body(code) or bool( +- method and method_must_be_empty_body(method) ++ self.method and method_must_be_empty_body(self.method) + ) + if not empty_body and ( + ((length is not None and length > 0) or msg.chunked) +diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py +index b29518a..d08698a 100644 +--- a/tests/test_http_parser.py ++++ b/tests/test_http_parser.py +@@ -1537,7 +1537,32 @@ def test_http_request_chunked_payload_and_next_message(parser) -> None: + assert not payload2.is_eof() + + +-def test_http_request_chunked_payload_chunks(parser) -> None: ++def test_http_request_parser_head_with_content_length_payload( ++ parser: HttpRequestParser, ++) -> None: ++ smuggled = b"GET /smuggled HTTP/1.1\r\nHost: a\r\n\r\n" ++ text = ( ++ b"HEAD /test HTTP/1.1\r\nHost: a\r\nContent-Length: %d\r\n\r\n" % len(smuggled) ++ + smuggled ++ + b"POST /next HTTP/1.1\r\nHost: a\r\nContent-Length: 0\r\n\r\n" ++ ) ++ messages, upgraded, tail = parser.feed_data(text) ++ ++ assert len(messages) == 2 ++ msg, payload = messages[0] ++ assert msg.method == "HEAD" ++ assert b"".join(payload._buffer) == smuggled ++ assert payload.is_eof() ++ ++ msg2, payload2 = messages[1] ++ assert msg2.method == "POST" ++ assert msg2.path == "/next" ++ assert payload2.is_eof() ++ assert not upgraded ++ assert not tail ++ ++ ++def test_http_request_chunked_payload_chunks(parser: HttpRequestParser) -> None: + text = b"GET /test HTTP/1.1\r\n" b"transfer-encoding: chunked\r\n\r\n" + msg, payload = parser.feed_data(text)[0][0] + diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb index 893d5124f7..3c9a82b012 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb @@ -36,6 +36,7 @@ SRC_URI += "file://CVE-2024-52304.patch \ file://CVE-2026-54279.patch \ file://CVE-2026-54273_p1.patch \ file://CVE-2026-54273_p2.patch \ + file://CVE-2026-111750.patch \ " CVE_STATUS[CVE-2026-34515] = "not-applicable-platform: Vulnerability only affects applications running on Windows" From patchwork Wed Nov 25 05:18:04 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: 105515 Received: from aer-iport-7.cisco.com (aer-iport-7.cisco.com [173.38.203.69]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.36178.1795583898954195692 for ; Tue, 24 Nov 2026 21:18:19 -0800 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=lyLx1QAI; spf=pass (domain: cisco.com, ip: 173.38.203.69, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=9866; q=dns/txt; s=iport01; t=1795583899; x=1796793499; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GxgHw/h9pIXjubyKRU85SXvfG/XlBoRCH0VD0P2kIg4=; b=lyLx1QAI6zQOfaTSQ8PlcU8pyVrUB6Sw5BM53eVCeofmfw7YqLnuXuYW sB9hHh+QdPj20jB1iHHUdhqatdRC+jzeQFLY3JksXKeq0ji494w+hz372 cHbPJvQEwyCJUEFNwi1dS0X4tGfr+cvIjfsRsxdIWR+misKo1sAEVUVFU 09GGOd62nl6RK1hlEYZeWAXUEdjJkI1ZBn4XG9ucO5NIfF3Xy4gwcuhdq rbHx1R6Hs2lYfhfW3xI8VHHec5HZs8CWkZdMrvZ8nislkr549z3R6cQu0 rNozLnQP7Q8B75fhPfura0NRwAzN5l2XJi6inKeoe1ltr1z/jo8jPhJFd g==; X-CSE-ConnectionGUID: /V/e9MkPRqm07MESVp35fg== X-CSE-MsgGUID: 5xcxeXVmTHeJCemEMLwXng== X-IPAS-Result: A0BJAgAhbQZr/9VK/pBRCYJZgld1YENJA5ZIA54pgX4PAQEBD0QNBAEBhD9GAo4iAiY0CQ4BAgQDAgMBAQEBAQEBAQEBAQEKAQEFAQEBAgEHBYEOE4ZPDZASAQIBAycLARgBLRAcAwECLysjCBmDAgGCdAMRugOBeTOBAYMpAYFU2zMBCxQBgTiFQoglXRgBhH4nGxuBcoEVgTuCL4EFgVwBAYEnDYZyBIIigQyBVIELjAgCgUmIUkiBHgNZLAFVEw0KCwcFgWgDNRIqFW4yHYEjOxeBBxsGBYEcgR6BEoEDXYErKF0BIYEIgXUCglGCAAIBSUEOB0VTCSVDEkckIggSCQETGiwKgRo1PAkmPxUMZwsaBWEIAg0MdDkQMBwkLwUZJjwbCoEMJx0eGQ4CKQYWIQs0GA1IESw3FRkEPm4HlBMVgwYtVA0BKgGBfRAfHB6SfQGQHIIhoREKKIN5jCSVOhozhVulFwuYfYVTgy6CNoJTlVd6hGqBaDyBWXAVgyIJShkPWI1WCwuDYIVkyHcmMgIJAy8BAQcCBw4DC4FokACBfgEB IronPort-Data: A9a23:/meN7a1RtnV8de/S0/bD5YRwkn2cJEfYwER7XKvMYLTBsI5bpzJVz TRJXj3SbK6PMzfyftsnPduy/UxUupXTx4VmTVFu3Hw8FHgiRegpqji6wuYcGwvIc6UvmWo+t 512huHodZ5yEzmE4Ef3b9ANlFEkvYmQXL3wFeXYDS54QA5gWU8JhAlq8wIDqtYAbeORXUXX5 rsen+WFYAX7gmcubzpNg06+gEoHUMra6WtwUmMWPZinjHeG/1EJAZQWI72GLneQauF8Au6gS u/f+6qy92Xf8g1FIovNfmHTKxBirhb6ZGBiu1IOM0SQqkEqSh8ajs7XAMEhhXJ/0F1lqTzeJ OJl7vRcQS9xVkHFdX90vxNwS0mSNoUekFPLzOTWXcG7lyX7n3XQL/pGS39xMNw9+d5NGGQWq tk1Ew4VNU2NiLfjqF67YrEEasULJcTxeYdasXZ6wHSAV7AtQIvIROPB4towMDUY35wSW6yDO 4xGNXw1NU+ojx5nYj/7DLoyn+qsj3juehVTqUmeouw85G27IAlZjuOzaoeNJIbiqcN9w1aTt m/2wWHFIhw4H9Ga5B+h7UKqibqa9c/8cMdIfFGizdZtmFCVy2kZBREaWFf+rfSnh0qWX9NEN 1dS/TIjq6U3/kGnQtTxGRqirxa5UgU0UtdKVul/4waXx++NuUCSB3MPSXhKb9lOWNIKeAHGH 2Shx7vBbQGDepXMIZ5B3t94dQ+PBBU= IronPort-HdrOrdr: A9a23:C8P5xaMNNXqSg8BcTuOjsMiBIKoaSvp037Dk7S9MoHtuA6ulfq +V/cjzuSWYtN9VYgBDpTniAtjlfZqjz/5ICOAqVN/INjUO+lHYSb2KhrGN/9SPIUHDH5ZmpM RdWpk7LsHsBl5nisu/ygy5H9E8hOSjysmT9IHjJ7MHd3ATV0mmhD0JczqmLg== X-Talos-CUID: 9a23:PAIutmy31sI5RrDH3PM8BgVTJIcoI1je9E3JJhfnLEtSdqXOFFGfrfY= X-Talos-MUID: 9a23:fnoTugVq8Sejl8vq/GL8jyFvBPlt34SjKmsAlLgjn9a0MyMlbg== X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,232,1787011200"; d="scan'208";a="63625062" Received: from aer-l-core-12.cisco.com ([144.254.74.213]) by aer-iport-7.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 25 Nov 2026 05:18:15 +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 aer-l-core-12.cisco.com (Postfix) with ESMTPS id C59521800035D; Wed, 25 Nov 2026 05:18:14 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 6DDDCCBF202; Tue, 24 Nov 2026 21:18:13 -0800 (PST) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: Darsh Kelaiya Subject: [oe][meta-python][scarthgap][PATCH 2/9] python3-aiohttp: fix CVE-2026-111749 Date: Tue, 24 Nov 2026 21:18:04 -0800 Message-Id: <20261125051811.2524271-3-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261125051811.2524271-1-dkelaiya@cisco.com> References: <20261125051811.2524271-1-dkelaiya@cisco.com> MIME-Version: 1.0 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: aer-l-core-12.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 25 Nov 2026 05:18:20 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132968 From: Darsh Kelaiya Backport the upstream host-only cookie state fix [1] to aiohttp 3.9.5, as identified by [2]. Track host-only state by domain, path and name so expiring another cookie cannot widen its domain scope. Preserve this identity during filtering, replacement and JSON persistence. Adapt regression assertions to the existing private state because 3.9.5 lacks the newer public inspection property. [1] https://github.com/aio-libs/aiohttp/commit/6a07c171ef9f3be583e2907dcd1931372efca8d6 [2] https://github.com/aio-libs/aiohttp/security/advisories/GHSA-gx76-c99x-2c96 Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-111749.patch | 197 ++++++++++++++++++ .../python/python3-aiohttp_3.9.5.bb | 1 + 2 files changed, 198 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111749.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111749.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111749.patch new file mode 100644 index 0000000000..2a67cf3542 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111749.patch @@ -0,0 +1,197 @@ +From 6a07c171ef9f3be583e2907dcd1931372efca8d6 Mon Sep 17 00:00:00 2001 +From: Sam Bull +Date: Wed, 9 Sep 2026 02:21:06 +0100 +Subject: [PATCH] Fix host-only state on cookie expiration (#13674) (#13676) + +CVE: CVE-2026-111749 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/6a07c171ef9f3be583e2907dcd1931372efca8d6] + +Backport Changes: +- Apply marker deletion in clear() because 3.9.5 predates the + _delete_cookies() helper, and preserve its untrimmed path keys. + Root cookie markers therefore use "/" instead of an empty path. +- Use 3.9.5 Set/Tuple annotations and update_cookies(SimpleCookie) + calls; adapt regressions to private _host_only_cookies assertions. +- Omit public host_only_cookies annotations and documentation in + CookieJar, DummyCookieJar and AbstractCookieJar, and the associated + test-jar/property changes; those interfaces are absent in 3.9.5. + +(cherry picked from commit 9332972cfcb0f5a2b6677e7307819ab8f13b5d09) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/13674.bugfix.rst | 1 + + aiohttp/cookiejar.py | 25 +++++++++------- + tests/test_cookiejar.py | 62 +++++++++++++++++++++++++++++++++++++++- + 3 files changed, 76 insertions(+), 12 deletions(-) + create mode 100644 CHANGES/13674.bugfix.rst + +diff --git a/CHANGES/13674.bugfix.rst b/CHANGES/13674.bugfix.rst +new file mode 100644 +index 0000000..5152bce +--- /dev/null ++++ b/CHANGES/13674.bugfix.rst +@@ -0,0 +1 @@ ++Fixed host-only cookie state being lost on expiration -- by :user:`Dreamsorcerer`. +diff --git a/aiohttp/cookiejar.py b/aiohttp/cookiejar.py +index 4f694b6..0800a53 100644 +--- a/aiohttp/cookiejar.py ++++ b/aiohttp/cookiejar.py +@@ -124,7 +124,8 @@ class CookieJar(AbstractCookieJar): + self._cookies: DefaultDict[Tuple[str, str], SimpleCookie] = defaultdict( + SimpleCookie + ) +- self._host_only_cookies: Set[Tuple[str, str]] = set() ++ # Cookie identity is (domain, path, name). ++ self._host_only_cookies: Set[Tuple[str, str, str]] = set() + self._unsafe = unsafe + self._quote_cookie = quote_cookie + if treat_as_secure_origin is None: +@@ -167,7 +168,7 @@ class CookieJar(AbstractCookieJar): + 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: ++ if (domain, path, 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 +@@ -256,7 +257,7 @@ class CookieJar(AbstractCookieJar): + to_del.append(key) + + for domain, path, name in to_del: +- self._host_only_cookies.discard((domain, name)) ++ self._host_only_cookies.discard((domain, path, name)) + key = (domain, path, name) + if key in self._expirations: + del self._expirations[(domain, path, name)] +@@ -310,18 +311,12 @@ class CookieJar(AbstractCookieJar): + domain = "" + del cookie["domain"] + +- if not domain and hostname is not None: +- # Set the cookie's domain to the response hostname +- # and set its host-only-flag +- self._host_only_cookies.add((hostname, name)) +- domain = cookie["domain"] = hostname +- + if domain.startswith("."): + # Remove leading dot + domain = domain[1:] + cookie["domain"] = domain + +- if hostname and not self._is_domain_match(domain, hostname): ++ if domain and hostname and not self._is_domain_match(domain, hostname): + # Setting cookies for different domains is not allowed + continue + +@@ -336,6 +331,14 @@ class CookieJar(AbstractCookieJar): + path = "/" + path[1 : path.rfind("/")] + cookie["path"] = path + ++ if not domain and hostname is not None: ++ self._host_only_cookies.add((hostname, path, name)) ++ domain = cookie["domain"] = hostname ++ else: ++ # A cookie with an explicit Domain attribute replaces any ++ # host-only cookie with the same (domain, path, name) identity. ++ self._host_only_cookies.discard((domain, path, name)) ++ + max_age = cookie["max-age"] + if max_age: + try: +@@ -393,7 +396,7 @@ class CookieJar(AbstractCookieJar): + if not self._unsafe and is_ip_address(hostname): + continue + +- if (domain, name) in self._host_only_cookies: ++ if (domain, cookie["path"], name) in self._host_only_cookies: + if domain != hostname: + continue + elif not self._is_domain_match(domain, hostname): +diff --git a/tests/test_cookiejar.py b/tests/test_cookiejar.py +index df59759..3e344c2 100644 +--- a/tests/test_cookiejar.py ++++ b/tests/test_cookiejar.py +@@ -868,6 +868,44 @@ async def test_treat_as_secure_origin() -> None: + assert len(filtered_cookies) == 1 + + ++async def test_host_only_marker_survives_same_name_expiry_on_other_path() -> None: ++ """Expiring a same-name cookie on another path must not clear host-only state.""" ++ jar = CookieJar() ++ origin = URL("http://auth.example.com/") ++ subdomain = URL("http://evil.auth.example.com/") ++ ++ jar.update_cookies(SimpleCookie("sid=secret; Path=/"), origin) ++ assert "sid" not in jar.filter_cookies(subdomain) ++ ++ # Attacker-controlled descendant expires a same-name cookie on its own path. ++ jar.update_cookies( ++ SimpleCookie("sid=gone; Domain=auth.example.com; Path=/attacker; Max-Age=0"), ++ subdomain, ++ ) ++ ++ assert ("auth.example.com", "/", "sid") in jar._host_only_cookies ++ assert "sid" not in jar.filter_cookies(subdomain) ++ assert jar.filter_cookies(origin)["sid"].value == "secret" ++ ++ ++async def test_explicit_domain_replacement_clears_host_only_marker() -> None: ++ """A replacing cookie with an explicit Domain is a domain cookie.""" ++ jar = CookieJar() ++ origin = URL("http://example.com/") ++ subdomain = URL("http://sub.example.com/") ++ ++ jar.update_cookies(SimpleCookie("sid=hostonly; Path=/"), origin) ++ assert ("example.com", "/", "sid") in jar._host_only_cookies ++ assert "sid" not in jar.filter_cookies(subdomain) ++ ++ jar.update_cookies( ++ SimpleCookie("sid=domainwide; Domain=example.com; Path=/"), origin ++ ) ++ ++ assert jar._host_only_cookies == set() ++ assert jar.filter_cookies(subdomain)["sid"].value == "domainwide" ++ ++ + # === Security tests for restricted unpickler and JSON save/load === + + +@@ -994,7 +1032,7 @@ async def test_save_load_json_preserves_host_only_scope(tmp_path: Path) -> None: + jar_load = CookieJar() + jar_load.load(file_path=file_path) + +- assert jar_load._host_only_cookies == {("auth.example.com", "sid")} ++ assert jar_load._host_only_cookies == {("auth.example.com", "/", "sid")} + assert "sid" not in jar_load.filter_cookies(subdomain) + assert "sid" in jar_load.filter_cookies(issuer) + +@@ -1020,6 +1058,28 @@ async def test_save_load_json_domain_cookie_still_matches_subdomain( + assert "sid" in jar_load.filter_cookies(subdomain) + + ++async def test_save_load_json_host_only_per_path(tmp_path: Path) -> None: ++ """Verify save/load keeps host-only state per (domain, path, name).""" ++ file_path = tmp_path / "per_path.json" ++ origin = URL("https://example.com/") ++ subdomain = URL("https://sub.example.com/") ++ ++ jar_save = CookieJar() ++ jar_save.update_cookies(SimpleCookie("sid=hostonly; Path=/"), origin) ++ jar_save.update_cookies( ++ SimpleCookie("sid=domainwide; Domain=example.com; Path=/api"), origin ++ ) ++ jar_save.save(file_path=file_path) ++ ++ jar_load = CookieJar() ++ jar_load.load(file_path=file_path) ++ ++ assert jar_load._host_only_cookies == {("example.com", "/", "sid")} ++ assert "sid" not in jar_load.filter_cookies(subdomain) ++ filtered = jar_load.filter_cookies(URL("https://sub.example.com/api/x")) ++ assert filtered["sid"].value == "domainwide" ++ ++ + 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" diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb index 3c9a82b012..90475a5aff 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb @@ -37,6 +37,7 @@ SRC_URI += "file://CVE-2024-52304.patch \ file://CVE-2026-54273_p1.patch \ file://CVE-2026-54273_p2.patch \ file://CVE-2026-111750.patch \ + file://CVE-2026-111749.patch \ " CVE_STATUS[CVE-2026-34515] = "not-applicable-platform: Vulnerability only affects applications running on Windows" From patchwork Wed Nov 25 05:18:05 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: 105518 Received: from aer-iport-6.cisco.com (aer-iport-6.cisco.com [173.38.203.68]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.36179.1795583899216529360 for ; Tue, 24 Nov 2026 21:18:20 -0800 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=BZ5mIAfF; spf=pass (domain: cisco.com, ip: 173.38.203.68, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=28734; q=dns/txt; s=iport01; t=1795583900; x=1796793500; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lUS8E2udqwVe0PHaSk4NIOqE7T635Vs1gh2Vhh+qB68=; b=BZ5mIAfFLG79lyUyeKSsLoAU+XmnYUv18CTwcZTxui3Y8QImAAPEr6GK NGEyZVigLZNZsUtFRubYnch6sZNHwAiiWkds5c9z2frkQZfEUpCfAc/ls +mbgp1bfp2HQI3ljduUdaVm5fVtpAdF7YFGPzEasxhRINxtvfgdw7gYad IuXmWjokIAEHAnQfn9w22Tns9z1MWIPcQgmhPEjgaSLI/HXo9GqQGvmz+ 5DDUMnbXyuWbFzesUj/OB62MXsmDt/XgQUyXUZ4aT8O1s7Uo7m48f5EB5 OuZnNHQlAmyDaT/89ofE5z599IAQJz+gMlreTQKhbKSZ6K2NmoCy4pjMf g==; X-CSE-ConnectionGUID: vtba2UBKS+mMhm7m9tHHOQ== X-CSE-MsgGUID: ksKERKKxTwu9IVKANq3AiA== X-IPAS-Result: A0AbAAAhbQZr/9FK/pBaHAEBAQEBAQcBARIBAQQEAQFMgTAHAQELAYJWdWBDSQOEVIgbiVkDgROKU4VqjFkUgRADVw8BAQEPRA0EAQGEMA9GAk8VjT4CJjQJDgECBAMCAwEBAQEBAQEBAQEBAQoBAQUBAQECAQcFgQ4Thk8NkBIBAgEDGgkECwEWAgEtEBwDAQIDAiYCAiALGgkIEAkagmgBgjoDNwMRugN6fzOBAYMpAUNBUNhMDYJaAQsUAYEKLgGFQYMAIAGFBF0YAYR+JxsbgXKBFYE7gTl2gQVLAQFNQgEBAQEBF4EsAoN0gmoEgg0VgQyBVH0OgheDFQOGWQKBSYUhgzFIgQIcA1ksAVUTDQoLBwWBaAM1EioVbjIdgSM7Fy9YGwYFgRyBHoESgQNdgSsoXQEhgQiBdQKCUYIAAgFJQQ4HRVMJJUMSRyQiCBIJARMaLAqBGjU8CSY/FQxnCxoFYQgCDQx0ORAwHCQvBRkmPBsKgQwnHR4ZDgIpBhYhCzQYDUgRLDcVGQQ9AW4HlBODFAYBAWAtAQcDEQ4BARcJAjsoDA8UGQgFHg0DCwETBQYJAgsCBCySVxACOgqPWYIhgTWeHk1xCiiDeYwkjz6FfBozhASBV4s9A4cDklQLmH2CWYJ6hWSCU4QKkVQLCw0DTYRqgWg8OYEgcBWDIglKGQ+OKw4Lg2CCNoJdyUgmMgIBCAMvAQEHAgcOAwuBaIRhiyEtgU8BAQ IronPort-Data: A9a23:qITmHaP9/6QBTE3vrR3ylsFynXyQoLVcMsEvi/4bfWQNrUokhDAOm jNMXWCAO/uONmv8KIx1Otnn9B8PvpTczdFkT3M5pCpnJ55oRWUpJjg4wmPYZX76whjrFRo/h ykmQoCeap1yFjmM/ErF3oHJ9RFUzbuPSqf3FNnKMyVwQR4MYCo6gHqPocZh6mJTqYb/WVzlV e/a+ZWFZgb8gWMsawr41orawP9RlKWq0N8nlgRWicBj5Df2i3QTBZQDEqC9R1OQapVUBOOzW 9HYx7i/+G7Dlz91Yj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnBaPpIACRYpQRw/ZwNlMDxG4 I4lWZSYEW/FN0BX8QgXe0Ew/ypWZcWq9FJbSJSymZT78qHIT5fj6+tyBkhsAKc7waVyJGFLq vlJNBAtSSnW0opawJrjIgVtrs0uNozveYgYoHwllWGfBvc9SpeFSKLPjTNa9G5s2oYUQKqYO JZfM2I+BPjDS0Un1lM/BJEzmO6pl3DXeDxDo1XTrq0yi4TW5FIpieixaYGPEjCMbcZOvWuih UHWw3vkUzAkF/W50GGs81v504cjmgu+Aur+DoaQ8eZnhlCWzGEfBBAaEFe2v/S9okq/QM5Eb UsM9ywjqKI/+ECmQp/6RRLQnZKflhcRQZ9UVuY98gzIkvqS6AeCDW9CRTlEADA7iPILqfUR/ gfht7vU6fZH6dV5lVr1Gm+okA6P IronPort-HdrOrdr: A9a23:sCH8GqiFWANCSgNyeuE6I3n103BQXgIji2hC6mlwRA09TyVXra +TdZMgpHnJYVcqKRYdcL+7WZVoLUmwyXcx2/hyAV7AZniDhILXFuFfBOLZqlWKcREWtNQtsJ uIGJIRNDSfNzRHZL7BkWqFOudl5sWb+6a1guqb5XJsQQZ2L5xE1W5Ce3+m+okcfng8OXL/f6 DsnvZ6mw== X-Talos-CUID: 9a23:4NCo32hh7KWRCOcrtc2gjDm4RjJubGHXxS3tCWyDSmNMSLjKTA6M2INDqp87 X-Talos-MUID: 9a23:DRzFdgxXzltQcP3PpOOCs2Km5X+aqKe1K203srYWh9aZZA1OGB67lW+eQ6Zyfw== X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,232,1787011200"; d="scan'208";a="60184132" Received: from aer-l-core-08.cisco.com ([144.254.74.209]) by aer-iport-6.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 25 Nov 2026 05:18:15 +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 aer-l-core-08.cisco.com (Postfix) with ESMTPS id BCB0B180001A3; Wed, 25 Nov 2026 05:18:14 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 73DE1CBF203; Tue, 24 Nov 2026 21:18:13 -0800 (PST) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: Darsh Kelaiya Subject: [oe][meta-python][scarthgap][PATCH 3/9] python3-aiohttp: fix CVE-2026-111748 Date: Tue, 24 Nov 2026 21:18:05 -0800 Message-Id: <20261125051811.2524271-4-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261125051811.2524271-1-dkelaiya@cisco.com> References: <20261125051811.2524271-1-dkelaiya@cisco.com> MIME-Version: 1.0 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: aer-l-core-08.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 25 Nov 2026 05:18:30 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132971 From: Darsh Kelaiya Backport the protocol-scheme fix [1] to aiohttp 3.9.5, as identified by [3]. Derive Request.scheme from the transport rather than the untrusted scheme in an absolute-form request target. Include the authority-validation correction [2] to reject malformed targets before URL parsing, independently of yarl normalization. Retain the upstream parser and request regressions. Use cached transport details and explicitly evaluate URL.port before reading raw_host because yarl 1.9.4 defers encoded-URL port validation. The recipe regenerates the C parser from the patched Cython source. [1] https://github.com/aio-libs/aiohttp/commit/6d4e7b01f9b951aa084a75d7356e907d4ee80411 [2] https://github.com/aio-libs/aiohttp/commit/186065caf37d5999e91fd3d4ddfd03b43eb08801 [3] https://github.com/aio-libs/aiohttp/security/advisories/GHSA-f9xw-jh8m-3mwq Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-111748_p1.patch | 410 ++++++++++++++++++ .../python3-aiohttp/CVE-2026-111748_p2.patch | 259 +++++++++++ .../python/python3-aiohttp_3.9.5.bb | 2 + 3 files changed, 671 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111748_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111748_p2.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111748_p1.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111748_p1.patch new file mode 100644 index 0000000000..9f1ec42706 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111748_p1.patch @@ -0,0 +1,410 @@ +From 6d4e7b01f9b951aa084a75d7356e907d4ee80411 Mon Sep 17 00:00:00 2001 +From: Sam Bull +Date: Sun, 27 Sep 2026 18:11:00 +0100 +Subject: [PATCH] Use protocol scheme for absolute-form requests (#13821) + (#13827) (#13828) + +CVE: CVE-2026-111748 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/6d4e7b01f9b951aa084a75d7356e907d4ee80411] + +Backport Changes: +- Omit the enum hunk because HTTP_OPTIONS is already declared. +- Cache transport details before URL normalization because + RequestHandler has no ssl_context attribute in aiohttp 3.9.5. +- Apply explicit clone(scheme=...) and clone(host=...) overrides to + the cached absolute URL so Request.url stays consistent. Keep + authority-form URLs scheme-less unless clone supplies a scheme. +- Evaluate URL.port before accepting raw_host in both parsers: + yarl 1.9.4 defers port validation for encoded URLs. +- Adapt the constructor mock to transport.get_extra_info() and add + the upstream absolute-URL clone tests missing from aiohttp 3.9.5. +- Keep 3.9.5's existing websocket-key test annotation; the omitted + typing-only update does not change its regression assertions. + +(cherry picked from commit a921cfd0fec28d5a9e5bf8d6f4372b8fa63c49df) +(cherry picked from commit 93d91e37e7c6035d09e89646b3de737735ed91b5) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/13821.bugfix.rst | 1 + + aiohttp/_http_parser.pyx | 31 ++++++++++++++++--- + aiohttp/http_parser.py | 28 ++++++++++++++--- + aiohttp/web_request.py | 20 ++++++++---- + tests/test_http_parser.py | 59 ++++++++++++++++++++++++++++++++++++ + tests/test_web_functional.py | 46 ++++++++++++++++++++++++++-- + tests/test_web_request.py | 52 ++++++++++++++++++++++++++----- + 7 files changed, 214 insertions(+), 23 deletions(-) + create mode 100644 CHANGES/13821.bugfix.rst + +diff --git a/CHANGES/13821.bugfix.rst b/CHANGES/13821.bugfix.rst +new file mode 100644 +index 00000000..f35418d2 +--- /dev/null ++++ b/CHANGES/13821.bugfix.rst +@@ -0,0 +1 @@ ++Fixed the web server trusting the scheme of an absolute-form request-target -- by :user:`Dreamsorcerer`. +diff --git a/aiohttp/_http_parser.pyx b/aiohttp/_http_parser.pyx +index 4eb57893..7d97bfe8 100644 +--- a/aiohttp/_http_parser.pyx ++++ b/aiohttp/_http_parser.pyx +@@ -668,12 +668,21 @@ cdef class HttpRequestParser(HttpParser): + return + self._path = self._buf.decode('utf-8', 'surrogateescape') + try: +- idx3 = len(self._path) + if self._cparser.method == cparser.HTTP_CONNECT: + # authority-form, + # https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.3 +- self._url = URL.build(authority=self._path, encoded=True) +- elif idx3 > 1 and self._path[0] == '/': ++ try: ++ self._url = URL.build(authority=self._path, encoded=True) ++ _ = self._url.port ++ host = self._url.raw_host ++ except ValueError: ++ host = None ++ if host is None: ++ raise InvalidURLError( ++ self._path.encode(errors="surrogateescape") ++ .decode("latin1") ++ ) ++ elif self._path[0] == '/': + # origin-form, + # https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.1 + idx1 = self._path.find("?") +@@ -704,10 +713,24 @@ cdef class HttpRequestParser(HttpParser): + fragment=fragment, + encoded=True, + ) ++ elif self._path == '*' and self._cparser.method == cparser.HTTP_OPTIONS: ++ # asterisk-form, ++ self._url = URL(self._path, encoded=True) + else: + # absolute-form for proxy maybe, + # https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.2 +- self._url = URL(self._path, encoded=True) ++ try: ++ self._url = URL(self._path, encoded=True) ++ _ = self._url.port ++ host = self._url.raw_host ++ except ValueError: ++ host = None ++ # https://www.rfc-editor.org/rfc/rfc9110#section-4.2.1-4 ++ if host is None: ++ raise InvalidURLError( ++ self._path.encode(errors="surrogateescape") ++ .decode("latin1") ++ ) + finally: + PyByteArray_Resize(self._buf, 0) + +diff --git a/aiohttp/http_parser.py b/aiohttp/http_parser.py +index 37a0dff4..789c2bdc 100644 +--- a/aiohttp/http_parser.py ++++ b/aiohttp/http_parser.py +@@ -641,7 +641,19 @@ class HttpRequestParser(HttpParser[RawRequestMessage]): + if method == "CONNECT": + # authority-form, + # https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.3 +- url = URL.build(authority=path, encoded=True) ++ try: ++ url = URL.build(authority=path, encoded=True) ++ _ = url.port ++ host = url.raw_host ++ except ValueError: ++ # Duplicated so mypy understands that url must be defined below. ++ raise InvalidURLError( ++ path.encode(errors="surrogateescape").decode("latin1") ++ ) ++ if host is None: ++ raise InvalidURLError( ++ path.encode(errors="surrogateescape").decode("latin1") ++ ) + elif path.startswith("/"): + # origin-form, + # https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.1 +@@ -664,9 +676,17 @@ class HttpRequestParser(HttpParser[RawRequestMessage]): + else: + # absolute-form for proxy maybe, + # https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.2 +- url = URL(path, encoded=True) +- if url.scheme == "": +- # not absolute-form ++ try: ++ url = URL(path, encoded=True) ++ _ = url.port ++ host = url.raw_host ++ except ValueError: ++ # Duplicated so mypy understands that url must be defined below. ++ raise InvalidURLError( ++ path.encode(errors="surrogateescape").decode("latin1") ++ ) ++ # https://www.rfc-editor.org/rfc/rfc9110#section-4.2.1-4 ++ if host is None: + raise InvalidURLError( + path.encode(errors="surrogateescape").decode("latin1") + ) +diff --git a/aiohttp/web_request.py b/aiohttp/web_request.py +index f9de5957..06c0bffc 100644 +--- a/aiohttp/web_request.py ++++ b/aiohttp/web_request.py +@@ -173,14 +173,27 @@ class BaseRequest(MutableMapping[str, Any], HeadersMixin): + self._method = message.method + self._version = message.version + self._cache: Dict[str, Any] = {} ++ transport = self._protocol.transport ++ assert transport is not None ++ self._transport_sslcontext = transport.get_extra_info("sslcontext") ++ self._transport_peername = transport.get_extra_info("peername") + url = message.url + if url.is_absolute(): ++ if scheme is None and url.scheme: ++ # Absolute URL is peer-controlled, use the protocol. ++ scheme = "https" if self._transport_sslcontext else "http" ++ if scheme is not None: ++ # Authority-form (CONNECT) has no scheme: leave the target ++ # unchanged unless clone(scheme=...) overrides it. ++ url = url.with_scheme(scheme) ++ self._cache["scheme"] = scheme ++ if host is not None: ++ url = url.with_host(host) + # absolute URL is given, + # override auto-calculating url, host, and scheme + # all other properties should be good + self._cache["url"] = url + self._cache["host"] = url.host +- self._cache["scheme"] = url.scheme + self._rel_url = url.relative() + else: + self._rel_url = message.url +@@ -192,11 +205,6 @@ class BaseRequest(MutableMapping[str, Any], HeadersMixin): + self._client_max_size = client_max_size + self._loop = loop + +- transport = self._protocol.transport +- assert transport is not None +- self._transport_sslcontext = transport.get_extra_info("sslcontext") +- self._transport_peername = transport.get_extra_info("peername") +- + if scheme is not None: + self._cache["scheme"] = scheme + if host is not None: +diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py +index b29518ab..ebbb58d8 100644 +--- a/tests/test_http_parser.py ++++ b/tests/test_http_parser.py +@@ -866,6 +866,65 @@ def test_url_absolute(parser: Any) -> None: + assert msg.url == URL("https://www.google.com/path/to.html") + + ++def test_url_authority_form_only_connect(parser: HttpRequestParser) -> None: ++ # https://www.rfc-editor.org/info/rfc9112/#section-3.2.3-1 ++ with pytest.raises(http_exceptions.InvalidURLError): ++ parser.feed_data(b"GET www.google.com:443 HTTP/1.1\r\nHost: a\r\n\r\n") ++ ++ ++@pytest.mark.parametrize( ++ "target", ++ ( ++ b"https:///protected", ++ b"https:////protected", ++ b"https://:80/protected", ++ b"https://user@/protected", ++ ), ++ ids=("empty-host", "empty-host-extra-slash", "port-only", "userinfo-only"), ++) ++def test_url_absolute_form_empty_host_rejected( ++ parser: HttpRequestParser, target: bytes ++) -> None: ++ # https://www.rfc-editor.org/rfc/rfc9110#section-4.2.2-4 ++ with pytest.raises(http_exceptions.InvalidURLError): ++ parser.feed_data(b"GET " + target + b" HTTP/1.1\r\nHost: a\r\n\r\n") ++ ++ ++def test_url_absolute_form_invalid_port_rejected(parser: HttpRequestParser) -> None: ++ # yarl raises ValueError for an out-of-range port; that must surface as ++ # a 400, not escape the parser as a bare ValueError. ++ with pytest.raises(http_exceptions.InvalidURLError): ++ parser.feed_data(b"GET http://example.com:65536/x HTTP/1.1\r\nHost: a\r\n\r\n") ++ ++ ++def test_url_connect_invalid_port_rejected(parser: HttpRequestParser) -> None: ++ with pytest.raises(http_exceptions.InvalidURLError): ++ parser.feed_data(b"CONNECT example.com:65536 HTTP/1.1\r\nHost: a\r\n\r\n") ++ ++ ++def test_url_connect_empty_host_rejected(parser: HttpRequestParser) -> None: ++ with pytest.raises(http_exceptions.InvalidURLError): ++ parser.feed_data(b"CONNECT :80 HTTP/1.1\r\nHost: a\r\n\r\n") ++ ++ ++def test_url_origin_form_bare_slash(parser: HttpRequestParser) -> None: ++ messages, upgrade, tail = parser.feed_data(b"GET / HTTP/1.1\r\nHost: a\r\n\r\n") ++ assert messages[0][0].url == URL("/") ++ ++ ++def test_url_asterisk_form_options(parser: HttpRequestParser) -> None: ++ # https://www.rfc-editor.org/rfc/rfc9112#section-3.2.4 ++ messages, upgrade, tail = parser.feed_data(b"OPTIONS * HTTP/1.1\r\nHost: a\r\n\r\n") ++ assert messages[0][0].url == URL("*") ++ ++ ++def test_url_asterisk_form_only_options(parser: HttpRequestParser) -> None: ++ # asterisk-form is only valid for OPTIONS; for other methods "*" is ++ # neither origin-form nor a valid absolute-form target. ++ with pytest.raises(http_exceptions.InvalidURLError): ++ parser.feed_data(b"GET * HTTP/1.1\r\nHost: a\r\n\r\n") ++ ++ + def test_headers_old_websocket_key1(parser: Any) -> None: + text = b"GET /test HTTP/1.1\r\n" b"SEC-WEBSOCKET-KEY1: line\r\n\r\n" + +diff --git a/tests/test_web_functional.py b/tests/test_web_functional.py +index a0e3a8ea..262257b8 100644 +--- a/tests/test_web_functional.py ++++ b/tests/test_web_functional.py +@@ -1863,8 +1863,50 @@ async def test_unread_compressed_body_drain_is_bounded( + assert max(drain_reads) < decompressed_size + + +-async def test_app_max_client_size(aiohttp_client) -> None: +- async def handler(request): ++async def test_absolute_form_target_does_not_spoof_scheme( ++ aiohttp_server: AiohttpServer, ++) -> None: ++ """A plaintext absolute-form target with https must not look secure.""" ++ ++ async def handler(request: web.Request) -> web.Response: ++ return web.json_response( ++ { ++ "scheme": request.scheme, ++ "secure": request.secure, ++ "url": str(request.url), ++ "host": request.host, ++ } ++ ) ++ ++ app = web.Application() ++ app.router.add_get("/probe", handler) ++ server = await aiohttp_server(app) ++ ++ reader, writer = await asyncio.open_connection(server.host, server.port) ++ try: ++ writer.write( ++ b"GET https://trusted.example/probe HTTP/1.1\r\n" ++ b"Host: trusted.example\r\n" ++ b"Connection: close\r\n\r\n" ++ ) ++ await writer.drain() ++ raw = await asyncio.wait_for(reader.read(), 5) ++ finally: ++ writer.close() ++ with suppress(ConnectionResetError, BrokenPipeError): ++ await writer.wait_closed() ++ ++ assert raw.startswith(b"HTTP/1.1 200 ") ++ assert json.loads(raw.split(b"\r\n\r\n", 1)[1]) == { ++ "scheme": "http", ++ "secure": False, ++ "url": "http://trusted.example/probe", ++ "host": "trusted.example", ++ } ++ ++ ++async def test_app_max_client_size(aiohttp_client: AiohttpClient) -> None: ++ async def handler(request: web.Request) -> NoReturn: + await request.post() + return web.Response(body=b"ok") + +diff --git a/tests/test_web_request.py b/tests/test_web_request.py +index c1d61f89..79ddcdeb 100644 +--- a/tests/test_web_request.py ++++ b/tests/test_web_request.py +@@ -9,13 +9,15 @@ import pytest + from multidict import CIMultiDict, CIMultiDictProxy, MultiDict + from yarl import URL + +-from aiohttp import HttpVersion ++from aiohttp import HttpVersion, web ++from aiohttp.abc import AbstractStreamWriter + from aiohttp.base_protocol import BaseProtocol + from aiohttp.http_exceptions import BadHttpMessage, LineTooLong + from aiohttp.http_parser import RawRequestMessage + from aiohttp.streams import StreamReader + from aiohttp.test_utils import make_mocked_request +-from aiohttp.web import BaseRequest, HTTPRequestEntityTooLarge ++from aiohttp.web import HTTPRequestEntityTooLarge ++from aiohttp.web_protocol import RequestHandler + from aiohttp.web_request import ETag + + +@@ -24,6 +26,19 @@ def protocol(): + return mock.Mock(_reading_paused=False) + + ++def make_base_request( ++ message: RawRequestMessage, protocol: RequestHandler ++) -> web.BaseRequest: ++ return web.BaseRequest( ++ message, ++ mock.create_autospec(StreamReader, spec_set=True, instance=True), ++ protocol, ++ mock.create_autospec(AbstractStreamWriter, spec_set=True, instance=True), ++ mock.create_autospec(asyncio.Task, spec_set=True, instance=True), ++ mock.create_autospec(asyncio.AbstractEventLoop, spec_set=True, instance=True), ++ ) ++ ++ + def test_base_ctor() -> None: + message = RawRequestMessage( + "GET", +@@ -38,9 +53,10 @@ def test_base_ctor() -> None: + URL("/path/to?a=1&b=2"), + ) + +- req = BaseRequest( +- message, mock.Mock(), mock.Mock(), mock.Mock(), mock.Mock(), mock.Mock() +- ) ++ protocol = mock.create_autospec(RequestHandler, spec_set=True, instance=True) ++ protocol.transport = mock.Mock() ++ protocol.transport.get_extra_info.return_value = None ++ req = make_base_request(message, protocol) + + assert "GET" == req.method + assert HttpVersion(1, 1) == req.version +@@ -165,12 +181,34 @@ def test_non_ascii_raw_path() -> None: + + def test_absolute_url() -> None: + req = make_mocked_request("GET", "https://example.com/path/to?a=1") +- assert req.url == URL("https://example.com/path/to?a=1") +- assert req.scheme == "https" ++ assert req.url == URL("http://example.com/path/to?a=1") ++ # The scheme of an absolute-form target is peer-controlled and must not ++ # override the transport-derived scheme. ++ assert req.scheme == "http" ++ assert not req.secure + assert req.host == "example.com" + assert req.rel_url == URL.build(path="/path/to", query={"a": "1"}) + + ++def test_clone_absolute_scheme() -> None: ++ req = make_mocked_request("GET", "https://example.com/path/to?a=1") ++ assert req.scheme == "http" ++ req2 = req.clone(scheme="https") ++ assert req2.scheme == "https" ++ assert req2.url.scheme == "https" ++ req3 = req2.clone(scheme="http") ++ assert req3.scheme == "http" ++ assert req3.url.scheme == "http" ++ ++ ++def test_clone_absolute_host() -> None: ++ req = make_mocked_request("GET", "https://example.com/path/to?a=1") ++ assert req.host == "example.com" ++ req2 = req.clone(host="foo.test") ++ assert req2.host == "foo.test" ++ assert req2.url.host == "foo.test" ++ ++ + def test_content_length() -> None: + req = make_mocked_request("Get", "/", CIMultiDict([("CONTENT-LENGTH", "123")])) + diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111748_p2.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111748_p2.patch new file mode 100644 index 0000000000..58bca9f8f2 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111748_p2.patch @@ -0,0 +1,259 @@ +From 186065caf37d5999e91fd3d4ddfd03b43eb08801 Mon Sep 17 00:00:00 2001 +From: Andrew Svetlov +Date: Tue, 29 Sep 2026 11:25:53 +0200 +Subject: [PATCH] Reject absolute-form targets without an authority before + parsing (#13858) (#13860) + + + +Follow-up to #13855 for aio-libs/yarl#1937. With that change, yarl's +default WHATWG mode reads a host from `http:host/p`, `http:/host/p` and +`http:///host/p`, as browsers do. The Python and Cython request parsers +passed an absolute-form request target to `URL()` and rejected it only +if yarl found no host. They now first check that the target has `//` +followed by a non-empty authority, so `GET http:///protected` and `GET +http:/protected` stay rejected as RFC 9110 requires, whatever yarl +version is installed. + +The client tests used `http:///example.com` and `http:///path` as URLs +without a host. They now use `http://` where an invalid URL is needed, +and `http:///example.com` is dropped from the invalid URL test data. +With yarl#1937 it is `http://example.com/`, and as a redirect it leads +to `example.com`, as in browsers. + +No with the released yarl, where such targets were already rejected. +With yarl#1937, the server keeps rejecting absolute-form targets without +an authority instead of reading a host from them. + +No, it is one string check shared by both parsers. + +Follow-up to #13855; needed by aio-libs/yarl#1937. + +- [x] I think the code is well written +- [x] Unit tests for the changes exist +- [ ] Documentation reflects the changes: N/A, no documented behavior +changes +- [ ] If you provide code modification, please add yourself to +`CONTRIBUTORS.txt`: N/A, already listed +- [x] Add a new news fragment into the `CHANGES/` folder + +Drafted with Claude Code (Claude Opus 5.5); reviewed by @asvetlov. + +
+Agent run details (optional, for reviewers) + +Tests with the Cython extensions built (llhttp generated, `make +cythonize`, `build_ext --inplace`): `pytest tests -n auto`, 5246 passed, +22 skipped, 17 xfailed, both with yarl master (f761c37) and with the +yarl#1937 branch (8d0f111). Pure-Python run of `test_http_parser.py`, +`test_client_functional.py` and `test_client_session.py` with the +yarl#1937 branch: 884 passed. +Lint: black, isort, codespell passed. The local pre-commit flake8 hook +fails to load `flake8-requirements` (`pkg_resources` missing), so flake8 +(E, F, W) was run directly and passed. yesqa was skipped for the same +reason, because it wrongly strips `# noqa: I900`. +
+ +(cherry picked from commit ce960dd17e34f143762c14c32b9e14435ea7ce11) + + + +## What do these changes do? + + + +## Are there changes in behavior for the user? + + + +## Is it a substantial burden for the maintainers to support this? + + + +## Related issue number + + + + +## Checklist + +- [ ] I think the code is well written +- [ ] Unit tests for the changes exist +- [ ] Documentation reflects the changes +- [ ] If you provide code modification, please add yourself to +`CONTRIBUTORS.txt` + * The format is <Name> <Surname>. + * Please keep alphabetical order, the file is sorted by names. +- [ ] Add a new news fragment into the `CHANGES/` folder + * name it `..rst` (e.g. `588.bugfix.rst`) + * if you don't have an issue number, change it to the pull request + number after creating the PR + * `.bugfix`: A bug fix for something the maintainers deemed an + improper undesired behavior that got corrected to match + pre-agreed expectations. + * `.feature`: A new behavior, public APIs. That sort of stuff. + * `.deprecation`: A declaration of future API removals and breaking + changes in behavior. + * `.breaking`: When something public is removed in a breaking way. + Could be deprecated in an earlier release. + * `.doc`: Notable updates to the documentation structure or build + process. + * `.packaging`: Notes for downstreams about unobvious side effects + and tooling. Changes in the test invocation considerations and + runtime assumptions. + * `.contrib`: Stuff that affects the contributor experience. e.g. + Running tests, building the docs, setting up the development + environment. + * `.misc`: Changes that are hard to assign to any of the above + categories. + * Make sure to use full sentences with correct case and punctuation, + for example: + ```rst + Fixed issue with non-ascii contents in doctest text files + -- by :user:`contributor-gh-handle`. + ``` + + Use the past tense or the present tense a non-imperative mood, + referring to what's changed compared to the last released version + of this project. + +CVE: CVE-2026-111748 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/186065caf37d5999e91fd3d4ddfd03b43eb08801] + +Backport Changes: +- Omit THREAT_MODEL.md because that file is absent in aiohttp 3.9.5. +- Omit updates to the newer invalid-URL/redirect fixture groups and + response-payload tests, which do not exist in this version. +- Preserve p1's explicit URL.port check inside the authority guard; + yarl 1.9.4 defers port validation for encoded URLs. + +Signed-off-by: Darsh Kelaiya +--- + CHANGES/13858.bugfix.rst | 7 +++++++ + aiohttp/_http_parser.pyx | 16 +++++++++------- + aiohttp/http_parser.py | 16 ++++++++++++++++ + tests/test_http_parser.py | 17 ++++++++++++++++- + 4 files changed, 48 insertions(+), 8 deletions(-) + create mode 100644 CHANGES/13858.bugfix.rst + +diff --git a/CHANGES/13858.bugfix.rst b/CHANGES/13858.bugfix.rst +new file mode 100644 +index 00000000..9bd2d110 +--- /dev/null ++++ b/CHANGES/13858.bugfix.rst +@@ -0,0 +1,7 @@ ++Rejected absolute-form request targets without ``//`` or with an empty ++host, such as ``http:/example.com/`` or ``http:///example.com/``, before ++parsing them with yarl, which reads a host from them in its WHATWG mode; ++RFC 9110 requires a host for ``http`` and ``https``. The invalid URL test ++data no longer uses ``http:///example.com``, which such a yarl version ++parses as ``http://example.com/``, as browsers do ++-- by :user:`asvetlov`. +diff --git a/aiohttp/_http_parser.pyx b/aiohttp/_http_parser.pyx +index 7d97bfe8..a5309a4c 100644 +--- a/aiohttp/_http_parser.pyx ++++ b/aiohttp/_http_parser.pyx +@@ -31,7 +31,7 @@ from .http_exceptions import ( + PayloadEncodingError, + TransferEncodingError, + ) +-from .http_parser import DeflateBuffer as _DeflateBuffer ++from .http_parser import DeflateBuffer as _DeflateBuffer, _has_authority + from .http_writer import ( + HttpVersion as _HttpVersion, + HttpVersion10 as _HttpVersion10, +@@ -719,12 +719,14 @@ cdef class HttpRequestParser(HttpParser): + else: + # absolute-form for proxy maybe, + # https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.2 +- try: +- self._url = URL(self._path, encoded=True) +- _ = self._url.port +- host = self._url.raw_host +- except ValueError: +- host = None ++ host = None ++ if _has_authority(self._path): ++ try: ++ self._url = URL(self._path, encoded=True) ++ _ = self._url.port ++ host = self._url.raw_host ++ except ValueError: ++ pass + # https://www.rfc-editor.org/rfc/rfc9110#section-4.2.1-4 + if host is None: + raise InvalidURLError( +diff --git a/aiohttp/http_parser.py b/aiohttp/http_parser.py +index 789c2bdc..9b637938 100644 +--- a/aiohttp/http_parser.py ++++ b/aiohttp/http_parser.py +@@ -87,6 +87,18 @@ VERSRE: Final[Pattern[str]] = re.compile(r"HTTP/(\d)\.(\d)", re.ASCII) + DIGITS: Final[Pattern[str]] = re.compile(r"\d+", re.ASCII) + HEXDIGITS: Final[Pattern[bytes]] = re.compile(rb"[0-9a-fA-F]+") + ++ ++def _has_authority(target: str) -> bool: ++ """Tell if an absolute-form request target has "//" and a non-empty authority. ++ ++ RFC 9110 section 4.2 requires a host for http and https. yarl's default ++ WHATWG mode reads a host from "http:host/p" or "http:///host/p", so the ++ target is checked before it is parsed. ++ """ ++ rest = target.partition(":")[2] ++ return rest[:2] == "//" and rest[2:3] not in ("", "/", "?", "#") ++ ++ + # RFC 9110 singleton headers — duplicates are rejected in strict mode. + # In lax mode (response parser default), the check is skipped entirely + # since real-world servers (e.g. Google APIs, Werkzeug) commonly send +@@ -676,6 +688,10 @@ class HttpRequestParser(HttpParser[RawRequestMessage]): + else: + # absolute-form for proxy maybe, + # https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.2 ++ if not _has_authority(path): ++ raise InvalidURLError( ++ path.encode(errors="surrogateescape").decode("latin1") ++ ) + try: + url = URL(path, encoded=True) + _ = url.port +diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py +index ebbb58d8..1b8c2da9 100644 +--- a/tests/test_http_parser.py ++++ b/tests/test_http_parser.py +@@ -879,8 +879,23 @@ def test_url_authority_form_only_connect(parser: HttpRequestParser) -> None: + b"https:////protected", + b"https://:80/protected", + b"https://user@/protected", ++ b"https://", ++ b"https://?q", ++ b"http:protected/x", ++ b"http:/protected/x", ++ b"http:\\\\protected/x", ++ ), ++ ids=( ++ "empty-host", ++ "empty-host-extra-slash", ++ "port-only", ++ "userinfo-only", ++ "no-authority", ++ "empty-host-query", ++ "no-slashes", ++ "one-slash", ++ "backslashes", + ), +- ids=("empty-host", "empty-host-extra-slash", "port-only", "userinfo-only"), + ) + def test_url_absolute_form_empty_host_rejected( + parser: HttpRequestParser, target: bytes diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb index 90475a5aff..db40e59a6b 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb @@ -38,6 +38,8 @@ SRC_URI += "file://CVE-2024-52304.patch \ file://CVE-2026-54273_p2.patch \ file://CVE-2026-111750.patch \ file://CVE-2026-111749.patch \ + file://CVE-2026-111748_p1.patch \ + file://CVE-2026-111748_p2.patch \ " CVE_STATUS[CVE-2026-34515] = "not-applicable-platform: Vulnerability only affects applications running on Windows" From patchwork Wed Nov 25 05:18:06 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: 105516 Received: from aer-iport-6.cisco.com (aer-iport-6.cisco.com [173.38.203.68]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.36179.1795583899216529360 for ; Tue, 24 Nov 2026 21:18:19 -0800 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=DFL04aoP; spf=pass (domain: cisco.com, ip: 173.38.203.68, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=18418; q=dns/txt; s=iport01; t=1795583899; x=1796793499; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Raa5Zu5gaAWUHm2eyGmyONOS3L7gh8CxdSJRDBSFuyA=; b=DFL04aoP4AFekD+ILimYyDt+FfFYnv8gRiSTo9vRsFSsf8/AMGME7gcI kqKOgRtFLUByWI3QdIKJVT5eC9+LJ3TPaBbCXIrNol0aPgeXaRfQnS+Of 6GTUUIjZXIfzBpvatXePyflaODuPI06QsL3PyfvKhmcIZhH/JVEbvnPzE iVj2+Z1uoQ3gCzQY9hSzoHmAiz7QRCuPDgabBqXNaAw9PPN/JzQ1ucn2t Ldir5eUZ6tIphGk+D7SaCYD9m7afeOG7kHxhNoqzswHhDCGRTUt2MQZms 3QXN+4IA3mWcPjg+YC1UHoeQFxkcv5St1ChmZpfb4FA6BeasP+EWLFaQF Q==; X-CSE-ConnectionGUID: EIyn7AT8SjqTXGeX1t4coQ== X-CSE-MsgGUID: L4h4j0P4SDCYNkD1S2y+Pw== X-IPAS-Result: A0AaAAAhbQZr/9NK/pBQChwBAQEBAQEHAQESAQEEBAEBgXwHAQELAYIXP3VgQ0kDjG+JWQOBE5A9jFmBfg8BAQEPRA0EAQGEP0YCjiICJjQJDgECBAMCAwEBAQEBAQEBAQEBAQoBAQUBAQECAQcFgQ4ThhUGNA2QEgECAQMnCwEYAS0QHAMBAi8rIwgQCYIqWAGCdAMRugOBeTOBAYMpAYFU2zMBCxQBgTgBhUGIJV0YAYQDeycbG4FygRWBO4EeG3aBBYFcAQECAYEqBgWGbgSCIoEMgVSNEwKBSYhSSIEeA1ksAVUTDQoLBwWBaAM1EioVbjIdgSM7F4EHGwYFgRyBHoESgQNdgSsoXQEhgQiBdQKCUYIAAgFJQQ4HRVMJJUMSRyQiCBIJARMaLAqBGjU8CSY/FQxnCxoFYQgCDQx0ORAwHCQvBRkmPBsKgQwnHR4ZDgIpBhYhCzQYDUgRLDcVGQQ+bgeUE4JuLQENH2EBCg4RAQF/BgwPFBlfHAIwkmmEIot7giGhEQoog3mMJJU6GjOEBIFXkkOSVAuYfYJZizGWAQNNhGqBaDyBWXAVgyIJShkPhlGHWgMLC4NghRPJSCYyAgkDLwEBBwIHDgMLgWiQAAEnBHJgAQE IronPort-Data: A9a23:r7b6tKgYPBq9au03c4EVtLAyX161NxEKZh0ujC45NGQN5FlHY01je htvUGuGM/6CYmKgedAgbdvloEMD7ZWAm983TwtqrSg8Hi5jpJueD7x1DKtf0wB+jyHnZBg6h ynLQoCYdKjYdleF+FHwdOCn/SMhvU2xbuKUIPbePSxsThNTRi4kiBZy88Y0mYcAbeKRW2thg vus5ZeAULOZ82QsaDxNsvje8EoHUMna4Vv0gHRvPZing3eG/5UlJMp3Db28KXL+Xr5VEoaSL 87fzKu093/u5BwkDNWoiN7TKiXmlZaLYGBiIlIPM0STqkAqSh4ai87XB9JAAatjsAhlqvgqo Dl7WTNcfi9yVkHEsLx1vxC1iEiSN4UekFPMCSDXXcB+UyQqflO0q8iCAn3aMqU12/dxXkhyp ccaMQw9QR2z3v7qy7WCH7wEasQLdKEHPasWt2slyXTSCuwrBMmbBa7L/tRfmjw3g6iiH96HO 5ZfM2czKkucJUcWYz/7C7pm9AusrnX8fjlRqUOcjaE2+GPUigd21dABNfKLIoXaGZwOxS50o Erio2SlAEkiaOez4guj8V71vbXe3hvkDdd6+LqQs6QCbEeo7msLBRsbUFG2rfW0hguyVsxSL 2QQ+zEytu417EGtQ9z3UhG0rXLCuQQTM+e8CMUz5RvIzu/f5ByUQzFcCDVAc9ch8sQxQFTGy 2O0oj8gPhQ32JX9dJ5X3u38Qe+aUcTNEVI/WA== IronPort-HdrOrdr: A9a23:KYhqu64oOfMXgkhi2QPXwOrXdLJyesId70hD6qm+c3Nom6uj5q eTdZsgtCMc5Ax9ZJhko6HjBEDiewK5yXcK2+ks1N6ZNWGM0ldAbrsSiLcKqAePJ8SRzIJgPN 9bAstDIey1K0RmhsDn5wT9OdMhzN6btJ2Mv47lvhFQpcUAUdAZ0++/YTzra3FLeA== X-Talos-CUID: 9a23:5sTMY22RdaxrRzzq5vWUm7xfN+E0dCL08CfrIVaEOUlkeOSJFVSXwfYx X-Talos-MUID: 9a23:5biD5w0R7ZHZQl5dArQ1MomFKTUjx/iuVEJVqck9l+K1Ey9cYgzHnXePXdpy X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,232,1787011200"; d="scan'208";a="60184133" Received: from aer-l-core-10.cisco.com ([144.254.74.211]) by aer-iport-6.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 25 Nov 2026 05:18:15 +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 aer-l-core-10.cisco.com (Postfix) with ESMTPS id C752E180001D1; Wed, 25 Nov 2026 05:18:14 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 7AA16CBF204; Tue, 24 Nov 2026 21:18:13 -0800 (PST) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: Darsh Kelaiya Subject: [oe][meta-python][scarthgap][PATCH 4/9] python3-aiohttp: fix CVE-2026-111066 Date: Tue, 24 Nov 2026 21:18:06 -0800 Message-Id: <20261125051811.2524271-5-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261125051811.2524271-1-dkelaiya@cisco.com> References: <20261125051811.2524271-1-dkelaiya@cisco.com> MIME-Version: 1.0 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: aer-l-core-10.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 25 Nov 2026 05:18:20 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132969 From: Darsh Kelaiya Backport the multipart descriptor-exhaustion fix [1] to aiohttp 3.9.5. Spool small file parts in memory and count raw multipart bytes, including headers, against client_max_size. Include the upstream descriptor-test correction [2] so unrelated file descriptors do not make the regression test unreliable. Use synchronous BodyPartReader.decode(), retain the existing 64 KiB reads, and adapt the HTTP 413 constructor and raw-size assertion. The vulnerability and fixed release are documented in [3]. [1] https://github.com/aio-libs/aiohttp/commit/2d94633b7f1b4c1ba07d647b629a8440652b2d09 [2] https://github.com/aio-libs/aiohttp/commit/011c08204197beba8281911907b59ffcecea1413 [3] https://github.com/aio-libs/aiohttp/security/advisories/GHSA-9xw5-w5jj-pvcg Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-111066_p1.patch | 397 ++++++++++++++++++ .../python3-aiohttp/CVE-2026-111066_p2.patch | 59 +++ .../python/python3-aiohttp_3.9.5.bb | 2 + 3 files changed, 458 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111066_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111066_p2.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111066_p1.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111066_p1.patch new file mode 100644 index 0000000000..69bdbbec99 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111066_p1.patch @@ -0,0 +1,397 @@ +From 2d94633b7f1b4c1ba07d647b629a8440652b2d09 Mon Sep 17 00:00:00 2001 +From: Sam Bull +Date: Tue, 18 Aug 2026 21:54:45 +0100 +Subject: [PATCH] Reduce number of file descriptors needed in multipart + messages (#13426) (#13475) + +CVE: CVE-2026-111066 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/2d94633b7f1b4c1ba07d647b629a8440652b2d09] + +Backport Changes: +- Use synchronous BodyPartReader.decode() and 64 KiB reads in place + of the newer decode_iter()/DEFAULT_CHUNK_SIZE APIs. +- Pass payload.total_bytes to the older HTTP 413 constructor and + adjust the existing size-limit test for raw multipart accounting. +- Omit the cleanup-comment hunk because BaseRequest._finish() is + absent from aiohttp 3.9.5. + +(cherry picked from commit c92ed4c48dafd40d5ed4c86587af9e081ac7d971) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/13426.bugfix.rst | 1 + + aiohttp/web_request.py | 95 ++++++++++++++----- + tests/test_web_functional.py | 171 +++++++++++++++++++++++++++++++++-- + 3 files changed, 240 insertions(+), 27 deletions(-) + create mode 100644 CHANGES/13426.bugfix.rst + +diff --git a/CHANGES/13426.bugfix.rst b/CHANGES/13426.bugfix.rst +new file mode 100644 +index 0000000..8b9ee29 +--- /dev/null ++++ b/CHANGES/13426.bugfix.rst +@@ -0,0 +1 @@ ++Switched multipart handling to use spooled temporary files to reduce number of file descriptors needed -- by :user:`Dreamsorcerer`. +diff --git a/aiohttp/web_request.py b/aiohttp/web_request.py +index f9de595..26279d5 100644 +--- a/aiohttp/web_request.py ++++ b/aiohttp/web_request.py +@@ -4,12 +4,13 @@ import io + import re + import socket + import string +-import tempfile ++import sys + import types + import warnings + from http.cookies import SimpleCookie + from types import MappingProxyType + from typing import ( ++ IO, + TYPE_CHECKING, + Any, + Dict, +@@ -64,6 +65,30 @@ from .typedefs import ( + from .web_exceptions import HTTPRequestEntityTooLarge + from .web_response import StreamResponse + ++if sys.version_info >= (3, 11): ++ from tempfile import SpooledTemporaryFile ++else: ++ import tempfile ++ ++ class SpooledTemporaryFile(tempfile.SpooledTemporaryFile[bytes], io.IOBase): ++ """Make the spooled file satisfy the documented `FileField.file` type. ++ ++ `tempfile.SpooledTemporaryFile` only became an `io.IOBase` subclass in ++ 3.11 (python/cpython#70363), and never grew the three capability ++ predicates before then. Both underlying files (`io.BytesIO` before ++ rollover, a `w+b` temp file after) are readable, writable and seekable. ++ """ ++ ++ def readable(self) -> bool: ++ return True ++ ++ def writable(self) -> bool: ++ return True ++ ++ def seekable(self) -> bool: ++ return True ++ ++ + __all__ = ("BaseRequest", "FileField", "Request") + + +@@ -73,11 +98,18 @@ if TYPE_CHECKING: + from .web_urldispatcher import UrlMappingMatchInfo + + ++# Multipart file parts are buffered in memory and only spilled to a temporary ++# file once they outgrow this size. A temp file per part would let a body made ++# of many tiny parts exhaust the process's file descriptors; spooling bounds ++# that at ``client_max_size // _FILE_SPOOL_MAX_SIZE`` descriptors per request. ++_FILE_SPOOL_MAX_SIZE: Final[int] = 1024**2 ++ ++ + @attr.s(auto_attribs=True, frozen=True, slots=True) + class FileField: + name: str + filename: str +- file: io.BufferedReader ++ file: IO[bytes] + content_type: str + headers: "CIMultiDictProxy[str]" + +@@ -717,8 +749,15 @@ class BaseRequest(MutableMapping[str, Any], HeadersMixin): + multipart = await self.multipart() + max_size = self._client_max_size + +- size = 0 ++ payload = self._payload + while (field := await multipart.next()) is not None: ++ # This check is needed for empty payloads, which still add ++ # overhead without entering the loop and the check below. ++ if 0 < max_size < payload.total_bytes: ++ raise HTTPRequestEntityTooLarge( ++ max_size=max_size, actual_size=payload.total_bytes ++ ) ++ + field_ct = field.headers.get(hdrs.CONTENT_TYPE) + + if isinstance(field, BodyPartReader): +@@ -730,22 +769,37 @@ class BaseRequest(MutableMapping[str, Any], HeadersMixin): + # present. + # https://tools.ietf.org/html/rfc7578#section-4.4 + if field.filename: +- # store file in temp file +- tmp = await self._loop.run_in_executor( +- None, tempfile.TemporaryFile +- ) +- chunk = await field.read_chunk(size=2**16) +- while chunk: +- chunk = field.decode(chunk) +- await self._loop.run_in_executor(None, tmp.write, chunk) +- size += len(chunk) +- if 0 < max_size < size: +- await self._loop.run_in_executor(None, tmp.close) ++ tmp = SpooledTemporaryFile(_FILE_SPOOL_MAX_SIZE) ++ # rolled means the temp file now uses the disk, at ++ # which point we want to run in the executor. ++ rolled = False ++ while chunk := await field.read_chunk(size=2**16): ++ # Bounds one part, mid-read. ++ if 0 < max_size < payload.total_bytes: ++ if rolled: ++ await self._loop.run_in_executor(None, tmp.close) ++ else: ++ tmp.close() + raise HTTPRequestEntityTooLarge( +- max_size=max_size, actual_size=size ++ max_size=max_size, actual_size=payload.total_bytes ++ ) ++ decoded_chunk = field.decode(chunk) ++ # Update before writing, so we know if next ++ # write is going to hit the disk. ++ rolled = rolled or ( ++ tmp.tell() + len(decoded_chunk) ++ > _FILE_SPOOL_MAX_SIZE ++ ) ++ if rolled: ++ await self._loop.run_in_executor( ++ None, tmp.write, decoded_chunk + ) +- chunk = await field.read_chunk(size=2**16) +- await self._loop.run_in_executor(None, tmp.seek, 0) ++ else: ++ tmp.write(decoded_chunk) ++ if rolled: ++ await self._loop.run_in_executor(None, tmp.seek, 0) ++ else: ++ tmp.seek(0) + + if field_ct is None: + field_ct = "application/octet-stream" +@@ -753,7 +807,7 @@ class BaseRequest(MutableMapping[str, Any], HeadersMixin): + ff = FileField( + field.name, + field.filename, +- cast(io.BufferedReader, tmp), ++ tmp, + field_ct, + field.headers, + ) +@@ -762,10 +816,9 @@ class BaseRequest(MutableMapping[str, Any], HeadersMixin): + # deal with ordinary data + raw_data = bytearray() + while chunk := await field.read_chunk(): +- size += len(chunk) +- if 0 < max_size < size: ++ if 0 < max_size < payload.total_bytes: + raise HTTPRequestEntityTooLarge( +- max_size=max_size, actual_size=size ++ max_size=max_size, actual_size=payload.total_bytes + ) + raw_data.extend(chunk) + +diff --git a/tests/test_web_functional.py b/tests/test_web_functional.py +index a0e3a8e..78bd265 100644 +--- a/tests/test_web_functional.py ++++ b/tests/test_web_functional.py +@@ -1,6 +1,8 @@ + import asyncio ++import base64 + import io + import json ++import os + import pathlib + import socket + import zlib +@@ -28,6 +30,7 @@ from aiohttp.streams import StreamReader + from aiohttp.test_utils import make_mocked_coro + from aiohttp.typedefs import Handler + from aiohttp.web_protocol import MAX_MSG_QUEUE_SIZE, RequestHandler ++from aiohttp.web_request import _FILE_SPOOL_MAX_SIZE + + try: + import brotlicffi as brotli +@@ -1964,10 +1967,7 @@ async def test_post_max_client_size(aiohttp_client) -> None: + + assert 413 == resp.status + resp_text = await resp.text() +- assert ( +- "Maximum request body size 10 exceeded, " +- "actual body size 1024" in resp_text +- ) ++ assert "Maximum request body size 10 exceeded" in resp_text + data["file"].close() + + await resp.release() +@@ -1991,8 +1991,167 @@ async def test_post_max_client_size_for_file(aiohttp_client) -> None: + await resp.release() + + +-async def test_response_with_bodypart(aiohttp_client) -> None: +- async def handler(request): ++def _multipart_file_parts(count: int, body: bytes = b"") -> bytes: ++ """Raw multipart/form-data body of ``count`` file parts, boundary ``b``.""" ++ return ( ++ b"".join( ++ b'--b\r\nContent-Disposition: form-data; name="f%d"; ' ++ b'filename="x"\r\n\r\n' % index + body + b"\r\n" ++ for index in range(count) ++ ) ++ + b"--b--\r\n" ++ ) ++ ++ ++async def test_post_max_client_size_counts_multipart_headers( ++ aiohttp_client: AiohttpClient, ++) -> None: ++ async def handler(request: web.Request) -> NoReturn: ++ await request.post() ++ assert False ++ ++ app = web.Application(client_max_size=1) ++ app.router.add_post("/", handler) ++ client = await aiohttp_client(app) ++ ++ body = _multipart_file_parts(55) ++ assert len(body) > 1 ++ async with client.post( ++ "/", data=body, headers={CONTENT_TYPE: "multipart/form-data; boundary=b"} ++ ) as resp: ++ assert resp.status == 413 ++ ++ ++@pytest.mark.parametrize( ++ "max_size", ++ (_FILE_SPOOL_MAX_SIZE, 2 * _FILE_SPOOL_MAX_SIZE), ++ ids=("spooled", "rolled-over"), ++) ++async def test_post_max_client_size_within_single_part( ++ aiohttp_client: AiohttpClient, max_size: int ++) -> None: ++ async def handler(request: web.Request) -> NoReturn: ++ await request.post() ++ assert False ++ ++ app = web.Application(client_max_size=max_size) ++ app.router.add_post("/", handler) ++ client = await aiohttp_client(app) ++ ++ # A sole oversized part is never followed by a boundary, so only the ++ # per-chunk check can reject it, and it must do so before buffering. The ++ # larger limit lets the part reach the disk first, so the spool is then ++ # closed off the event loop too. ++ data = FormData() ++ with io.BytesIO(b"x" * (3 * _FILE_SPOOL_MAX_SIZE)) as file_handle: ++ data.add_field("file", file_handle, filename="x.bin") ++ async with client.post("/", data=data) as resp: ++ assert resp.status == 413 ++ ++ ++@pytest.mark.parametrize("filename", (b"", b'; filename="x"'), ids=("field", "file")) ++async def test_post_max_client_size_counts_undecoded_bytes( ++ aiohttp_client: AiohttpClient, filename: bytes ++) -> None: ++ async def handler(request: web.Request) -> NoReturn: ++ await request.post() ++ assert False ++ ++ limit = 64 * 1024 ++ app = web.Application(client_max_size=limit) ++ app.router.add_post("/", handler) ++ client = await aiohttp_client(app) ++ ++ # base64 decodes to exactly the limit but arrives 4/3 larger. The limit is ++ # on the request body, so both kinds of part must reject it alike. ++ encoded = base64.b64encode(b"A" * limit) ++ assert len(encoded) > limit ++ body = ( ++ b'--b\r\nContent-Disposition: form-data; name="f"' + filename + b"\r\n" ++ b"Content-Transfer-Encoding: base64\r\n\r\n" + encoded + b"\r\n--b--\r\n" ++ ) ++ async with client.post( ++ "/", data=body, headers={CONTENT_TYPE: "multipart/form-data; boundary=b"} ++ ) as resp: ++ assert resp.status == 413 ++ ++ ++@pytest.mark.skipif(not os.path.isdir("/dev/fd"), reason="needs /dev/fd to count fds") ++@pytest.mark.parametrize( ++ ("parts", "part_body", "expected_fds"), ++ ( ++ (55, b"payload", 0), ++ (1, b"x" * (_FILE_SPOOL_MAX_SIZE + 1), 1), ++ ), ++ ids=("many-small-parts", "one-oversized-part"), ++) ++async def test_post_file_fields_descriptor_cost( ++ aiohttp_client: AiohttpClient, parts: int, part_body: bytes, expected_fds: int ++) -> None: ++ """Only a part past the spool size may cost a descriptor.""" ++ ++ async def handler(request: web.Request) -> web.Response: ++ before = set(await asyncio.to_thread(os.listdir, "/dev/fd")) ++ data = await request.post() ++ after = set(await asyncio.to_thread(os.listdir, "/dev/fd")) ++ assert len(data) == parts ++ return web.Response(text=str(len(after - before))) ++ ++ app = web.Application(client_max_size=8 * 1024**2) ++ app.router.add_post("/", handler) ++ client = await aiohttp_client(app) ++ ++ with io.BytesIO(_multipart_file_parts(parts, part_body)) as body: ++ async with client.post( ++ "/", ++ data=body, ++ headers={CONTENT_TYPE: "multipart/form-data; boundary=b"}, ++ ) as resp: ++ assert resp.status == 200 ++ assert await resp.text() == str(expected_fds) ++ ++ ++@pytest.mark.parametrize( ++ "size", ++ ( ++ 0, ++ 1, ++ _FILE_SPOOL_MAX_SIZE - 1, ++ _FILE_SPOOL_MAX_SIZE, ++ _FILE_SPOOL_MAX_SIZE + 1, ++ ), ++) ++async def test_post_file_field_spool_rollover( ++ aiohttp_client: AiohttpClient, size: int ++) -> None: ++ """A part is byte-identical either side of the spool/temp-file boundary.""" ++ payload = (b"0123456789abcdef" * (size // 16 + 1))[:size] ++ ++ async def handler(request: web.Request) -> web.Response: ++ field = (await request.post())["file"] ++ assert isinstance(field, aiohttp.web_request.FileField) ++ assert isinstance(field.file, io.IOBase) ++ assert field.file.readable() ++ assert field.file.writable() ++ assert field.file.seekable() ++ content = await asyncio.to_thread(field.file.read) ++ assert len(content) == size ++ assert content == payload ++ return web.Response() ++ ++ app = web.Application(client_max_size=8 * 1024**2) ++ app.router.add_post("/", handler) ++ client = await aiohttp_client(app) ++ ++ data = FormData() ++ with io.BytesIO(payload) as file_handle: ++ data.add_field("file", file_handle, filename="x.bin") ++ async with client.post("/", data=data) as resp: ++ assert resp.status == 200 ++ ++ ++async def test_response_with_bodypart(aiohttp_client: AiohttpClient) -> None: ++ async def handler(request: web.Request) -> web.Response: + reader = await request.multipart() + part = await reader.next() + return web.Response(body=part) diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111066_p2.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111066_p2.patch new file mode 100644 index 0000000000..49db38b641 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111066_p2.patch @@ -0,0 +1,59 @@ +From 011c08204197beba8281911907b59ffcecea1413 Mon Sep 17 00:00:00 2001 +From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> +Date: Wed, 26 Aug 2026 02:39:52 +0100 +Subject: [PATCH] [PR #13549/4602990f backport][3.14] Fix flaky descriptor test + (#13551) + +**This is a backport of PR #13549 as merged into master +(4602990f60241f759f861a3a4c1243ba2294ab53).** + +Co-authored-by: Sam Bull + +CVE: CVE-2026-111066 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/011c08204197beba8281911907b59ffcecea1413] + +Signed-off-by: Darsh Kelaiya +--- + tests/test_web_functional.py | 20 +++++++++++++++++--- + 1 file changed, 17 insertions(+), 3 deletions(-) + +diff --git a/tests/test_web_functional.py b/tests/test_web_functional.py +index 78bd265..2298958 100644 +--- a/tests/test_web_functional.py ++++ b/tests/test_web_functional.py +@@ -2076,7 +2076,9 @@ async def test_post_max_client_size_counts_undecoded_bytes( + assert resp.status == 413 + + +-@pytest.mark.skipif(not os.path.isdir("/dev/fd"), reason="needs /dev/fd to count fds") ++@pytest.mark.skipif( ++ not os.path.isdir("/proc/self/fd"), reason="needs /proc/self/fd to identify fds" ++) + @pytest.mark.parametrize( + ("parts", "part_body", "expected_fds"), + ( +@@ -2090,10 +2092,22 @@ async def test_post_file_fields_descriptor_cost( + ) -> None: + """Only a part past the spool size may cost a descriptor.""" + ++ def deleted_file_fds() -> set[tuple[str, str]]: ++ """(fd, symlink target) pairs for open fds backed by deleted files.""" ++ fds = set() ++ for name in os.listdir("/proc/self/fd"): ++ try: ++ target = os.readlink(f"/proc/self/fd/{name}") ++ except OSError: ++ continue # closed between listdir and readlink ++ if target.endswith("(deleted)"): ++ fds.add((name, target)) ++ return fds ++ + async def handler(request: web.Request) -> web.Response: +- before = set(await asyncio.to_thread(os.listdir, "/dev/fd")) ++ before = await asyncio.to_thread(deleted_file_fds) + data = await request.post() +- after = set(await asyncio.to_thread(os.listdir, "/dev/fd")) ++ after = await asyncio.to_thread(deleted_file_fds) + assert len(data) == parts + return web.Response(text=str(len(after - before))) + diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb index db40e59a6b..59e9f74e89 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb @@ -40,6 +40,8 @@ SRC_URI += "file://CVE-2024-52304.patch \ file://CVE-2026-111749.patch \ file://CVE-2026-111748_p1.patch \ file://CVE-2026-111748_p2.patch \ + file://CVE-2026-111066_p1.patch \ + file://CVE-2026-111066_p2.patch \ " CVE_STATUS[CVE-2026-34515] = "not-applicable-platform: Vulnerability only affects applications running on Windows" From patchwork Wed Nov 25 05:18:07 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: 105519 Received: from aer-iport-8.cisco.com (aer-iport-8.cisco.com [173.38.203.70]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.36134.1795583900563826640 for ; Tue, 24 Nov 2026 21:18:21 -0800 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=SDIeffD9; spf=pass (domain: cisco.com, ip: 173.38.203.70, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=8238; q=dns/txt; s=iport01; t=1795583900; x=1796793500; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ox72XccmWIEf0iYIBvZlsAWeuabGwmUDn9XuoYgZH/o=; b=SDIeffD9VOEkdjoGi8RMAne/BjnbRMxUdlYzwRYgjLFbjuNP9El4z4Nb lXZzTc9sOtJp7oVj7N2qgDLlvX7lXjsKHoUNgRrvTcc3aEMIpcdtUE+Gc R1lPhO9N+liJ94yVtwObZl7NmCAjxvXFA1Y4RJvj9MRUWfSMW0mcERi25 PinENr/HbWbHSwecF/qiRjC7Ga5rcX6RJhRQbKOcwo+q1OUEQA88+62Kp 5mRQLJQARoC1LqlnBuYTcBFcFsVi5IbBEMUWWLE/xr+QU6dFQN3Mj1TZQ LDpMQHvRACf9FqN0DC1UHDfA1d1JqkZLUBxwV9Q1XcvODVhICIJjDfVMO Q==; X-CSE-ConnectionGUID: tpkEol/zSTyGWGzlb4KlQw== X-CSE-MsgGUID: SlrtbXpeQFqvFO3Lyp/dKw== X-IPAS-Result: A0BJAgAsbAZr/9JK/pBaglmCGD91YENJA5ZIA5FQjFmBfg8BAQEPRA0EAQGEP0YCjiICJjQJDgECBAMCAwEBAQEBAQEBAQEBAQoBAQUBAQECAQcFgQ4Thk8NkBIBAgEDJwsBGAEtEBwDAQIvKyMIGYIqWAGCdAMRugSBeTOBAYMpAUNBUNszAQsUAYE4hUKIJV0YAYR+JxsbgXKBFYE7gi+BBYFcAQECAYEkEYZuBIIigQyBVI0TAoFJiFJIgR4DWSwBVRMNCgsHBYFoAzUSKhVuMh2BIzsXgQcbBgWBHIEegRKBA12BKyhdASGBCIF1AoJRggACAUlBDgdFUwklQxJHJCIIEgkBExosCoEaNTwJJj8VDGcLGgVhCAINDHQ5EDAcJC8FGSY8GwqBDCcdHhkOAikGFiELNBgNSBEsNxUZBD5uB5QTgwsQDm0JCgETEgQCf1VTBRwCMJJnkB+CIaERCiiDeYwklToaM4QEgVelFwuYfYJZhiiCNoJTlVcqUIRqgWg8gVlwFYMiCUoZD44uCwuBFAECgkmFE1HIdyYyAgEIAy8BAQcCBw4DC4FokAABJ4FWAQE IronPort-Data: A9a23:jwp8PK2GLSezt5KU3/bD5YRwkn2cJEfYwER7XKvMYLTBsI5bpzAHn 2tLUTrSbqmIajGkfdtzb4ux/UgBv5PRzNVhSws43Hw8FHgiRegpqji6wuYcGwvIc6UvmWo+t 512huHodZ5yEzmE4Ef3b9ANlFEkvYmQXL3wFeXYDS54QA5gWU8JhAlq8wIDqtYAbeORXUXX5 rsen+WFYAX7gmcuaTpOg06+gEoHUMra6WtwUmMWPZinjHeG/1EJAZQWI72GLneQauF8Au6gS u/f+6qy92Xf8g1FIovNfmHTKxBirhb6ZGBiu1IOM0SQqkEqSh8ajs7XAMEhhXJ/0F1lqTzeJ OJl7vRcQS9xVkHFdX90vxNwS0mSNoUekFPLzOTWXcG7lyX7n3XQL/pGEFk1EIocvfRMPXBhy tMKLDpRTRS6mLfjqF67YrEEasULJcTxeYdasXZ6wHSBXLAtQIvIROPB4towMDUY35wSW6yDO 4xGNXw1NUyojx5nYj/7DLoyn+qsj3juehVTqUmeouw85G27IAlZjuC2boGKKoXiqcN9pUKCu mj252nALAgEGvvE7SudtX6Pmbqa9c/8cMdIfFGizdZtmFCVy2kZBREaWFf+rfSnh0qWX9NEN 1dS/TIjq6U3/kGnQtTxGRqirxa5UgU0UtdKVul/4waXx++MskCSB3MPSXhKb9lOWNIKeAHGH 2Shx7vBbQGDepXMIZ5B3t94dQ+PBBU= IronPort-HdrOrdr: A9a23:64tZ/6HY5YIwjz2PpLqEyseALOsnbusQ8zAXPo5KJiC9Ffbo8P xG88576faZslsssTQb6LK90cq7MBfhHOBOgbX5VI3KNGKNhILrFvAG0WKI+VPd8kPFmtK1rZ 0QEJRWOZnXEUVwi9r87U2TFtYtx8TCzYWT7N2uqUuEiWpRGtldB8ATMHfjLnFL X-Talos-CUID: 9a23:kaFCEWlvCbPyCVhmu9Dx1+WMlArXOWHFz1rXJwiqMlp4Z4K6W1uapIBgqtU7zg== X-Talos-MUID: 9a23:HocJPAgGEi8c4YeCFi6PE8MpD8Ny/66eEE00v4wYle7fET1ofDu+k2Hi X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,229,1787011200"; d="scan'208";a="60363781" Received: from aer-l-core-09.cisco.com ([144.254.74.210]) by aer-iport-8.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 25 Nov 2026 05:18:16 +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 aer-l-core-09.cisco.com (Postfix) with ESMTPS id 559FA180001F5; Wed, 25 Nov 2026 05:18:16 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 80F16CBF21E; Tue, 24 Nov 2026 21:18:13 -0800 (PST) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: Darsh Kelaiya Subject: [oe][meta-python][scarthgap][PATCH 5/9] python3-aiohttp: fix CVE-2026-111065 Date: Tue, 24 Nov 2026 21:18:07 -0800 Message-Id: <20261125051811.2524271-6-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261125051811.2524271-1-dkelaiya@cisco.com> References: <20261125051811.2524271-1-dkelaiya@cisco.com> MIME-Version: 1.0 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: aer-l-core-09.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 25 Nov 2026 05:18:30 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132972 From: Darsh Kelaiya Backport the upstream cookie overflow and response cleanup fix [1] to aiohttp 3.9.5, as identified by [2]. Clamp positive Max-Age values before float conversion and expire nonpositive values immediately. Close a received response if subsequent processing fails so a malformed cookie cannot exhaust the connection pool. Include the upstream extreme Max-Age and connection-release regression tests. Adapt the response annotation, cookie-update test hook and root-path keys to 3.9.5. Raise the test error only for nonempty cookies because this client invokes update_cookies() even for clean responses. [1] https://github.com/aio-libs/aiohttp/commit/9dd8eaf4e31f1237ef2c1574a8c82a739fca5805 [2] https://github.com/aio-libs/aiohttp/security/advisories/GHSA-6cjc-53gc-5rqm Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-111065.patch | 171 ++++++++++++++++++ .../python/python3-aiohttp_3.9.5.bb | 1 + 2 files changed, 172 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111065.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111065.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111065.patch new file mode 100644 index 0000000000..916afb87ca --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111065.patch @@ -0,0 +1,171 @@ +From 9dd8eaf4e31f1237ef2c1574a8c82a739fca5805 Mon Sep 17 00:00:00 2001 +From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> +Date: Wed, 9 Sep 2026 14:43:30 +0100 +Subject: [PATCH] [PR #13677/9e08ba02 backport][3.14] Fix cookie overflow + (#13679) + +**This is a backport of PR #13677 as merged into master +(9e08ba02abe573ce9e4cc541d4e3c3646adb43a7).** + +--------- + +Co-authored-by: Sam Bull + +CVE: CVE-2026-111065 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/9dd8eaf4e31f1237ef2c1574a8c82a739fca5805] + +Backport Changes: +- Use the existing Optional spelling for the response variable. +- Use update_cookies() and SimpleCookie() in the regression tests, + retaining the older "/" expiration key. +- Raise the test cookie error only for nonempty cookies; this client + invokes update_cookies() even when a response has no Set-Cookie. + +Signed-off-by: Darsh Kelaiya +--- + CHANGES/13677.bugfix.rst | 1 + + aiohttp/client.py | 5 ++++ + aiohttp/cookiejar.py | 10 ++++++- + tests/test_client_functional.py | 46 +++++++++++++++++++++++++++++++++ + tests/test_cookiejar.py | 22 ++++++++++++++++ + 5 files changed, 83 insertions(+), 1 deletion(-) + create mode 100644 CHANGES/13677.bugfix.rst + +diff --git a/CHANGES/13677.bugfix.rst b/CHANGES/13677.bugfix.rst +new file mode 100644 +index 0000000..bea67cb +--- /dev/null ++++ b/CHANGES/13677.bugfix.rst +@@ -0,0 +1 @@ ++Fixed a possible ``OverflowError`` on cookies and a connection not being closed properly -- by :user:`Dreamsorcerer`. +diff --git a/aiohttp/client.py b/aiohttp/client.py +index 4674b19..2e88917 100644 +--- a/aiohttp/client.py ++++ b/aiohttp/client.py +@@ -509,6 +509,7 @@ class ClientSession: + await trace.send_request_start(method, url.update_query(params), headers) + + timer = tm.timer() ++ resp: Optional[ClientResponse] = None + try: + with timer: + while True: +@@ -727,6 +728,10 @@ class ClientSession: + handle.cancel() + handle = None + ++ if resp is not None: ++ # A failure occurred after the response was received. ++ resp.close() ++ + for trace in traces: + await trace.send_request_exception( + method, url.update_query(params), headers, e +diff --git a/aiohttp/cookiejar.py b/aiohttp/cookiejar.py +index 4f694b6..b69e9e2 100644 +--- a/aiohttp/cookiejar.py ++++ b/aiohttp/cookiejar.py +@@ -340,7 +340,15 @@ class CookieJar(AbstractCookieJar): + if max_age: + try: + delta_seconds = int(max_age) +- max_age_expiration = min(time.time() + delta_seconds, self.MAX_TIME) ++ # https://datatracker.ietf.org/doc/html/rfc6265#section-5.2.2 ++ if delta_seconds <= 0: ++ max_age_expiration = 0.0 ++ else: ++ # Cap first to protect against OverflowError on next line. ++ delta_seconds = min(delta_seconds, self.MAX_TIME) ++ max_age_expiration = min( ++ time.time() + delta_seconds, self.MAX_TIME ++ ) + self._expire_cookie(max_age_expiration, domain, path, name) + except ValueError: + cookie["max-age"] = "" +diff --git a/tests/test_client_functional.py b/tests/test_client_functional.py +index 649e766..d695638 100644 +--- a/tests/test_client_functional.py ++++ b/tests/test_client_functional.py +@@ -2400,6 +2400,52 @@ async def test_set_cookies_max_age_overflow(aiohttp_client) -> None: + assert int(cookie["max-age"]) == int(overflow) + + ++async def test_connection_released_when_cookie_processing_fails( ++ aiohttp_client: AiohttpClient, ++) -> None: ++ class EvilJar(aiohttp.CookieJar): ++ def update_cookies( ++ self, cookies: Any, response_url: URL = URL() ++ ) -> None: ++ if cookies: ++ raise RuntimeError("boom") ++ super().update_cookies(cookies, response_url) ++ ++ hold = asyncio.Event() ++ ++ async def hostile(request: web.Request) -> web.StreamResponse: ++ ret = web.StreamResponse() ++ ret.content_length = 2 ++ ret.set_cookie("sid", "x") ++ await ret.prepare(request) ++ await ret.write(b"x") ++ await hold.wait() ++ assert False ++ ++ async def clean(request: web.Request) -> web.Response: ++ return web.Response() ++ ++ app = web.Application() ++ app.router.add_get("/hostile", hostile) ++ app.router.add_get("/clean", clean) ++ connector = aiohttp.TCPConnector(limit=1) ++ client = await aiohttp_client(app, connector=connector, cookie_jar=EvilJar()) ++ ++ try: ++ for _ in range(2): ++ with pytest.raises(RuntimeError, match="boom") as excinfo: ++ await client.get("/hostile") ++ assert not connector._acquired ++ del excinfo ++ ++ # The single connector slot is free again: an unaffected request ++ # succeeds instead of waiting forever for a connection. ++ async with client.get("/clean") as resp: ++ assert resp.status == 200 ++ finally: ++ hold.set() ++ ++ + async def test_request_conn_error() -> None: + client = aiohttp.ClientSession() + with pytest.raises(aiohttp.ClientConnectionError): +diff --git a/tests/test_cookiejar.py b/tests/test_cookiejar.py +index df59759..3c9933b 100644 +--- a/tests/test_cookiejar.py ++++ b/tests/test_cookiejar.py +@@ -1176,3 +1176,25 @@ async def test_save_load_json_secure_cookies(tmp_path: Path) -> None: + assert cookie["secure"] is True + assert cookie["httponly"] is True + assert cookie["domain"] == "example.com" ++ ++ ++async def test_update_cookies_max_age_beyond_float_range_is_clamped() -> None: ++ """A hostile Max-Age larger than float max must clamp, not raise OverflowError.""" ++ url = URL("https://example.com/") ++ jar = CookieJar() ++ ++ jar.update_cookies(SimpleCookie(f"sid=x; Max-Age={'9' * 309}"), url) ++ ++ assert "sid" in jar.filter_cookies(url) ++ assert jar._expirations[("example.com", "/", "sid")] == CookieJar.MAX_TIME ++ ++ ++async def test_update_cookies_negative_max_age_beyond_float_range_expires() -> None: ++ """A negative Max-Age below float min must expire the cookie, not raise.""" ++ url = URL("https://example.com/") ++ jar = CookieJar() ++ ++ jar.update_cookies(SimpleCookie(f"sid=x; Max-Age=-{'9' * 309}"), url) ++ ++ assert "sid" not in jar.filter_cookies(url) ++ assert len(jar) == 0 diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb index 59e9f74e89..8d7fe9f8dd 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb @@ -42,6 +42,7 @@ SRC_URI += "file://CVE-2024-52304.patch \ file://CVE-2026-111748_p2.patch \ file://CVE-2026-111066_p1.patch \ file://CVE-2026-111066_p2.patch \ + file://CVE-2026-111065.patch \ " CVE_STATUS[CVE-2026-34515] = "not-applicable-platform: Vulnerability only affects applications running on Windows" From patchwork Wed Nov 25 05:18:08 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: 105520 Received: from aer-iport-6.cisco.com (aer-iport-6.cisco.com [173.38.203.68]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.36180.1795583900532832989 for ; Tue, 24 Nov 2026 21:18:21 -0800 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=g1ADrroc; spf=pass (domain: cisco.com, ip: 173.38.203.68, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=16765; q=dns/txt; s=iport01; t=1795583900; x=1796793500; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SQnHceLsFUqtBQahbaKT5FK92HCkbk/k9eg+gdGPX6o=; b=g1ADrrocNkis10avDfmc4KYemNjAauOqQ9TrUVt0LA/+Kc1Wnb0/M80V 9d2XUAFlPgOAZL+qzcOK/HkM2yW9Jdh4kLm6AcIBAslUxy6KNN82rpHMv C2z/D/3myrGLNfDTnd0Td53LfGnWNyUKjXmf+1wzCe2U0C/71q1rixTdi 2O4Pwv803hmJg5pOoHFBowangrzr6ukwcAvDU5AcUYjCxvkEvPRCtxBEI qq5aV7xRjkjjNlLEMkf+zQdQvd50kQQMCVucFVluBFsj7k4t5T7fR4WWt yb8DwH4pwLWbLYNeDwFbG9K4WbOtZ3T68qgn3kkglWJLLtUcNAGVfATPj g==; X-CSE-ConnectionGUID: 3EL6qaQxTByaPhofg50X+g== X-CSE-MsgGUID: i7t9+rD1Q8m3WIQL6TDnuQ== X-IPAS-Result: A0BJAgAhbQZr/9BK/pBaglmCGD91YENJA5ZIA5FQjFmBfg8BAQEPRA0EAQGEP0YCjiICJjQJDgECBAMCAwEBAQEBAQEBAQEBAQoBAQUBAQECAQcFgQ4Thk8NkBIBAgEDJwsBGAEtEBwDAQIvKyMIGYIqWAGCdAMRugOBeTOBAYMpAYFU2zMBCxQBgTiFQoglXRgBhH4nGxuBcoEVgTuCL4EFgVwCgUiGXgSCDRWBDIEHTYY3A4ZZAoFJiFJIgR4DWSwBVRMNCgsHBYFoAzUSKhVuMh2BIzsXgQcbBgWBHIEegRKBA12BKyhdASGBCIF1AoJRggACAUlBDgdFUwklQxJHJCIIEgkBExosCoEaNTwJJj8VDGcLGgVhCAINDHQ5EDAcJC8FGSY8GwqBDCcdHhkOAikGFiELNBgNSBEsNxUZBD5uB5QTgxsBDQhEBwIYEwEqAQSBAQwjIxFEBhYykkUZCQGSP4E1n1wKKIN5jCSVOhozhASUGpJUC5h9glmLMZVpGFCEaoFoPIFZcBWDIglKGQ9YjWGDa85bJjICCQMvAQEHAgcOAwuBaJAABIEaYAEB IronPort-Data: A9a23:kQJ7IKzMReVg/7eKKeV6t+dgxyrEfRIJ4+MujC+fZmUNrF6WrkVTy zEcWGyEaarZZ2f8fd4kbdmy/UJT7JfVztRkTwtuq1hgHilAwSbn6Xt1DatR0we6dJCroJdPt p1GAjX4BJlqCCKa/lH9aOWJQUBUjcmgXqD7BPPPJhd/TAplTDZJoR94kobVuKYw6TSCK13L4 4yaT/H3Ygf/hWctaD9MsspvlTs21BjMkGJA1rABTagjUG/2zxE9EJ8ZLKetGHr0KqE8NvK6X evK0Iai9Wrf+Ro3Yvv9+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+vpT2M4nVKtio27hc+adZ zl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CCe5xWuTpfi/xlhJBobGdMB899nPUtf/ MQYLz4CM0izxO3jldpXSsE07igiBMDmJsYb/3pn1zycValgSpHYSKKM7thdtNsyrpkSQbCEO pZfNmYpNkyQC/FMEg9/5JYWkOSlgnD+YjRwo1OOrq1x6G/WpOB0+Oa1aYqJI4fVLSlTtkfHu jOF5UigO0Efb+O+8B7bzl6qm9aayEsXX6pXTtVU7MVCh0WewGEWAhAaWVa35PW0lEO6c9ZeM FAPvC02oK4/8UamQtXwU1u/unHsg/IHc9NdCag+rQqK0KeRu1nfDWkfRTkHY9sj3CMreQEXO payt4uBLVRSXHe9EhpxKp/8QeuOBBUo IronPort-HdrOrdr: A9a23:3BPNVK/drRdb4bkb+Tluk+D6I+orL9Y04lQ7vn2ZhyY7TiX+rb HIoB11737JYVoqNU3I3OrwWpVoIkmskaKdn7NwAV7KZmCP0wGVxcNZnO7fKlbbdREWmNQw6U 4ZSdkcNPTASX5nkM39/A60V/wkwNWB7eSUoN229QYKcemvAJsQlzuQzW2gYzRLeDU= X-Talos-CUID: 9a23:qy1SiGjlI5Bv5MgWtx+48/0PgjJuKVD5km7ZGl+EI3dgcL2SR1DNoJMnnJ87 X-Talos-MUID: 9a23:uzKAoQZTw2MOc+BTtmDw1XJ4GJ5Rs6H1N2E0tcs6l8+ZDHkl X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,232,1787011200"; d="scan'208";a="60184137" Received: from aer-l-core-07.cisco.com ([144.254.74.208]) by aer-iport-6.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 25 Nov 2026 05:18:16 +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 aer-l-core-07.cisco.com (Postfix) with ESMTPS id 48DD918000214; Wed, 25 Nov 2026 05:18:16 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 8899ACBF234; Tue, 24 Nov 2026 21:18:13 -0800 (PST) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: Darsh Kelaiya Subject: [oe][meta-python][scarthgap][PATCH 6/9] python3-aiohttp: fix CVE-2026-111064 Date: Tue, 24 Nov 2026 21:18:08 -0800 Message-Id: <20261125051811.2524271-7-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261125051811.2524271-1-dkelaiya@cisco.com> References: <20261125051811.2524271-1-dkelaiya@cisco.com> MIME-Version: 1.0 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: aer-l-core-07.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 25 Nov 2026 05:18:30 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132973 From: Darsh Kelaiya Backport the idle-connection timeout fix [1] to aiohttp 3.9.5, as identified by [2]. Start the keepalive deadline when the connection is established and use the existing timeout to bound the wait for the first request headers. [1] https://github.com/aio-libs/aiohttp/commit/be846822b4b3a5a54b6163e794b42dc06fba54a3 [2] https://github.com/aio-libs/aiohttp/security/advisories/GHSA-5wr8-gcqf-gqf3 Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-111064.patch | 398 ++++++++++++++++++ .../python/python3-aiohttp_3.9.5.bb | 1 + 2 files changed, 399 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111064.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111064.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111064.patch new file mode 100644 index 0000000..7caf9c3 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111064.patch @@ -0,0 +1,398 @@ +From be846822b4b3a5a54b6163e794b42dc06fba54a3 Mon Sep 17 00:00:00 2001 +From: Sam Bull +Date: Tue, 29 Sep 2026 00:08:22 +0100 +Subject: [PATCH] Close idle connections (#13681) (#13838) + +CVE: CVE-2026-111064 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/be846822b4b3a5a54b6163e794b42dc06fba54a3] + +Backport Changes: +- Use 3.9.5's _keepalive_time and task creation, preserve None as + disabled, and reuse the existing 75-second default. +- Replace the old periodic timer check using the stored start time. + An early callback rearms at the deadline. A finished waiter stays + open. +- Document that the initial deadline covers only request headers. + Omit the 3.14.4 version marker and already-correct default update. +- Cover timer setup, rearming, and waiter states with mocked loops + and transports. Use the 3.9.5 raw-server fixture to check idle, + partial-header and post-request expiry on loopback. Synchronize the + slow handler with the initial deadline and check its response. + Adapt the WebSocket fixture signature and omit unrelated typing. + +(cherry picked from commit e07684ef9056183bbefba1ae3f717a23f243631e) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/13681.bugfix.rst | 1 + aiohttp/web_protocol.py | 38 +++++----- + docs/web_reference.rst | 5 + + tests/test_web_protocol.py | 76 +++++++++++++++++++++ + tests/test_web_server.py | 118 ++++++++++++++++++++++++++++++++ + tests/test_web_websocket_functional.py | 30 ++++++++ + 6 files changed, 250 insertions(+), 18 deletions(-) + create mode 100644 CHANGES/13681.bugfix.rst + +diff --git a/CHANGES/13681.bugfix.rst b/CHANGES/13681.bugfix.rst +new file mode 100644 +index 0000000000000000000000000000000000000000..e39b73a91fa2833b1492054e31b18fea9e265029 +--- /dev/null ++++ b/CHANGES/13681.bugfix.rst +@@ -0,0 +1 @@ ++Fixed idle connections not being closed if no request was received -- by :user:`Dreamsorcerer`. +diff --git a/aiohttp/web_protocol.py b/aiohttp/web_protocol.py +index 39a1b68502fb48b8d0640c8fd4ebd6e7308512d6..314c5c79274aee2fffaf17afb91ae0349ac8a798 100644 +--- a/aiohttp/web_protocol.py ++++ b/aiohttp/web_protocol.py +@@ -109,8 +109,7 @@ class RequestHandler(BaseProtocol): + status line, bad headers or incomplete payload. If any error occurs, + connection gets closed. + +- keepalive_timeout -- number of seconds before closing +- keep-alive connection ++ keepalive_timeout -- number of seconds before closing an idle connection. + + tcp_keepalive -- TCP keep-alive is on, default is on + +@@ -138,8 +137,6 @@ class RequestHandler(BaseProtocol): + + """ + +- KEEPALIVE_RESCHEDULE_DELAY = 1 +- + __slots__ = ( + "max_field_size", + "max_headers", +@@ -206,7 +203,7 @@ class RequestHandler(BaseProtocol): + super().__init__(loop) + + self._request_count = 0 +- self._keepalive = False ++ self._keepalive = True + self._current_request: Optional[BaseRequest] = None + self._manager: Optional[Server] = manager + self._request_handler: Optional[_RequestHandler] = manager.request_handler +@@ -310,7 +307,15 @@ class RequestHandler(BaseProtocol): + if self._tcp_keepalive: + tcp_keepalive(real_transport) + +- self._task_handler = self._loop.create_task(self.start()) ++ loop = self._loop ++ # Need to enable keepalive timeout at start of connection, as there's no other ++ # protection against a dead connection that doesn't send a request at all. ++ if self._keepalive_timeout is not None and self._keepalive_timeout > 0: ++ self._keepalive_time = loop.time() ++ close_time = self._keepalive_time + self._keepalive_timeout ++ self._keepalive_handle = loop.call_at(close_time, self._process_keepalive) ++ ++ self._task_handler = loop.create_task(self.start()) + assert self._manager is not None + self._manager.connection_made(self, real_transport) + +@@ -483,23 +488,20 @@ class RequestHandler(BaseProtocol): + self.logger.exception(*args, **kw) + + def _process_keepalive(self) -> None: ++ self._keepalive_handle = None + if self._force_close or not self._keepalive: + return + +- next = self._keepalive_time + self._keepalive_timeout ++ loop = self._loop ++ close_time = self._keepalive_time + self._keepalive_timeout ++ if loop.time() < close_time: ++ # Keep alive close check fired too early, reschedule ++ self._keepalive_handle = loop.call_at(close_time, self._process_keepalive) ++ return + + # handler in idle state +- if self._waiter: +- if self._loop.time() > next: +- self.force_close() +- return +- +- # not all request handlers are done, +- # reschedule itself to next second +- self._keepalive_handle = self._loop.call_later( +- self.KEEPALIVE_RESCHEDULE_DELAY, +- self._process_keepalive, +- ) ++ if self._waiter and not self._waiter.done(): ++ self.force_close() + + async def _handle_request( + self, +diff --git a/docs/web_reference.rst b/docs/web_reference.rst +index cc6201b42c09e36c993bd387af028bdd632cdaea..1f934021d7a44a0a66f7ed1e890e5cdc25ed00bf 100644 +--- a/docs/web_reference.rst ++++ b/docs/web_reference.rst +@@ -2988,6 +2988,11 @@ Utilities + :param float keepalive_timeout: a delay before a TCP connection is + closed after a HTTP request. The delay + allows for reuse of a TCP connection. ++ The same delay bounds how long a newly ++ accepted connection may take to deliver ++ its first complete request headers; ++ connections that stay idle or send ++ incomplete headers are closed. + + .. versionadded:: 3.8 + +diff --git a/tests/test_web_protocol.py b/tests/test_web_protocol.py +index dcda53965fb85711a2c9a6b573e554e73f2fcbd9..084b72edba0301dc17fc951f114b3751afae0934 100644 +--- a/tests/test_web_protocol.py ++++ b/tests/test_web_protocol.py +@@ -1,4 +1,5 @@ + import asyncio ++from typing import Optional, Tuple + from unittest import mock + + import pytest +@@ -17,6 +18,81 @@ def dummy_manager() -> Server: + ) # type: ignore[no-any-return] + + ++def _connect_with_keepalive( ++ dummy_manager: Server, timeout: Optional[float] ++) -> Tuple[RequestHandler, mock.Mock, mock.Mock]: ++ loop = mock.Mock(spec=asyncio.AbstractEventLoop) ++ loop.time.return_value = 10.0 ++ transport = mock.Mock(spec=asyncio.Transport) ++ transport.get_extra_info.return_value = None ++ handler = RequestHandler( ++ dummy_manager, ++ loop=loop, ++ keepalive_timeout=timeout, # type: ignore[arg-type] ++ tcp_keepalive=False, ++ ) ++ ++ with mock.patch.object(RequestHandler, "start", new=mock.Mock()): ++ handler.connection_made(transport) ++ ++ return handler, loop, transport ++ ++ ++@pytest.mark.parametrize("timeout", [2.0, 0.0, None]) ++def test_connection_made_schedules_initial_keepalive( ++ dummy_manager: Server, timeout: Optional[float] ++) -> None: ++ handler, loop, _ = _connect_with_keepalive(dummy_manager, timeout) ++ ++ if timeout: ++ loop.call_at.assert_called_once_with(12.0, handler._process_keepalive) ++ assert handler._keepalive_handle is loop.call_at.return_value ++ else: ++ loop.call_at.assert_not_called() ++ assert handler._keepalive_handle is None ++ ++ ++def test_initial_keepalive_rearms_if_called_early(dummy_manager: Server) -> None: ++ handler, loop, transport = _connect_with_keepalive(dummy_manager, 2.0) ++ handler._waiter = mock.Mock(spec=asyncio.Future) ++ handler._waiter.done.return_value = False ++ callback = loop.call_at.call_args.args[1] ++ loop.call_at.reset_mock() ++ loop.time.return_value = 11.0 ++ loop.call_at.return_value = mock.sentinel.rearmed ++ ++ callback() ++ ++ loop.call_at.assert_called_once_with(12.0, callback) ++ assert handler._keepalive_handle is mock.sentinel.rearmed ++ transport.close.assert_not_called() ++ ++ ++@pytest.mark.parametrize( ++ "waiter_done", [False, True, None], ids=["pending", "resolved", "dispatched"] ++) ++def test_initial_keepalive_deadline( ++ dummy_manager: Server, waiter_done: Optional[bool] ++) -> None: ++ handler, loop, transport = _connect_with_keepalive(dummy_manager, 2.0) ++ if waiter_done is not None: ++ waiter = mock.Mock(spec=asyncio.Future) ++ waiter.done.return_value = waiter_done ++ handler._waiter = waiter ++ callback = loop.call_at.call_args.args[1] ++ loop.call_at.reset_mock() ++ loop.time.return_value = 12.0 ++ ++ callback() ++ ++ assert handler._keepalive_handle is None ++ loop.call_at.assert_not_called() ++ if waiter_done is False: ++ transport.close.assert_called_once_with() ++ else: ++ transport.close.assert_not_called() ++ ++ + def test_pause_msg_queue_reading_without_transport( + loop: asyncio.AbstractEventLoop, + dummy_manager: Server, +diff --git a/tests/test_web_server.py b/tests/test_web_server.py +index d0fd95acdb4b17fcf8dc1a390e2a48d6ae68441c..6442224d86efe24be82c75969afe384329378c2b 100644 +--- a/tests/test_web_server.py ++++ b/tests/test_web_server.py +@@ -253,3 +253,121 @@ async def test_no_handler_cancellation(aiohttp_unused_port) -> None: + assert done_event.is_set() + finally: + await asyncio.gather(runner.shutdown(), site.stop()) ++ ++ ++async def test_initial_keepalive_is_armed_on_loopback( ++ aiohttp_raw_server, aiohttp_client ++) -> None: ++ keepalive_timeout = 30.0 ++ connection_made = web.Server.connection_made ++ opened = [] ++ handled = [] ++ ++ def observe_connection( ++ server: web.Server, ++ protocol: web.RequestHandler, ++ transport: asyncio.Transport, ++ ) -> None: ++ connection_made(server, protocol, transport) ++ opened.append((protocol, protocol._keepalive_handle, protocol._keepalive_time)) ++ ++ async def handler(request: web.BaseRequest) -> web.Response: ++ handled.append(request.protocol) ++ return web.Response(text="ok") ++ ++ server = await aiohttp_raw_server(handler, keepalive_timeout=keepalive_timeout) ++ cli = await aiohttp_client(server, timeout=client.ClientTimeout(total=10)) ++ with mock.patch.object(web.Server, "connection_made", observe_connection): ++ async with cli.get("/") as response: ++ assert response.status == 200 ++ assert await response.text() == "ok" ++ ++ [(protocol, timer, connection_time)] = opened ++ assert handled == [protocol] ++ assert isinstance(timer, asyncio.TimerHandle) ++ assert not timer.cancelled() ++ assert timer.when() == connection_time + keepalive_timeout ++ ++ ++@pytest.mark.parametrize( ++ "send_headers", [False, True], ids=["idle", "partial-headers"] ++) ++async def test_initial_keepalive_closes_on_loopback( ++ aiohttp_raw_server, send_headers: bool ++) -> None: ++ handler = mock.AsyncMock() ++ server = await aiohttp_raw_server(handler, keepalive_timeout=1.0) ++ reader, writer = await asyncio.open_connection(server.host, server.port) ++ ++ try: ++ if send_headers: ++ writer.write(b"GET / HTTP/1.1\r\nHost: localhost\r\n") ++ await writer.drain() ++ ++ assert await asyncio.wait_for(reader.read(1), timeout=5) == b"" ++ handler.assert_not_awaited() ++ finally: ++ writer.close() ++ await writer.wait_closed() ++ ++ ++async def test_keepalive_expires_on_loopback_after_complete_request( ++ aiohttp_raw_server, monkeypatch: pytest.MonkeyPatch ++) -> None: ++ expired = False ++ process_keepalive = web.RequestHandler._process_keepalive ++ ++ def observe_expiry(protocol: web.RequestHandler) -> None: ++ nonlocal expired ++ was_open = not protocol._force_close ++ process_keepalive(protocol) ++ if was_open and protocol._force_close: ++ expired = True ++ ++ monkeypatch.setattr(web.RequestHandler, "_process_keepalive", observe_expiry) ++ ++ async def handler(request: web.BaseRequest) -> web.Response: ++ return web.Response(body=b"ok") ++ ++ server = await aiohttp_raw_server(handler, keepalive_timeout=0.5) ++ reader, writer = await asyncio.open_connection(server.host, server.port) ++ try: ++ writer.write(b"GET / HTTP/1.1\r\nHost: example.com\r\n\r\n") ++ await writer.drain() ++ headers = await asyncio.wait_for(reader.readuntil(b"\r\n\r\n"), timeout=5) ++ assert headers.startswith(b"HTTP/1.1 200 ") ++ assert b"connection: close" not in headers.lower() ++ assert await asyncio.wait_for(reader.readexactly(2), timeout=5) == b"ok" ++ ++ # Keep the client open so EOF comes from the server's keepalive timer. ++ assert await asyncio.wait_for(reader.read(1), timeout=5) == b"" ++ assert expired ++ finally: ++ writer.close() ++ await writer.wait_closed() ++ ++ ++async def test_handler_slower_than_first_request_deadline( ++ aiohttp_raw_server, aiohttp_client, monkeypatch: pytest.MonkeyPatch ++) -> None: ++ """The initial deadline can expire while a complete request is handled.""" ++ deadline_processed = asyncio.Event() ++ process_keepalive = web.RequestHandler._process_keepalive ++ ++ def observe_deadline(protocol: web.RequestHandler) -> None: ++ process_keepalive(protocol) ++ if protocol._current_request is not None and protocol._keepalive_handle is None: ++ deadline_processed.set() ++ ++ monkeypatch.setattr(web.RequestHandler, "_process_keepalive", observe_deadline) ++ ++ async def handler(request: web.BaseRequest) -> web.Response: ++ await asyncio.wait_for(deadline_processed.wait(), timeout=5) ++ assert not request.protocol._force_close ++ return web.Response(text="ok") ++ ++ server = await aiohttp_raw_server(handler, keepalive_timeout=0.5) ++ cli = await aiohttp_client(server, timeout=client.ClientTimeout(total=10)) ++ async with cli.get("/") as response: ++ assert response.status == 200 ++ assert await response.text() == "ok" +diff --git a/tests/test_web_websocket_functional.py b/tests/test_web_websocket_functional.py +index b471b131c1ef704d46712476b11a16693c862559..686845ce9964f1aa04f810181a4852153950c0f0 100644 +--- a/tests/test_web_websocket_functional.py ++++ b/tests/test_web_websocket_functional.py +@@ -776,6 +776,36 @@ async def test_websocket_disable_keepalive(loop, aiohttp_client) -> None: + assert data == "OK" + + ++async def test_websocket_disable_keepalive_no_armed_handle( ++ aiohttp_server, aiohttp_client ++) -> None: ++ """keep_alive(False) when no keepalive timer was armed (keepalive_timeout=0).""" ++ ++ async def handler(request: web.Request) -> web.StreamResponse: ++ ws = web.WebSocketResponse() ++ assert ws.can_prepare(request) ++ # A zero timeout arms no deadline at connection_made(). ++ assert request.protocol._keepalive_handle is None ++ await ws.prepare(request) ++ assert not request.protocol._keepalive ++ assert request.protocol._keepalive_handle is None ++ ++ await ws.send_str("OK") ++ await ws.close() ++ return ws ++ ++ app = web.Application() ++ app.router.add_route("GET", "/", handler) ++ server = await aiohttp_server(app, keepalive_timeout=0) ++ client = await aiohttp_client(server) ++ ++ ws = await client.ws_connect("/") ++ data = await ws.receive_str() ++ assert data == "OK" ++ ++ await ws.receive() # Handle close ++ ++ + async def test_bug3380(loop, aiohttp_client) -> None: + async def handle_null(request): + return aiohttp.web.json_response({"err": None}) diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb index 8d7fe9f..16ec0a6 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb @@ -43,6 +43,7 @@ SRC_URI += "file://CVE-2024-52304.patch \ file://CVE-2026-111066_p1.patch \ file://CVE-2026-111066_p2.patch \ file://CVE-2026-111065.patch \ + file://CVE-2026-111064.patch \ " CVE_STATUS[CVE-2026-34515] = "not-applicable-platform: Vulnerability only affects applications running on Windows" From patchwork Wed Nov 25 05:18:09 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: 105521 Received: from aer-iport-1.cisco.com (aer-iport-1.cisco.com [173.38.203.51]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.36181.1795583900815576708 for ; Tue, 24 Nov 2026 21:18:21 -0800 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=Wc1OPS73; spf=pass (domain: cisco.com, ip: 173.38.203.51, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=16930; q=dns/txt; s=iport01; t=1795583901; x=1796793501; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oT5pHQk9Emw5jieJxzmDN59cAy466KnCPrtFVOiLi2Y=; b=Wc1OPS73ZLs5cZWbd+WCTGla85K7r4UsKz9Hr6tlfnYF8DLo/GHR3AD5 r1WFtkAIcPVW8LQhJt+Fim0LhEW3RFAhqvLQN+FS64kFhyVMUwl7/kL1S H9QPIHqSJ/FhidZN4MALnvECdJzAUsmu7+5XrpH5HpL1+8wFIJMln5EsR LnhzsABHdVyBRAAHyZRhhc9NB5vfOXpq1Yqa2ieej6Lt/4sR6qbHg/bqS RGYwEMI0N7SvGkht5fB7Gw5NYn4OVS460xu+2djjiwkWGte7dKVxcTqX6 559vxH+PZi+7a89rOLRWQfZ2eZoCpkyFtSub1SEzN16lGIp9lbmSWuRFx Q==; X-CSE-ConnectionGUID: aR6ipp5oRQazU/CzhYjRug== X-CSE-MsgGUID: OpsE337aSlqaEJMikN6h6g== X-IPAS-Result: A0BNAgCpbAZr/8xK/pBaglmCV3VgQ0kDlkgDgx2bDIF+DwEBAQ9EDQQBAYQ/RgKOIgImNAkOAQIEAwIDAQEBAQEBAQEBAQEBCgEBBQEBAQIBBwWBDhOGTw2QEgECAQMnCwEZLRAcAgEBAi8kByMIGYMCAYJxAwMRRrk9gXkzgQGDKoFU2zMBCxQBgTiBc4NPiCVdGAFEhDoIHxsbgXKBFYE7gi+BBYFcAoFIhl4Egg0VgQyBVIECgiCJcQKBSYhSSIEeA1ksAVUTDQoLBwWBaAM1EioVbjIdgSM7F4EHGwYFgRyBHoESgQNdgSsoXQEhgQiBdQKCUYIAAgFJQQ4HRVMJJUMSRyQiCBIJARMaLAqBGjU8CSY/FQxnCxoFYQgCDQx0ORAwHCQvBRkmPBsKgQwnHR4ZDgIpBhYhCzQYDUgRLDcVGQQ+bgeUE4MbASw0LQEqAQR7IYEHAQQGAQcBDQIckn2QHYIhoREKKIN5jCSVOhozhVulFwuYfYs3glOCYQaGHYxJHBhQhGqBaDyBWXAVO4JnCUoZD2GNWINrhWTIdyYyAgkDLwEBBwIHDgMLgWiQACyBUgEB IronPort-Data: A9a23:XDcBXqCoPJAFsRVW/37iw5YqxClBgxIJ4kV8jS/XYbTApGh0g2NVz 2tKXj3TPq2IYTDwe41wa4qzoB9TsZ7dnddlOVdlrnsFo1CmBibm6XV1Cm+qYkt+++WaFBoPA /02M4eGcYZsCC+G+39BC5C5xVFkz6aEW7HgP+DNPyF1VGdMRTwo4f5Zs7ZRbrVA357jXGthh fuo+5eBYQb/gGYuWo4pw/vrRC1H7ayaVAww5jTSVdgT1HfCmn8cCo4oJK3ZBxPQXolOE+emc P3Ixbe/83mx109F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq+kTe5p0G2M80Mi+7vdkmc+dZk 72hvbToIesg0zaldO41C3G0GAkmVUFKFSOuzXWX6aSuI0P6n3TEys8wDVkuYIoiw+9lPCZl5 /wpKgoQYUXW7w626OrTpuhEj8k5ac2uN4QFtzQ4lnfSDO0tRtbIRKCiCd1whWtswJoTQbCBO 4xDMWYHgBfoO3WjPn8bC586lea5j1H0ciZTrxSeoq9fD237klYgjeO2aIa9ltqiYt1Osx3D+ Wv9+33wLzM/Nd+5lzrb/Sf57gPItWahMG4IL5W/7vNsjViZy2AfBRFTWValrP2Rjk+lR8kZL FQZ/Ccrp6U++EGnCN7nUHWFTGWstxMGHt4VGOog5UTVkezf4h2SAS4PSTsphMEaifLajAcCj jeh9+4FzxQ22FFJYRpxLoupkA4= IronPort-HdrOrdr: A9a23:rAQl6K3nHeBE0e2TsSzkggqjBJAkLtp133Aq2lEZdPWaSKOlfq eV7ZMmPHDP6Qr5NEtMpTnEAtjjfZq+z+8Q3WBuB9eftWDd0QPCRr2Kr7GSpgEIcBeRygcy78 tdmtBFeb7NJGk/q9rm6w+lFNtl6tyG/Ke0wdr69R5WPGdXg2UK1XYANu5deXcGPTV7OQ== X-Talos-CUID: 9a23:8RWs82idTEeAZ/vtxc72PwIvHDJue0eDzW/IfkiCMG97dfq+W1+h+pl5nJ87 X-Talos-MUID: 9a23:HsXD9AsZukdZ0R0dG82noyl5GZwzvK2VDFkEvLcjusqiaywuNGLI X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,230,1787011200"; d="scan'208";a="62953304" Received: from aer-l-core-03.cisco.com ([144.254.74.204]) by aer-iport-1.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 25 Nov 2026 05:18:16 +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 aer-l-core-03.cisco.com (Postfix) with ESMTPS id 62BF81800020F; Wed, 25 Nov 2026 05:18:16 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 8E4D5CBEF8A; Tue, 24 Nov 2026 21:18:13 -0800 (PST) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: Darsh Kelaiya Subject: [oe][meta-python][scarthgap][PATCH 7/9] python3-aiohttp: fix CVE-2026-111063 Date: Tue, 24 Nov 2026 21:18:09 -0800 Message-Id: <20261125051811.2524271-8-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261125051811.2524271-1-dkelaiya@cisco.com> References: <20261125051811.2524271-1-dkelaiya@cisco.com> MIME-Version: 1.0 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: aer-l-core-03.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 25 Nov 2026 05:18:30 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132974 From: Darsh Kelaiya Backport the Secure shared-cookie fix [1] to aiohttp 3.9.5, as identified by [3]. Check Secure before the shared-cookie branch adds the cookie to the outgoing set. Include the trusted-origin correction [2] so per-request cookies honor the session jar's treat_as_secure_origin policy. Keep the existing constructor defaults for the temporary cookie jar. [1] https://github.com/aio-libs/aiohttp/commit/999c356d61e966faffa97b06ab0d0455226d36c5 [2] https://github.com/aio-libs/aiohttp/commit/95081f8a353be2873643ab6dd74904ca413e45e0 [3] https://github.com/aio-libs/aiohttp/security/advisories/GHSA-494j-54xm-rwp3 Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-111063_p1.patch | 122 +++++++++ .../python3-aiohttp/CVE-2026-111063_p2.patch | 257 ++++++++++++++++++ .../python/python3-aiohttp_3.9.5.bb | 2 + 3 files changed, 381 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111063_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111063_p2.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111063_p1.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111063_p1.patch new file mode 100644 index 0000000000..417103af7a --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111063_p1.patch @@ -0,0 +1,122 @@ +From 999c356d61e966faffa97b06ab0d0455226d36c5 Mon Sep 17 00:00:00 2001 +From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> +Date: Sun, 27 Sep 2026 21:27:34 +0100 +Subject: [PATCH] [PR #13830/e11d2836 backport][3.14] Fix secure shared cookie + (#13832) + +**This is a backport of PR #13830 as merged into master +(e11d2836203a21bec59095498e578d37801027e7).** + +Co-authored-by: Sam Bull + +CVE: CVE-2026-111063 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/999c356d61e966faffa97b06ab0d0455226d36c5] + +Backport Changes: +- Guard the existing shared-cookie branch in filter_cookies(); + aiohttp 3.9.5 does not have a morsel cache. +- Omit the upstream cache regression because aiohttp 3.9.5 has no + morsel cache. This also drops its ordinary HTTPS delivery check. + +Signed-off-by: Darsh Kelaiya +--- + CHANGES/13830.bugfix.rst | 1 + + aiohttp/cookiejar.py | 2 ++ + docs/client_reference.rst | 3 ++- + docs/spelling_wordlist.txt | 1 + + tests/test_client_functional.py | 9 +++++++-- + tests/test_cookiejar.py | 10 ++++++++++ + 6 files changed, 23 insertions(+), 3 deletions(-) + create mode 100644 CHANGES/13830.bugfix.rst + +diff --git a/CHANGES/13830.bugfix.rst b/CHANGES/13830.bugfix.rst +new file mode 100644 +index 0000000..2a39769 +--- /dev/null ++++ b/CHANGES/13830.bugfix.rst +@@ -0,0 +1 @@ ++Fixed ``CookieJar.filter_cookies()`` sending shared cookies (cookies without a ``Domain`` attribute) marked ``Secure`` over unencrypted connections -- by :user:`Dreamsorcerer`. +diff --git a/aiohttp/cookiejar.py b/aiohttp/cookiejar.py +index cb5593c..59ace3a 100644 +--- a/aiohttp/cookiejar.py ++++ b/aiohttp/cookiejar.py +@@ -398,6 +398,8 @@ class CookieJar(AbstractCookieJar): + + # Send shared cookies + if not domain: ++ if is_not_secure and cookie["secure"]: ++ continue + filtered[name] = cookie.value + continue + +diff --git a/docs/client_reference.rst b/docs/client_reference.rst +index 49a2dfe..38b0833 100644 +--- a/docs/client_reference.rst ++++ b/docs/client_reference.rst +@@ -1924,7 +1924,8 @@ Utilities + :param ~yarl.URL response_url: URL of response, ``None`` for *shared + cookies*. Regular cookies are coupled with server's URL and + are sent only to this server, shared ones are sent in every +- client request. ++ client request (except that shared cookies marked ``Secure`` ++ are only sent over encrypted connections). + + .. method:: filter_cookies(request_url) + +diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt +index 3fb6d35..e0703d9 100644 +--- a/docs/spelling_wordlist.txt ++++ b/docs/spelling_wordlist.txt +@@ -331,6 +331,7 @@ UI + un + unawaited + unclosed ++unencrypted + unhandled + unicode + unittest +diff --git a/tests/test_client_functional.py b/tests/test_client_functional.py +index d695638..e18348d 100644 +--- a/tests/test_client_functional.py ++++ b/tests/test_client_functional.py +@@ -2290,12 +2290,17 @@ async def test_morsel_with_attributes(aiohttp_client) -> None: + c = http.cookies.Morsel() + c.set("test3", "456", "456") + c["httponly"] = True +- c["secure"] = True + c["max-age"] = 1000 + ++ # A Secure shared cookie must be withheld entirely: the test server ++ # is plain http, so it must not reach the handler at all. ++ c2: http.cookies.Morsel[str] = http.cookies.Morsel() ++ c2.set("test4", "789", "789") ++ c2["secure"] = True ++ + app = web.Application() + app.router.add_get("/", handler) +- client = await aiohttp_client(app, cookies={"test2": c}) ++ client = await aiohttp_client(app, cookies={"test2": c, "test4": c2}) + + async with client.get("/") as resp: + assert 200 == resp.status +diff --git a/tests/test_cookiejar.py b/tests/test_cookiejar.py +index d9cb5b2..8f852eb 100644 +--- a/tests/test_cookiejar.py ++++ b/tests/test_cookiejar.py +@@ -1018,6 +1018,16 @@ async def test_save_load_json_roundtrip( + assert saved_cookies == loaded_cookies + + ++async def test_treat_as_secure_origin_sends_secure_shared_cookie() -> None: ++ endpoint = URL("http://127.0.0.1/") ++ ++ jar = CookieJar(unsafe=True, treat_as_secure_origin=[endpoint]) ++ jar.update_cookies(SimpleCookie("shared-secure-cookie=first; Secure;")) ++ ++ filtered_cookies = jar.filter_cookies(request_url=endpoint) ++ assert "shared-secure-cookie" in filtered_cookies ++ ++ + 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" diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111063_p2.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111063_p2.patch new file mode 100644 index 0000000000..0d8e90eea0 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-111063_p2.patch @@ -0,0 +1,257 @@ +From 95081f8a353be2873643ab6dd74904ca413e45e0 Mon Sep 17 00:00:00 2001 +From: Sam Bull +Date: Mon, 28 Sep 2026 00:38:13 +0100 +Subject: [PATCH] Fix treat_as_secure_origin on request cookies (#13833) + (#13836) + +(cherry picked from commit 6bc84990f2a6429667f741d97f5da22884b8a8d3) + +CVE: CVE-2026-111063 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/95081f8a353be2873643ab6dd74904ca413e45e0] + +Backport Changes: +- Keep Union annotations and drop the unused List import. Pass only + trusted origins to the temporary jar. The 3.9.5 API has no public + unsafe or quote_cookie properties. +- Place the property beside existing methods and documentation; + the newer public cookie-inspection sections do not exist. +- Import the existing AiohttpServer test fixture type. + +Signed-off-by: Darsh Kelaiya +--- + CHANGES/13833.bugfix.rst | 1 + + aiohttp/abc.py | 5 ++++ + aiohttp/client.py | 6 +++- + aiohttp/cookiejar.py | 27 ++++++++++------- + docs/client_reference.rst | 13 +++++++-- + tests/test_client_functional.py | 51 ++++++++++++++++++++++++++++++++- + tests/test_cookiejar.py | 3 +- + 7 files changed, 91 insertions(+), 15 deletions(-) + create mode 100644 CHANGES/13833.bugfix.rst + +diff --git a/CHANGES/13833.bugfix.rst b/CHANGES/13833.bugfix.rst +new file mode 100644 +index 0000000..2d0f96c +--- /dev/null ++++ b/CHANGES/13833.bugfix.rst +@@ -0,0 +1 @@ ++Fixed per-request cookies (the ``cookies`` argument of a request method) marked ``Secure`` not being sent to origins listed in ``CookieJar``'s ``treat_as_secure_origin`` -- by :user:`Dreamsorcerer`. +diff --git a/aiohttp/abc.py b/aiohttp/abc.py +index ee83899..7dfbf5c 100644 +--- a/aiohttp/abc.py ++++ b/aiohttp/abc.py +@@ -146,6 +146,11 @@ class AbstractCookieJar(Sized, IterableBase): + def __init__(self, *, loop: Optional[asyncio.AbstractEventLoop] = None) -> None: + self._loop = get_running_loop(loop) + ++ @property ++ def treat_as_secure_origin(self) -> frozenset[URL]: ++ """Return origins considered secure even over cleartext connections.""" ++ return frozenset() ++ + @abstractmethod + def clear(self, predicate: Optional[ClearCookiePredicate] = None) -> None: + """Clear all cookies if no predicate is passed.""" +diff --git a/aiohttp/client.py b/aiohttp/client.py +index 2e88917..103858a 100644 +--- a/aiohttp/client.py ++++ b/aiohttp/client.py +@@ -540,7 +540,11 @@ class ClientSession: + all_cookies = self._cookie_jar.filter_cookies(url) + + if cookies is not None: +- tmp_cookie_jar = CookieJar() ++ tmp_cookie_jar = CookieJar( ++ treat_as_secure_origin=frozenset( ++ self._cookie_jar.treat_as_secure_origin ++ ), ++ ) + tmp_cookie_jar.update_cookies(cookies) + req_cookies = tmp_cookie_jar.filter_cookies(url) + if req_cookies: +diff --git a/aiohttp/cookiejar.py b/aiohttp/cookiejar.py +index 59ace3a..60131c9 100644 +--- a/aiohttp/cookiejar.py ++++ b/aiohttp/cookiejar.py +@@ -16,7 +16,6 @@ from typing import ( # noqa + Dict, + Iterable, + Iterator, +- List, + Mapping, + Optional, + Set, +@@ -117,7 +116,7 @@ class CookieJar(AbstractCookieJar): + *, + unsafe: bool = False, + quote_cookie: bool = True, +- treat_as_secure_origin: Union[StrOrURL, List[StrOrURL], None] = None, ++ treat_as_secure_origin: Union[StrOrURL, Iterable[StrOrURL], None] = None, + loop: Optional[asyncio.AbstractEventLoop] = None, + ) -> None: + super().__init__(loop=loop) +@@ -129,20 +128,28 @@ class CookieJar(AbstractCookieJar): + self._unsafe = unsafe + self._quote_cookie = quote_cookie + if treat_as_secure_origin is None: +- treat_as_secure_origin = [] ++ self._treat_as_secure_origin: frozenset[URL] = frozenset() + elif isinstance(treat_as_secure_origin, URL): +- treat_as_secure_origin = [treat_as_secure_origin.origin()] ++ self._treat_as_secure_origin = frozenset({treat_as_secure_origin.origin()}) + elif isinstance(treat_as_secure_origin, str): +- treat_as_secure_origin = [URL(treat_as_secure_origin).origin()] ++ self._treat_as_secure_origin = frozenset( ++ {URL(treat_as_secure_origin).origin()} ++ ) + else: +- treat_as_secure_origin = [ +- URL(url).origin() if isinstance(url, str) else url.origin() +- for url in treat_as_secure_origin +- ] +- self._treat_as_secure_origin = treat_as_secure_origin ++ self._treat_as_secure_origin = frozenset( ++ { ++ URL(url).origin() if isinstance(url, str) else url.origin() ++ for url in treat_as_secure_origin ++ } ++ ) + self._next_expiration: float = ceil(time.time()) + self._expirations: Dict[Tuple[str, str, str], float] = {} + ++ @property ++ def treat_as_secure_origin(self) -> frozenset[URL]: ++ """Return origins considered secure even over cleartext connections.""" ++ return self._treat_as_secure_origin ++ + def save(self, file_path: PathLike) -> None: + """Save cookies to a file using JSON format. + +diff --git a/docs/client_reference.rst b/docs/client_reference.rst +index 38b0833..5bb290e 100644 +--- a/docs/client_reference.rst ++++ b/docs/client_reference.rst +@@ -1901,7 +1901,7 @@ Utilities + .. versionadded:: 3.7 + + :param treat_as_secure_origin: (optional) Mark origins as secure +- for cookies marked as Secured. Possible types are ++ for cookies marked as Secured. + + Possible types are: + +@@ -1925,7 +1925,8 @@ Utilities + cookies*. Regular cookies are coupled with server's URL and + are sent only to this server, shared ones are sent in every + client request (except that shared cookies marked ``Secure`` +- are only sent over encrypted connections). ++ are only sent over encrypted connections or to origins listed ++ in *treat_as_secure_origin*). + + .. method:: filter_cookies(request_url) + +@@ -1969,6 +1970,14 @@ Utilities + + .. versionadded:: 4.0 + ++ .. attribute:: treat_as_secure_origin ++ ++ A :class:`frozenset` of :class:`~yarl.URL` origins that are ++ treated as secure even when the connection is not encrypted, as ++ configured by the *treat_as_secure_origin* parameter. ++ ++ .. versionadded:: 3.14.4 ++ + + .. class:: DummyCookieJar(*, loop=None) + +diff --git a/tests/test_client_functional.py b/tests/test_client_functional.py +index e18348d..d321d82 100644 +--- a/tests/test_client_functional.py ++++ b/tests/test_client_functional.py +@@ -30,7 +30,7 @@ from aiohttp.abc import AbstractResolver + from aiohttp.client_exceptions import TooManyRedirects + from aiohttp.compression_utils import DEFAULT_MAX_DECOMPRESS_SIZE, HAS_BROTLI + from aiohttp.http_exceptions import DecompressSizeError +-from aiohttp.pytest_plugin import AiohttpClient, TestClient ++from aiohttp.pytest_plugin import AiohttpClient, AiohttpServer, TestClient + from aiohttp.test_utils import unused_port + + +@@ -2306,6 +2306,55 @@ async def test_morsel_with_attributes(aiohttp_client) -> None: + assert 200 == resp.status + + ++async def test_request_secure_cookie_treat_as_secure_origin( ++ aiohttp_server: AiohttpServer, aiohttp_client: AiohttpClient ++) -> None: ++ """Per-request Secure cookies must honor the session jar's trusted origins.""" ++ ++ async def handler(request: web.Request) -> web.Response: ++ assert request.cookies.get("auth") == "token" ++ return web.Response() ++ ++ app = web.Application() ++ app.router.add_get("/", handler) ++ server = await aiohttp_server(app) ++ ++ jar = aiohttp.CookieJar(unsafe=True, treat_as_secure_origin=[server.make_url("/")]) ++ client = await aiohttp_client(server, cookie_jar=jar) # type: ignore[var-annotated] ++ ++ c: http.cookies.Morsel[str] = http.cookies.Morsel() ++ c.set("auth", "token", "token") ++ c["secure"] = True ++ ++ async with client.get("/", cookies={"auth": c}) as resp: ++ assert resp.status == 200 ++ ++ ++async def test_request_secure_cookie_not_sent_over_http( ++ aiohttp_client: AiohttpClient, ++) -> None: ++ """A per-request Secure cookie is only sent to the jar's trusted origins.""" ++ ++ async def handler(request: web.Request) -> web.Response: ++ assert request.cookies.keys() == {"plain"} ++ return web.Response() ++ ++ app = web.Application() ++ app.router.add_get("/", handler) ++ # The trusted origin never matches the test server, so the Secure ++ # cookie must still be withheld from this plain-http request. ++ jar = aiohttp.CookieJar(treat_as_secure_origin=[URL("http://example.com")]) ++ client = await aiohttp_client(app, cookie_jar=jar) ++ ++ c: http.cookies.Morsel[str] = http.cookies.Morsel() ++ c.set("auth", "token", "token") ++ c["secure"] = True ++ ++ cookies: dict[str, str | http.cookies.Morsel[str]] = {"auth": c, "plain": "ok"} ++ async with client.get("/", cookies=cookies) as resp: ++ assert resp.status == 200 ++ ++ + async def test_set_cookies(aiohttp_client) -> None: + async def handler(request): + ret = web.Response() +diff --git a/tests/test_cookiejar.py b/tests/test_cookiejar.py +index 8f852eb..f248de5 100644 +--- a/tests/test_cookiejar.py ++++ b/tests/test_cookiejar.py +@@ -732,6 +732,7 @@ class TestCookieJarSafe(TestCookieJarBase): + async def test_dummy_cookie_jar() -> None: + cookie = SimpleCookie("foo=bar; Domain=example.com;") + dummy_jar = DummyCookieJar() ++ assert dummy_jar.treat_as_secure_origin == frozenset() + assert len(dummy_jar) == 0 + dummy_jar.update_cookies(cookie) + assert len(dummy_jar) == 0 +@@ -847,7 +848,7 @@ async def test_pickle_format(cookies_to_send) -> None: + ) + async def test_treat_as_secure_origin_init(url) -> None: + jar = CookieJar(unsafe=True, treat_as_secure_origin=url) +- assert jar._treat_as_secure_origin == [URL("http://127.0.0.1")] ++ assert jar.treat_as_secure_origin == frozenset({URL("http://127.0.0.1")}) + + + async def test_treat_as_secure_origin() -> None: diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb index 16ec0a603b..f86a594669 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb @@ -44,6 +44,8 @@ SRC_URI += "file://CVE-2024-52304.patch \ file://CVE-2026-111066_p2.patch \ file://CVE-2026-111065.patch \ file://CVE-2026-111064.patch \ + file://CVE-2026-111063_p1.patch \ + file://CVE-2026-111063_p2.patch \ " CVE_STATUS[CVE-2026-34515] = "not-applicable-platform: Vulnerability only affects applications running on Windows" From patchwork Wed Nov 25 05:18:10 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: 105514 Received: from aer-iport-3.cisco.com (aer-iport-3.cisco.com [173.38.203.53]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.36132.1795583897000547374 for ; Tue, 24 Nov 2026 21:18:19 -0800 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=inSRsoUA; spf=pass (domain: cisco.com, ip: 173.38.203.53, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=42734; q=dns/txt; s=iport01; t=1795583898; x=1796793498; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qMVhY0WOF3mbkAp1byClObxr/I9P4iSfnmB8HvAEb8I=; b=inSRsoUA+eXjQNcuASsFkAnLg+5k8lI2Ba0kD/NFdr0crZZJEdhE+GNQ DhITGFr7/fowmLodiSaYsN+3CxXgq91v55EZI2I9dTFT7kcAkG2UBgZs5 5nvrre2NN0ABvWeRJj90SVN8IIGtKWo9QAqXReUPK+XcHSKbbEBCqn96U DqO3BsRhqX/k05/cCWnaKWIeyETJbEs5W9neKaxHmYtYoc+19i7Hhheqp AXjf3YT3yhPAe80mMpbjmqyWRgc+lDUz84VCR4gcJJ2cdfV6+TPvnBXmF 9sf1uHst+A0h8bl8R6a7XlAy1+VazgrHSTnE66JheFNXm98JbmmaubQHw w==; X-CSE-ConnectionGUID: P56LDI5mQ0qa2/nRvbXXqQ== X-CSE-MsgGUID: Ur+5nj2iTcSUXBKfOMCasg== X-IPAS-Result: A0AaAAAGbgZr/8xK/pBaHAEBAQEBAQcBARIBAQQEAQGBfAcBAQsBghc/dWBDSQOMb4lZA4ETkD2MWYF+DwEBAQ9EDQQBAYQ/RgKOIgImNAkOAQIEAwIDAQEBAQEBAQEBAQEBCgEBBQEBAQIBBwWBDhOGTw2QEgECAQMaAQwLARgBLRAcAwECLysjCBAJgipYAYJ0AxG6AYF5M4EBgykBMQLcVAELFAGBOAGFQYglXRgBhH4nGxuBcoEVgTuBOXaBBYFcAgKBNhAJhlUEgg0VgQyBVIECgiCDFQOGWQKBSYhSSIEeA1ksAVUTDQoLBwWBaAM1EioVbjIdgSM7F4EHGwYFgRyBHoESgQNdgSsoXQEhgQiBdQKCUYIAAgFJQQ4HRVMJJUMSRyQiCBIJARMaLAqBGjU8CSY/FQxnCxoFYQgCDQx0ORAwHCQvBRkmPBsKgQwnHR4ZDgIpBhYhCzQYDUgRLDcVGQQ+bgeUE4JuHQkHARUXTgkKAQcUCgUBfyEUMAQhIwYJAgUBBQIwkmAHAggUHgqReoE1n1wKKIN5jCSVOhozhASBV5JDklQLlhqCY44KlWkLDQFPhGqBaDyBWXAVO4JnCUoZD44rDgsceAEBAYJJhRPJSCYyAgkDLwEBBwIHDgMLgWiQAAEBAiSBVgEB IronPort-Data: A9a23:LH1jeqnKwja//Q9Wv0sZqfvo5gzWJ0RdPkR7XQ2eYbSJt1+Wr1Gzt xJKX2iCbveLa2CnLohyPoS/o0oB7ZaAnNNjSAs6rXhmQ1tH+JHPbTi7wugcHM8zwunrFh8PA xA2M4GYRCwMZiaC4Errav6x9yQUOZigHtLUEPTDNj16WThqQSIgjQMLs+Mii+aEu/Dha++2k Y20+ZK31GONgWYubDtNsf/b8XuDgdyr0N8mlg1mDRx0lAe2e0k9VPo3Oay3Jn3kdYhYdsbSb /rD1ryw4lTC9B4rDN6/+p6jGqHdauePVeQmoiM+t5mK2nCulARrukoIHKZ0hXNsttm8t4sZJ OOhGnCHYVxB0qXkwIzxWvTDes10FfUuFLTveRBTvSEPpqHLWyOE/hlgMK05FbVFpMJbIDxLz KQBIWpKaCqdjdKG2YvuH4GAhux7RCXqFIoSoDRkiDreF/tjGcuFSKTR7tge1zA17ixMNa+CO 4xDNGYpM0iGOUUTUrsUIMpWcOOAinrydzRZuVu9rqss6G+Vxwt0uFToGISNJIXVFJoI9qqej l/cvDn/AEsbCNek9Aqv0XyLo8TGhiyuDer+E5X9rJaGmma7wXQeDhATX1a3rfS1z0KzRd9bA 0gV4TY1668q+UqmS9PwUxG1rDiDpBF0ZjZLO+Q38kSJj6HT+QvcXjNCRT9aY9tgv8gzLdA36 mK0cxrSLWQHmNWopbi1r994cRva1fApEFI/ IronPort-HdrOrdr: A9a23:woq2wqzZ18EMJhv+RZU2KrPwDr1zdoMgy1knxilNoNJuHfBw8P re+8jzuiWUtN98YhwdcJW7Scu9qBDnhPpICPcqXYtKNTOO0ADDEGgh1/qG/9SKIUPDH4BmuZ uIC5IOa+HYPBxdkdvw5hW+HpILxdmK973tuMLlpk0dKz2Dr8pbnn9E4sHxKDwOeDV7 X-Talos-CUID: 9a23:y55T8m7YvxtIXof0rtsszBNKPuwEL3jklG7ZeQi+M3hjeI2McArF X-Talos-MUID: 9a23:GIVLmQkaWiwyBnkZ4h/vdnpfLoQ15ab0CXwGqqg2keqKEglbMiyS2WE= X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,232,1787011200"; d="scan'208";a="60617975" Received: from aer-l-core-03.cisco.com ([144.254.74.204]) by aer-iport-3.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 25 Nov 2026 05:18:17 +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 aer-l-core-03.cisco.com (Postfix) with ESMTPS id 62D5A1800022F; Wed, 25 Nov 2026 05:18:16 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 96D94CBEF98; Tue, 24 Nov 2026 21:18:13 -0800 (PST) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: Darsh Kelaiya Subject: [oe][meta-python][scarthgap][PATCH 8/9] python3-aiohttp: fix CVE-2026-69243 and CVE-2026-128129 Date: Tue, 24 Nov 2026 21:18:10 -0800 Message-Id: <20261125051811.2524271-9-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261125051811.2524271-1-dkelaiya@cisco.com> References: <20261125051811.2524271-1-dkelaiya@cisco.com> MIME-Version: 1.0 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: aer-l-core-03.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 25 Nov 2026 05:18:19 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132967 From: Darsh Kelaiya Backport the upgrade framing fix [1] to aiohttp 3.9.5, as identified by [4]. Both HTTP parsers must finish reading a framed request body before handing back an upgraded connection. Include the declined-upgrade follow-up [2] so the server returns to HTTP parsing at the correct request boundary. Include the tail limit and error-handling correction [3] so replay uses the normal HTTP error path and resumes reads after the buffer drains. The tail limit also fixes CVE-2026-128129, documented in [5]. [1] https://github.com/aio-libs/aiohttp/commit/6ae358f0983c3f4d6f67692b2f8e65dc8e091c98 [2] https://github.com/aio-libs/aiohttp/commit/716c83d2b697e56fd74f95a1aa3a451fd2fb02e8 [3] https://github.com/aio-libs/aiohttp/commit/3d850ee9b92573c7e913821cbcb96005beb3f4df [4] https://github.com/aio-libs/aiohttp/security/advisories/GHSA-mfx4-hv73-q22v [5] https://github.com/aio-libs/aiohttp/security/advisories/GHSA-pw86-h8fm-j323 Signed-off-by: Darsh Kelaiya --- .../CVE-2026-69243_CVE-2026-128129.patch | 673 ++++++++++++++++++ .../python3-aiohttp/CVE-2026-69243_p1.patch | 300 ++++++++ .../python3-aiohttp/CVE-2026-69243_p2.patch | 93 +++ .../python/python3-aiohttp_3.9.5.bb | 3 + 4 files changed, 1069 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69243_CVE-2026-128129.patch create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69243_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69243_p2.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69243_CVE-2026-128129.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69243_CVE-2026-128129.patch new file mode 100644 index 0000000..20de364 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69243_CVE-2026-128129.patch @@ -0,0 +1,673 @@ +From 3d850ee9b92573c7e913821cbcb96005beb3f4df Mon Sep 17 00:00:00 2001 +From: Sam Bull +Date: Sat, 22 Aug 2026 15:03:24 +0100 +Subject: [PATCH] Fix limit on message tail (#13501) (#13511) + +CVE: CVE-2026-69243 CVE-2026-128129 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/3d850ee9b92573c7e913821cbcb96005beb3f4df] + +Backport Changes: +- Reuse Scarthgap's HTTP receive path to replay a declined upgrade + after the request body drains and queue the usual 400 on errors. +- Check the tail limit on its first read, later reads and refills. + Leave reads paused while a queued parse error is awaiting its 400. +- Adapt upstream flow-control tests to 3.9.5's _upgrade flag and + mock reader. Keep checks at and below the limit, with an empty + tail at a zero limit, and after a reader is set. Also check the + first tail fill and refills on the older HTTP receive path. +- Exercise drain before replay with a real payload from a normal + POST in both parsers. Inject pending state and replay errors to + check request ordering, read resumption and the queued HTTP 400. +- Adapt raw HTTP regressions to 3.9.5's server fixture. Check + Content-Length and chunked upgrades with a pipelined request on + one loopback connection using both parsers. Cover combined and + fragmented sends, with bodies read by the handler or left for + the protocol to finish before replaying the following request. +- Keep client-driven WebSocket acceptance and connection reuse. + Use injected-state checks for isolated flow-control transitions. + +(cherry picked from commit c207cadb257e0959b192ffca0548eca8c71eb96a) +Signed-off-by: Darsh Kelaiya +--- + CHANGES/13501.bugfix.rst | 1 + aiohttp/web_protocol.py | 56 ++++---- + tests/test_web_protocol.py | 238 +++++++++++++++++++++++++++++++++ + tests/test_web_upgrade_integration.py | 236 +++++++++++++++++++++++++++++++++ + 4 files changed, 504 insertions(+), 27 deletions(-) + create mode 100644 CHANGES/13501.bugfix.rst + create mode 100644 tests/test_web_upgrade_integration.py + +diff --git a/CHANGES/13501.bugfix.rst b/CHANGES/13501.bugfix.rst +new file mode 100644 +index 0000000..4c45225 +--- /dev/null ++++ b/CHANGES/13501.bugfix.rst +@@ -0,0 +1 @@ ++Fixed a limit on message tail after an upgrade request -- by :user:`Dreamsorcerer`. +diff --git a/aiohttp/web_protocol.py b/aiohttp/web_protocol.py +index 2a48feb..2c2c8ca 100644 +--- a/aiohttp/web_protocol.py ++++ b/aiohttp/web_protocol.py +@@ -156,6 +156,7 @@ class RequestHandler(BaseProtocol): + "_msg_queue_resume_size", + "_msg_queue_paused", + "_message_tail", ++ "_read_bufsize", + "_waiter", + "_task_handler", + "_upgrade", +@@ -196,6 +197,7 @@ class RequestHandler(BaseProtocol): + # Low-water mark: resume reading once the queue drains to half the limit + # so we refill in batches instead of churning pause/resume per request. + self._msg_queue_resume_size = MAX_MSG_QUEUE_SIZE // 2 ++ self._read_bufsize = read_bufsize + # Set before super().__init__ so _reading_paused_for_msg_queue() is safe + # if BaseProtocol ever triggers a resume during init. + self._msg_queue_paused = False +@@ -365,6 +367,9 @@ class RequestHandler(BaseProtocol): + self._payload_parser.feed_data(self._message_tail) + self._message_tail = b"" + ++ if self._msg_queue_paused: ++ self._resume_msg_queue_reading() ++ + def eof_received(self) -> None: + pass + +@@ -393,21 +398,18 @@ class RequestHandler(BaseProtocol): + # don't set result twice + waiter.set_result(None) + +- # Queue full: pause the transport (the parser already stopped +- # emitting). start() resumes as it drains the queue. +- if ( +- not self._msg_queue_paused +- and len(self._messages) >= self._max_msg_queue_size +- ): +- self._pause_msg_queue_reading() +- + self._upgrade = upgraded + if upgraded and tail: + self._message_tail = tail + ++ if not self._msg_queue_paused and self._msg_queue_needs_pause(): ++ self._pause_msg_queue_reading() ++ + # no parser, just store + elif self._payload_parser is None and self._upgrade and data: + self._message_tail += data ++ if not self._msg_queue_paused and self._msg_queue_needs_pause(): ++ self._pause_msg_queue_reading() + + # feed payload + elif data: +@@ -418,6 +420,15 @@ class RequestHandler(BaseProtocol): + def _reading_paused_for_msg_queue(self) -> bool: + return self._msg_queue_paused + ++ def _msg_queue_needs_pause(self) -> bool: ++ # Leave reads paused until a queued parse error sends its 400 response. ++ if self._messages and isinstance(self._messages[-1][0], _ErrInfo): ++ return True ++ # An empty tail must allow reads to resume even with read_bufsize=0. ++ return len(self._messages) >= self._max_msg_queue_size or ( ++ bool(self._message_tail) and len(self._message_tail) >= self._read_bufsize ++ ) ++ + def _pause_msg_queue_reading(self) -> None: + self._msg_queue_paused = True + if self.transport is not None: +@@ -429,12 +440,15 @@ class RequestHandler(BaseProtocol): + pass + + def _resume_msg_queue_reading(self) -> None: ++ if self._msg_queue_needs_pause(): ++ return ++ + if not self._upgrade: + # Reparse buffered pipelined requests while still marked paused so + # a refill past the limit does not re-pause an already-paused + # transport; only resume below once it stayed under the limit. + self.data_received(b"") +- if len(self._messages) >= self._max_msg_queue_size: ++ if self._msg_queue_needs_pause(): + return + self._msg_queue_paused = False + if not self._reading_paused and self.transport is not None: +@@ -582,6 +596,7 @@ class RequestHandler(BaseProtocol): + self._request_parser.message_consumed() + if ( + self._msg_queue_paused ++ and not isinstance(message, _ErrInfo) + and len(self._messages) <= self._msg_queue_resume_size + ): + self._resume_msg_queue_reading() +@@ -655,24 +670,11 @@ class RequestHandler(BaseProtocol): + self._request_parser.set_upgraded(False) + self._upgrade = False + if self._message_tail: +- messages, upgraded, tail = self._request_parser.feed_data( +- self._message_tail +- ) +- # A further upgrade request in the tail buffers its own remainder. +- self._upgrade = upgraded +- self._message_tail = tail +- 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 ++ tail, self._message_tail = self._message_tail, b"" ++ # Reuse HTTP parsing, including its 400 error handling. ++ self.data_received(tail) ++ if self._msg_queue_paused: ++ self._resume_msg_queue_reading() + + set_exception(payload, PayloadAccessError()) + +diff --git a/tests/test_web_protocol.py b/tests/test_web_protocol.py +index 084b72edba0301dc17fc951f114b3751afae0934..fb0dfc92fcc6f0c854d4903fa01a2dba567082f1 100644 +--- a/tests/test_web_protocol.py ++++ b/tests/test_web_protocol.py +@@ -4,7 +4,11 @@ from unittest import mock + + import pytest + ++from aiohttp.http_exceptions import HttpProcessingError ++from aiohttp.http_parser import HttpRequestParser, HttpRequestParserPy ++from aiohttp.streams import StreamReader + from aiohttp.web_protocol import RequestHandler ++from aiohttp.web_response import Response, StreamResponse + from aiohttp.web_server import Server + + +@@ -141,6 +145,240 @@ def test_resume_msg_queue_reading_without_transport( + assert handler._msg_queue_paused is False + + ++def test_resume_msg_queue_reading_stays_paused_for_full_tail( ++ loop: asyncio.AbstractEventLoop, ++ dummy_manager: Server, ++) -> None: ++ """Resume is refused while an in-flight upgrade holds read_bufsize of tail. ++ ++ The tail is drained by set_parser() or declined-upgrade replay, so resuming before ++ then would let the buffer grow past its ceiling one read at a time. ++ """ ++ handler = RequestHandler(dummy_manager, loop=loop, read_bufsize=1024) ++ transport = mock.create_autospec(asyncio.Transport, spec_set=True, instance=True) ++ handler.transport = transport ++ handler._upgrade = True ++ handler._msg_queue_paused = True ++ handler._message_tail = b"x" * 1024 ++ ++ handler._resume_msg_queue_reading() ++ ++ assert handler._msg_queue_paused is True ++ transport.resume_reading.assert_not_called() ++ ++ ++def test_resume_msg_queue_reading_with_room_left_in_tail( ++ loop: asyncio.AbstractEventLoop, ++ dummy_manager: Server, ++) -> None: ++ """A tail under read_bufsize does not hold the transport paused.""" ++ handler = RequestHandler(dummy_manager, loop=loop, read_bufsize=1024) ++ transport = mock.create_autospec(asyncio.Transport, spec_set=True, instance=True) ++ handler.transport = transport ++ handler._upgrade = True ++ handler._msg_queue_paused = True ++ handler._message_tail = b"x" * 1023 ++ ++ handler._resume_msg_queue_reading() ++ ++ assert handler._msg_queue_paused is False ++ transport.resume_reading.assert_called_once_with() ++ ++ ++def test_resume_msg_queue_reading_with_zero_read_bufsize( ++ loop: asyncio.AbstractEventLoop, ++ dummy_manager: Server, ++) -> None: ++ """An empty tail resumes even when read_bufsize leaves it no room. ++ ++ Guards the degenerate ``read_bufsize=0`` case: comparing sizes alone would ++ match an empty tail and wedge the connection paused for good. ++ """ ++ handler = RequestHandler(dummy_manager, loop=loop, read_bufsize=0) ++ transport = mock.create_autospec(asyncio.Transport, spec_set=True, instance=True) ++ handler.transport = transport ++ handler._upgrade = True ++ handler._msg_queue_paused = True ++ ++ handler._resume_msg_queue_reading() ++ ++ assert handler._msg_queue_paused is False ++ transport.resume_reading.assert_called_once_with() ++ ++ ++def test_set_parser_resumes_reading_paused_for_tail( ++ loop: asyncio.AbstractEventLoop, ++ dummy_manager: Server, ++) -> None: ++ """Handing a full tail to the upgraded protocol resumes reading.""" ++ handler = RequestHandler(dummy_manager, loop=loop, read_bufsize=1024) ++ transport = mock.create_autospec(asyncio.Transport, spec_set=True, instance=True) ++ handler.transport = transport ++ handler._upgrade = True ++ handler._msg_queue_paused = True ++ handler._message_tail = b"x" * 1024 ++ ++ reader = mock.Mock() ++ handler.set_parser(reader) ++ ++ reader.feed_data.assert_called_once_with(b"x" * 1024) ++ assert handler._message_tail == b"" ++ assert handler._msg_queue_paused is False ++ transport.resume_reading.assert_called_once_with() ++ ++ ++@pytest.mark.parametrize( ++ "chunks", [(b"tail", b""), (b"ta", b"il")], ids=["parser-return", "later-read"] ++) ++def test_received_upgrade_tail_pauses_at_read_limit( ++ loop: asyncio.AbstractEventLoop, ++ dummy_manager: Server, ++ chunks: tuple[bytes, bytes], ++) -> None: ++ handler = RequestHandler(dummy_manager, loop=loop, read_bufsize=4) ++ transport = mock.Mock(spec=asyncio.Transport) ++ handler.transport = transport ++ parser = mock.Mock() ++ handler._request_parser = parser ++ initial, later = chunks ++ parser.feed_data.return_value = ((), True, initial) ++ ++ handler.data_received(b"event") ++ if later: ++ transport.pause_reading.assert_not_called() ++ handler.data_received(later) ++ ++ parser.feed_data.assert_called_once_with(b"event") ++ assert handler._message_tail == b"tail" ++ transport.pause_reading.assert_called_once_with() ++ ++ ++def test_refill_keeps_reads_paused_for_full_upgrade_tail( ++ loop: asyncio.AbstractEventLoop, ++ dummy_manager: Server, ++) -> None: ++ handler = RequestHandler(dummy_manager, loop=loop, read_bufsize=4) ++ transport = mock.Mock(spec=asyncio.Transport) ++ handler.transport = transport ++ handler._msg_queue_paused = True ++ parser = mock.Mock() ++ handler._request_parser = parser ++ parser.feed_data.return_value = ((), True, b"tail") ++ ++ handler._resume_msg_queue_reading() ++ ++ parser.feed_data.assert_called_once_with(b"") ++ assert handler._message_tail == b"tail" ++ assert handler._msg_queue_paused ++ transport.resume_reading.assert_not_called() ++ ++ ++@pytest.mark.parametrize("replay_fails", [False, True]) ++@pytest.mark.parametrize( ++ "request_parser_cls", ++ tuple(dict.fromkeys((HttpRequestParserPy, HttpRequestParser))), ++ ids=lambda parser_cls: "python" if parser_cls is HttpRequestParserPy else "c", ++) ++async def test_declined_upgrade_replays_after_body_drains( ++ loop: asyncio.AbstractEventLoop, ++ dummy_manager: Server, ++ replay_fails: bool, ++ request_parser_cls: type[HttpRequestParser], ++ monkeypatch: pytest.MonkeyPatch, ++) -> None: ++ events: list[str] = [] ++ ++ async def respond(_request: object) -> Response: ++ return Response() ++ ++ dummy_manager.request_handler = respond ++ dummy_manager.requests_count = 0 ++ request = mock.Mock() ++ request.writer.output_size = 0 ++ dummy_manager.request_factory.return_value = request ++ handler = RequestHandler(dummy_manager, loop=loop, read_bufsize=4) ++ transport = mock.Mock(spec=asyncio.Transport) ++ handler.transport = transport ++ http_parser = request_parser_cls(handler, loop, 2**16) ++ parser = mock.Mock(wraps=http_parser) ++ handler._request_parser = parser ++ headers = ( ++ b"POST /submit HTTP/1.1\r\n" ++ b"Host: example.test\r\n" ++ b"Content-Length: 4\r\n\r\n" ++ ) ++ messages, upgraded, tail = http_parser.feed_data(headers) ++ [(message, body)] = messages ++ assert message.method == "POST" ++ assert not upgraded and not tail and not body.is_eof() ++ ++ readany = StreamReader.readany ++ ++ async def drain(payload: StreamReader) -> bytes: ++ assert payload is body ++ assert not body.is_eof() ++ # Supply the remaining bytes of the ordinary HTTP body when the ++ # protocol starts draining it. ++ messages, upgraded, tail = http_parser.feed_data(b"body") ++ assert not messages and not upgraded and not tail ++ data = await readany(payload) ++ assert data == b"body" ++ events.append("drain") ++ return data ++ ++ monkeypatch.setattr(StreamReader, "readany", drain) ++ ++ def receive(data: bytes) -> tuple[tuple[tuple[object, object], ...], bool, bytes]: ++ if data == b"event": ++ # Seed the upgrade state separately from the real HTTP parsing. ++ return ((message, body),), True, b"tail" ++ if data == b"tail": ++ events.append("replay") ++ assert body.at_eof() ++ if replay_fails: ++ raise HttpProcessingError(message="mock failure") ++ messages, upgraded, tail = http_parser.feed_data( ++ b"GET /next HTTP/1.1\r\nHost: example.test\r\n\r\n" ++ ) ++ [(next_message, next_body)] = messages ++ assert next_message.path == "/next" ++ assert not upgraded and not tail and next_body.at_eof() ++ return tuple(messages), upgraded, tail ++ assert data == b"" ++ return (), False, b"" ++ ++ parser.feed_data.side_effect = receive ++ handler.data_received(b"event") ++ ++ async def finish( ++ _handler: RequestHandler, ++ _request: object, ++ response: StreamResponse, ++ _start: float, ++ ) -> bool: ++ response._keep_alive = not events ++ events.append(f"status {response.status}") ++ return False ++ ++ with mock.patch.object(RequestHandler, "finish_response", new=finish): ++ task = handler._task_handler = loop.create_task(handler.start()) ++ try: ++ await asyncio.wait_for(task, timeout=2) ++ finally: ++ if handler._keepalive_handle is not None: ++ handler._keepalive_handle.cancel() ++ ++ assert not handler._messages ++ transport.pause_reading.assert_called_once_with() ++ parser.set_upgraded.assert_called_once_with(False) ++ expected_status = 400 if replay_fails else 200 ++ assert events == ["status 200", "drain", "replay", f"status {expected_status}"] ++ if replay_fails: ++ transport.resume_reading.assert_not_called() ++ else: ++ transport.resume_reading.assert_called_once_with() ++ ++ + def test_resume_reading_stays_paused_for_msg_queue( + loop: asyncio.AbstractEventLoop, + dummy_manager: Server, +diff --git a/tests/test_web_upgrade_integration.py b/tests/test_web_upgrade_integration.py +new file mode 100644 +index 0000000000000000000000000000000000000000..7a4798a05c2fc23bb841edcab752a8459e8166f6 +--- /dev/null ++++ b/tests/test_web_upgrade_integration.py +@@ -0,0 +1,236 @@ ++from asyncio import Event, Transport, open_connection, wait_for ++from base64 import b64encode ++from typing import List, Optional ++ ++import pytest ++ ++from aiohttp import ClientTimeout, hdrs, web, web_protocol ++from aiohttp.http_parser import HttpRequestParser, HttpRequestParserPy ++from aiohttp.pytest_plugin import AiohttpClient, AiohttpServer ++ ++ ++@pytest.mark.parametrize("framing", ["empty", "content-length", "chunked"]) ++async def test_declined_websocket_upgrade_keeps_http_connection( ++ aiohttp_client: AiohttpClient, framing: str, ++) -> None: ++ transports: List[Optional[Transport]] = [] ++ upgrade_pending_at_prepare: List[bool] = [] ++ body = b"example body" if framing != "empty" else b"" ++ ++ async def decline(request: web.Request) -> web.Response: ++ transports.append(request.transport) ++ assert await request.read() == body ++ if framing == "content-length": ++ assert request.content_length == len(body) ++ elif framing == "chunked": ++ assert request.headers[hdrs.TRANSFER_ENCODING] == "chunked" ++ return web.Response(text="upgrade declined") ++ ++ async def normal(request: web.Request) -> web.Response: ++ transports.append(request.transport) ++ return web.Response(text="http response") ++ ++ async def record_upgrade_state( ++ request: web.Request, response: web.StreamResponse ++ ) -> None: ++ if request.path == "/upgrade": ++ upgrade_pending_at_prepare.append(request.protocol._upgrade) ++ ++ app = web.Application() ++ app.router.add_get("/upgrade", decline) ++ app.router.add_get("/", normal) ++ app.on_response_prepare.append(record_upgrade_state) ++ client = await aiohttp_client(app, timeout=ClientTimeout(total=5)) ++ ++ headers = { ++ hdrs.CONNECTION: "Upgrade", ++ hdrs.UPGRADE: "websocket", ++ hdrs.SEC_WEBSOCKET_KEY: b64encode(b"test upgrade key").decode("ascii"), ++ hdrs.SEC_WEBSOCKET_VERSION: "13", ++ } ++ async with client.get( ++ "/upgrade", ++ headers=headers, ++ data=body or None, ++ chunked=True if framing == "chunked" else None, ++ ) as response: ++ assert response.status == 200 ++ assert await response.text() == "upgrade declined" ++ ++ assert upgrade_pending_at_prepare == [True] ++ ++ async with client.get("/") as response: ++ assert response.status == 200 ++ assert await response.text() == "http response" ++ ++ assert len(transports) == 2 ++ assert transports[0] is not None ++ assert transports[0] is transports[1] ++ ++ ++async def test_accepted_websocket_upgrade_delivers_message( ++ aiohttp_client: AiohttpClient, ++) -> None: ++ async def upgrade(request: web.Request) -> web.WebSocketResponse: ++ websocket = web.WebSocketResponse() ++ await websocket.prepare(request) ++ await websocket.send_str("ready") ++ return websocket ++ ++ app = web.Application() ++ app.router.add_get("/upgrade", upgrade) ++ client = await aiohttp_client(app, timeout=ClientTimeout(total=5)) ++ ++ async with client.ws_connect("/upgrade") as websocket: ++ assert await websocket.receive_str(timeout=5) == "ready" ++ ++ ++@pytest.mark.parametrize( ++ "parser_class", ++ tuple(dict.fromkeys((HttpRequestParserPy, HttpRequestParser))), ++ ids=lambda cls: "python" if cls is HttpRequestParserPy else "c", ++) ++@pytest.mark.parametrize("chunked", [False, True], ids=["content-length", "chunked"]) ++@pytest.mark.parametrize("fragmented", [False, True], ids=["combined", "split-body"]) ++@pytest.mark.parametrize("read_body", [False, True], ids=["unread-body", "read-body"]) ++async def test_body_upgrade_and_pipelined_request_on_loopback( ++ aiohttp_server: AiohttpServer, ++ monkeypatch: pytest.MonkeyPatch, ++ parser_class, ++ chunked: bool, ++ fragmented: bool, ++ read_body: bool, ++) -> None: ++ monkeypatch.setattr(web_protocol, "HttpRequestParser", parser_class) ++ body = b"request-body\r\n" ++ started = Event() ++ following_request = Event() ++ requests: List[web.Request] = [] ++ ++ async def decline(request: web.Request) -> web.Response: ++ assert request.headers[hdrs.UPGRADE] == "websocket" ++ assert isinstance(request.protocol._request_parser, parser_class) ++ requests.append(request) ++ started.set() ++ if read_body: ++ assert await request.read() == body ++ return web.Response(body=b"declined") ++ ++ async def next_request(request: web.Request) -> web.Response: ++ assert len(requests) == 1 ++ assert request.transport is requests[0].transport ++ assert requests[0].content.is_eof() ++ requests.append(request) ++ following_request.set() ++ return web.Response(body=b"next response") ++ ++ app = web.Application() ++ app.router.add_get("/upgrade", decline) ++ app.router.add_get("/next", next_request) ++ server = await aiohttp_server(app, read_bufsize=32) ++ reader, writer = await open_connection(server.host, server.port) ++ if chunked: ++ framing = b"Transfer-Encoding: chunked\r\n" ++ wire_body = b"%x\r\n%s\r\n0\r\n\r\n" % (len(body), body) ++ else: ++ framing = b"Content-Length: %d\r\n" % len(body) ++ wire_body = body ++ headers = ( ++ b"GET /upgrade HTTP/1.1\r\n" ++ b"Host: localhost\r\n" ++ b"Connection: Upgrade\r\n" ++ b"Upgrade: websocket\r\n" ++ b"Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" ++ b"Sec-WebSocket-Version: 13\r\n" ++ + framing ++ + b"\r\n" ++ ) ++ tail = b"GET /next HTTP/1.1\r\nHost: localhost\r\n\r\n" ++ ++ async def read_response(expected: bytes) -> None: ++ response_headers = await reader.readuntil(b"\r\n\r\n") ++ assert response_headers.startswith(b"HTTP/1.1 200 ") ++ assert b"content-length: " + str(len(expected)).encode() in response_headers.lower() ++ assert await reader.readexactly(len(expected)) == expected ++ ++ async def exchange() -> None: ++ if fragmented: ++ writer.write(headers + wire_body[:-1]) ++ await writer.drain() ++ await started.wait() ++ assert not requests[0].content.is_eof() ++ assert not following_request.is_set() ++ writer.write(wire_body[-1:] + tail) ++ else: ++ writer.write(headers + wire_body + tail) ++ await writer.drain() ++ await read_response(b"declined") ++ await read_response(b"next response") ++ assert following_request.is_set() ++ assert [request.path for request in requests] == ["/upgrade", "/next"] ++ ++ try: ++ await wait_for(exchange(), timeout=5) ++ finally: ++ writer.close() ++ await writer.wait_closed() ++ ++ ++async def test_injected_upgrade_tail_replays_and_resumes_reads( ++ aiohttp_server: AiohttpServer, ++) -> None: ++ tail = b"GET /replay HTTP/1.1\r\nHost: localhost\r\n\r\n" ++ transports: List[Transport] = [] ++ ++ async def seed_pending_state(request: web.Request) -> web.Response: ++ transport = request.transport ++ assert transport is not None ++ transports.append(transport) ++ protocol = request.protocol ++ assert transport.is_reading() ++ assert protocol._message_tail == b"" ++ ++ # Seed the pending flag after the ordinary GET reached its handler. ++ # Pass a complete request to the receive callback without a socket send. ++ protocol._upgrade = True ++ protocol.data_received(tail) ++ assert protocol._message_tail == tail ++ assert not transport.is_reading() ++ return web.Response(body=b"first") ++ ++ async def replay(request: web.Request) -> web.Response: ++ assert request.transport is transports[0] ++ assert transports[0].is_reading() ++ assert not request.protocol._message_tail ++ return web.Response(body=b"replayed") ++ ++ async def normal(request: web.Request) -> web.Response: ++ assert request.transport is transports[0] ++ return web.Response(body=b"normal") ++ ++ app = web.Application() ++ app.router.add_get("/seed", seed_pending_state) ++ app.router.add_get("/replay", replay) ++ app.router.add_get("/", normal) ++ server = await aiohttp_server(app, read_bufsize=len(tail)) ++ reader, writer = await open_connection(server.host, server.port) ++ ++ async def read_response(body: bytes) -> None: ++ headers = await reader.readuntil(b"\r\n\r\n") ++ assert headers.startswith(b"HTTP/1.1 200 ") ++ assert await reader.readexactly(len(body)) == body ++ ++ async def exchange() -> None: ++ writer.write(b"GET /seed HTTP/1.1\r\nHost: localhost\r\n\r\n") ++ await writer.drain() ++ await read_response(b"first") ++ await read_response(b"replayed") ++ writer.write(b"GET / HTTP/1.1\r\nHost: localhost\r\n\r\n") ++ await writer.drain() ++ await read_response(b"normal") ++ ++ try: ++ await wait_for(exchange(), timeout=5) ++ finally: ++ writer.close() ++ await writer.wait_closed() diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69243_p1.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69243_p1.patch new file mode 100644 index 0000000..9e3ddb7 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69243_p1.patch @@ -0,0 +1,300 @@ +From 6ae358f0983c3f4d6f67692b2f8e65dc8e091c98 Mon Sep 17 00:00:00 2001 +From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> +Date: Tue, 30 Jun 2026 20:21:57 +0100 +Subject: [PATCH] [PR #13016/8ef76ab8 backport][3.14] Fix body reads after + failed WS upgrade (#13017) + +**This is a backport of PR #13016 as merged into master +(8ef76ab8029d0f2d88449fe115feb42ded646c7c).** + +CVE: CVE-2026-69243 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/6ae358f0983c3f4d6f67692b2f8e65dc8e091c98] + +Backport Changes: +- Adapt the headers callback to 3.9.5's immediate-upgrade path while + retaining llhttp's no-body response result from the upstream fix. +- Let a pending upgrade reach llhttp's own pause even at the queue + limit. The 3.9.5 queue callback would otherwise pause it first. +- Use the older boolean payload completion path in the Python parser. +- Use the 3.9.5 fixtures for the empty-body and upstream framed-body + parser tests. Add fragmented Content-Length and chunked upgrade + cases that keep HTTP parsing active until the body is complete + and return only the following bytes as the upgraded tail. +- Place raw HTTP regressions in the shared follow-up to cover + body framing, replay and connection reuse together. + +Co-authored-by: Sam Bull +Signed-off-by: Darsh Kelaiya +--- + CHANGES/13016.bugfix.rst | 1 + aiohttp/_http_parser.pyx | 29 +++++++++---- + aiohttp/http_parser.py | 22 ++++++++-- + tests/test_http_parser.py | 99 +++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 136 insertions(+), 15 deletions(-) + create mode 100644 CHANGES/13016.bugfix.rst + +diff --git a/CHANGES/13016.bugfix.rst b/CHANGES/13016.bugfix.rst +new file mode 100644 +index 000000000..a984f64e3 +--- /dev/null ++++ b/CHANGES/13016.bugfix.rst +@@ -0,0 +1 @@ ++Fixed request body not being read on rejected WebSocket upgrades -- by :user:`Dreamsorcerer`. +diff --git a/aiohttp/_http_parser.pyx b/aiohttp/_http_parser.pyx +index a5309a4cd..6f5975b78 100644 +--- a/aiohttp/_http_parser.pyx ++++ b/aiohttp/_http_parser.pyx +@@ -318,6 +318,7 @@ cdef class HttpParser: + set _seen_singletons + list _raw_headers + bint _upgraded ++ bint _pending_upgrade + list _messages + bytes _tail + Py_ssize_t _msg_in_flight +@@ -387,6 +388,7 @@ cdef class HttpParser: + self._response_with_body = response_with_body + self._read_until_eof = read_until_eof + self._upgraded = False ++ self._pending_upgrade = False + self._auto_decompress = auto_decompress + self._content_encoding = None + self._lax = False +@@ -474,10 +476,15 @@ cdef class HttpParser: + 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 ++ # https://www.rfc-editor.org/info/rfc9110/#section-7.8-15 ++ # Defer the protocol switch until the complete request has been ++ # received. ++ self._pending_upgrade = True + else: + if upgrade and self._cparser.status_code == 101: +- self._upgraded = True ++ # llhttp pauses for a 101 on its own; just mark the pending ++ # switch so feed_data returns the upgraded-protocol tail. ++ self._pending_upgrade = True + + # do not support old websocket spec + if SEC_WEBSOCKET_KEY1 in headers: +@@ -606,6 +613,10 @@ cdef class HttpParser: + cparser.llhttp_resume_after_upgrade(self._cparser) + + nb = cparser.llhttp_get_error_pos(self._cparser) - base ++ if self._pending_upgrade: ++ # A supported upgrade whose request body has now been fully read. ++ self._upgraded = True ++ self._pending_upgrade = False + elif errno is cparser.HPE_PAUSED: + cparser.llhttp_resume(self._cparser) + pos = cparser.llhttp_get_error_pos(self._cparser) - base +@@ -852,13 +863,9 @@ cdef int cb_on_headers_complete(cparser.llhttp_t* parser) except -1: + pyparser._last_error = exc + return -1 + else: +- if ( +- pyparser._cparser.upgrade or +- pyparser._cparser.method == cparser.HTTP_CONNECT +- ): +- return 2 +- else: +- return 0 ++ if not pyparser._response_with_body: ++ return 1 ++ return 0 + + + cdef int cb_on_body(cparser.llhttp_t* parser, +@@ -891,10 +898,12 @@ cdef int cb_on_message_complete(cparser.llhttp_t* parser) except -1: + else: + if pyparser._max_msg_queue_size: + pyparser._msg_in_flight += 1 +- if pyparser._msg_in_flight >= pyparser._max_msg_queue_size: ++ if (pyparser._msg_in_flight >= pyparser._max_msg_queue_size ++ and not pyparser._pending_upgrade): + # Queue full: pause llhttp between messages. feed_data() buffers + # the remainder as tail; resumes once the queue drains. + return cparser.HPE_PAUSED ++ # A pending upgrade stops at llhttp's protocol pause instead. + return 0 + + +diff --git a/aiohttp/http_parser.py b/aiohttp/http_parser.py +index f306cf308..618daed04 100644 +--- a/aiohttp/http_parser.py ++++ b/aiohttp/http_parser.py +@@ -300,6 +300,7 @@ class HttpParser(abc.ABC, Generic[_MsgT]): + self._lines: List[bytes] = [] + self._tail = b"" + self._upgraded = False ++ self._pending_upgrade = False + self._payload = None + self._payload_parser: Optional[HttpPayloadParser] = None + self._auto_decompress = auto_decompress +@@ -422,9 +423,7 @@ class HttpParser(abc.ABC, Generic[_MsgT]): + if SEC_WEBSOCKET_KEY1 in msg.headers: + raise InvalidHeader(SEC_WEBSOCKET_KEY1) + +- self._upgraded = msg.upgrade and _is_supported_upgrade( +- msg.headers +- ) ++ upgraded = msg.upgrade and _is_supported_upgrade(msg.headers) + + method = getattr(msg, "method", self.method) + # code is only present on responses +@@ -440,8 +439,7 @@ class HttpParser(abc.ABC, Generic[_MsgT]): + self.method and method_must_be_empty_body(self.method) + ) + if not empty_body and ( +- ((length is not None and length > 0) or msg.chunked) +- and not self._upgraded ++ (length is not None and length > 0) or msg.chunked + ): + payload = StreamReader( + self.protocol, +@@ -467,6 +465,10 @@ class HttpParser(abc.ABC, Generic[_MsgT]): + ) + if not payload_parser.done: + self._payload_parser = payload_parser ++ # https://www.rfc-editor.org/info/rfc9110/#section-7.8-15 ++ # Defer any requested upgrade until the ++ # complete request has been read. ++ self._pending_upgrade = upgraded + elif method == METH_CONNECT: + assert isinstance(msg, RawRequestMessage) + payload = StreamReader( +@@ -513,6 +515,11 @@ class HttpParser(abc.ABC, Generic[_MsgT]): + ) + if not payload_parser.done: + self._payload_parser = payload_parser ++ elif upgraded: ++ # No body to read, so the connection switches to ++ # the upgraded protocol immediately. ++ self._upgraded = True ++ payload = EMPTY_PAYLOAD + else: + payload = EMPTY_PAYLOAD + +@@ -559,6 +566,11 @@ class HttpParser(abc.ABC, Generic[_MsgT]): + start_pos = 0 + data_len = len(data) + self._payload_parser = None ++ if self._pending_upgrade: ++ # Body fully read: the deferred upgrade takes effect and ++ # the rest of the connection is the upgraded protocol. ++ self._upgraded = True ++ self._pending_upgrade = False + continue + else: + break +diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py +index 500dd4c17603000b12645d1c80760a2b6b7630e7..cae4206c68819943e5156174c19bbdfec3805cb1 100644 +--- a/tests/test_http_parser.py ++++ b/tests/test_http_parser.py +@@ -777,6 +777,105 @@ def test_conn_upgrade(parser: Any) -> None: + assert upgrade + + ++def test_empty_websocket_upgrade_with_content_length( ++ parser: HttpRequestParser, ++) -> None: ++ request = ( ++ b"GET /ws HTTP/1.1\r\n" ++ b"Host: example.test\r\n" ++ b"Connection: Upgrade\r\n" ++ b"Upgrade: websocket\r\n" ++ b"Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" ++ b"Sec-WebSocket-Version: 13\r\n" ++ b"Content-Length: 0\r\n\r\n" ++ ) ++ messages, upgraded, tail = parser.feed_data(request) ++ ++ [(message, payload)] = messages ++ assert message.upgrade ++ assert upgraded ++ assert payload.at_eof() ++ assert tail == b"" ++ ++ ++@pytest.mark.parametrize("chunked", (False, True), ids=("content-length", "chunked")) ++async def test_http_request_upgrade_with_body_read( ++ parser: HttpRequestParser, chunked: bool ++) -> None: ++ body_request = b"foobarbaz\r\n\r\n" ++ if chunked: ++ framing = b"Transfer-Encoding: chunked\r\n" ++ body = b"%x\r\n%s\r\n0\r\n\r\n" % (len(body_request), body_request) ++ else: ++ framing = b"Content-Length: %d\r\n" % len(body_request) ++ body = body_request ++ after = b"GET /after HTTP/1.1\r\nHost: a\r\n\r\n" ++ text = ( ++ b"GET /ws HTTP/1.1\r\nHost: a\r\n" ++ b"Connection: Upgrade\r\nUpgrade: websocket\r\n" ++ + framing ++ + b"\r\n" ++ + body ++ + after ++ ) ++ messages, upgrade, tail = parser.feed_data(text) ++ assert len(messages) == 1 ++ msg, payload = messages[0] ++ assert msg.method == "GET" ++ assert msg.path == "/ws" ++ assert msg.upgrade ++ assert await payload.read() == body_request ++ # The connection switches protocols only after the body is fully read. ++ assert upgrade ++ assert tail == after ++ ++ ++@pytest.mark.parametrize("chunked", (False, True), ids=("content-length", "chunked")) ++async def test_http_request_upgrade_waits_for_complete_body( ++ parser: HttpRequestParser, chunked: bool ++) -> None: ++ payload_bytes = b"payload" ++ if chunked: ++ framing = b"Transfer-Encoding: chunked\r\n" ++ body = b"7\r\npayload\r\n0\r\n\r\n" ++ else: ++ framing = b"Content-Length: 7\r\n" ++ body = payload_bytes ++ headers = ( ++ b"GET /ws HTTP/1.1\r\n" ++ b"Host: example.test\r\n" ++ b"Connection: Upgrade\r\n" ++ b"Upgrade: websocket\r\n" ++ + framing ++ + b"\r\n" ++ ) ++ after = b"GET /after HTTP/1.1\r\nHost: example.test\r\n\r\n" ++ messages, upgraded, tail = parser.feed_data(headers) ++ ++ [(message, payload)] = messages ++ assert message.upgrade ++ assert not upgraded ++ assert tail == b"" ++ assert not payload.is_eof() ++ ++ # Keep the upgrade pending across every incomplete body boundary. ++ for offset in range(len(body) - 1): ++ messages, upgraded, tail = parser.feed_data(body[offset : offset + 1]) ++ assert not messages ++ assert not upgraded ++ assert tail == b"" ++ assert not payload.is_eof() ++ ++ messages, upgraded, tail = parser.feed_data(body[-1:] + after) ++ ++ assert not messages ++ assert upgraded ++ assert tail == after ++ assert payload.is_eof() ++ assert await payload.read() == payload_bytes ++ assert payload.at_eof() ++ ++ + def test_bad_upgrade(parser) -> None: + """Test not upgraded if missing Upgrade header.""" + text = b"GET /test HTTP/1.1\r\nconnection: upgrade\r\n\r\n" diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69243_p2.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69243_p2.patch new file mode 100644 index 0000000..965d67f --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69243_p2.patch @@ -0,0 +1,93 @@ +From 716c83d2b697e56fd74f95a1aa3a451fd2fb02e8 Mon Sep 17 00:00:00 2001 +From: Sam Bull +Date: Mon, 17 Aug 2026 23:56:36 +0100 +Subject: [PATCH] Fix pipelining a rejected upgrade (#13468) (#13472) + +CVE: CVE-2026-69243 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/716c83d2b697e56fd74f95a1aa3a451fd2fb02e8] + +Backport Changes: +- Use Scarthgap's _request_parser and _upgrade attributes. +- Handle the declined upgrade in start() after the request body is + drained, so a response sent earlier cannot leave a deferred upgrade + stuck waiting for tail replay. +- Omit the raw HTTP functional tests. Cover replay and flow control + with mocked parser and transport tests in p3. + +(cherry picked from commit 066026095fc8a44276eb6485c0e97f6642a25bbd) +Signed-off-by: Darsh Kelaiya +--- + aiohttp/web_protocol.py | 53 +++++++++++++++++++++++++---------------- + 1 file changed, 33 insertions(+), 20 deletions(-) + +diff --git a/aiohttp/web_protocol.py b/aiohttp/web_protocol.py +index 39a1b6850..996952b31 100644 +--- a/aiohttp/web_protocol.py ++++ b/aiohttp/web_protocol.py +@@ -639,6 +639,39 @@ class RequestHandler(BaseProtocol): + self.log_debug("Uncompleted request.") + self.close() + ++ # Handle feeding the message tail following an upgrade request that ++ # was declined. ++ # The upgrade request is the last request before the parser paused, ++ # so wait for self._messages to be empty. ++ # payload_parser is not None if the upgrade was accepted. ++ if ( ++ self._upgrade ++ and not self._messages ++ and self._payload_parser is None ++ and self._request_parser is not None ++ ): ++ self._request_parser.set_upgraded(False) ++ self._upgrade = False ++ if self._message_tail: ++ messages, upgraded, tail = self._request_parser.feed_data( ++ self._message_tail ++ ) ++ # A further upgrade request in the tail buffers its own remainder. ++ self._upgrade = upgraded ++ self._message_tail = tail ++ 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 ++ + set_exception(payload, PayloadAccessError()) + + except asyncio.CancelledError: +@@ -683,26 +716,6 @@ class RequestHandler(BaseProtocol): + can get exception information. Returns True if the client disconnects + prematurely. + """ +- if self._request_parser is not None: +- self._request_parser.set_upgraded(False) +- self._upgrade = False +- if self._message_tail: +- messages, _upgraded, tail = self._request_parser.feed_data( +- self._message_tail +- ) +- self._message_tail = tail +- 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 + try: + prepare_meth = resp.prepare + except AttributeError: diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb index f86a594..bbd7b27 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb @@ -46,6 +46,9 @@ SRC_URI += "file://CVE-2024-52304.patch \ file://CVE-2026-111064.patch \ file://CVE-2026-111063_p1.patch \ file://CVE-2026-111063_p2.patch \ + file://CVE-2026-69243_p1.patch \ + file://CVE-2026-69243_p2.patch \ + file://CVE-2026-69243_CVE-2026-128129.patch \ " CVE_STATUS[CVE-2026-34515] = "not-applicable-platform: Vulnerability only affects applications running on Windows" From patchwork Wed Nov 25 05:18:11 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: 105517 Received: from aer-iport-7.cisco.com (aer-iport-7.cisco.com [173.38.203.69]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.36178.1795583898954195692 for ; Tue, 24 Nov 2026 21:18:20 -0800 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=fyefa2r7; spf=pass (domain: cisco.com, ip: 173.38.203.69, mailfrom: dkelaiya@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=11136; q=dns/txt; s=iport01; t=1795583900; x=1796793500; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mZ5Bbs5TCLcTdpP1qvpBfYvaNYf5Q2Nmsv+LukLXnUk=; b=fyefa2r7MevRWmKeP1WRxK/j+OUCbxMT59lyQDE/YdrL/+1ELN7QvAF7 uHGBp8hu6OrwRXU71FudU0KC0pkSI+UA35yZIkojMFDEizzOCDJY6EmVn rzd/kztjawmDf9elJ52oU2RyJKMaul43PdCDOHoCBMFb+ID+mPyGRuiPu 4X0hevj9IBbQxcBxM4zekvitTPDQwUpfocIWmD/f1LhizFctqA7HcddxO uR/bs9jxQ+nmGWIXgrK3aABeFFplHNrTho+YIQts1Ror0wNMAOtgvSxeO 2B32PW3eghSPsLhAyUQ67oh/yak7y3CKoEoSmgWDtrw4nVJrgEnh08zRX g==; X-CSE-ConnectionGUID: Wo5OWuQ6QeKEyNlbV5yB3w== X-CSE-MsgGUID: 2DmSxtqVTBCLt25hzdwYIw== X-IPAS-Result: A0BJAgAhbQZr/89K/pBaHgEBCxIMggULgld1YENJA5ZIA4ETnRaBfg8BAQEPRA0EAQGEP0YCjiICJjQJDgECBAMCAwEBAQEBAQEBAQEBAQoBAQUBAQECAQcFgQ4Thk8NkBIBAgEDJwsBGAEtEBwDAQIvKyMIGYMCAYJ0AxG6A4F5M4EBgykBMQWBHtszAQsUAYE4hUKIJV0YAYR+JxsbgXKBFYE7gTl2gQWBXAKBOBmGVQSCDRWBDIFUgQIJgheJcQKBSYhSSIEeA1ksAVUTDQoLBwWBaAM1EioVbjIdgSM7F4EHGwYFgRyBHoESgQNdgSsoXQEhgQiBdQKCUYIAAgFJQQ4HRVMJJUMSRyQiCBIJARMaLAqBGjU8CSY/FQxnCxoFYQgCDQx0ORAwHCQvBRkmPBsKgQwnHR4ZDgIpBhYhCzQYDUgRLDcVGQQ+bgeUE4MbATw+EwEqAReBNjgDJA8HBgYYklokOQyReIE1n1wKKIN5jCSVOhozqnILmH2OCpVhCGiEaoFoPIFZcBU7gmcJShkPjisOC4NgzlsmMgIJAy8BAQcCBw4DC4FokAEBJoFWAQE IronPort-Data: A9a23:KxStvK3Tb/OeJmM6HfbD5YRwkn2cJEfYwER7XKvMYLTBsI5bpz0Hy WVOXDiGOveOMWv2KdB3b4q+9x4C65fWx99gGwNv3Hw8FHgiRegpqji6wuYcGwvIc6UvmWo+t 512huHodZ5yEzmE4Ef3b9ANlFEkvYmQXL3wFeXYDS54QA5gWU8JhAlq8wIDqtYAbeORXUXX5 rsen+WFYAX7gmcubzpNg06+gEoHUMra6WtwUmMWPZinjHeG/1EJAZQWI72GLneQauF8Au6gS u/f+6qy92Xf8g1FIovNfmHTKxBirhb6ZGBiu1IOM0SQqkEqSh8ajs7XAMEhhXJ/0F1lqTzeJ OJl7vRcQS9xVkHFdX90vxNwS0mSNoUekFPLzOTWXcG7lyX7n3XQL/pGM0ZrGrIFw7hODEJj5 NocIg5QfzrYmLfjqF67YrEEasULJcTxeYdasXZ6wHSBU7AtQIvIROPB4towMDUY35wSW6yDO 4xGNXw1NEuojx5nYj/7DLoyn+qsj3juehVTqUmeouw85G27IAlZjuOzaoeNJIPiqcN9xGqdn XLa5lrFKDo+KIbCySiJ7UONmbqa9c/8cMdIfFGizdZtmFCVy2kZBREaWFf+rfSnh0qWX9NEN 1dS/TIjq6U3/kGnQtTxGRqirxa5UgU0UtdKVul/4waXx++MvUCSB3MPSXhKb9lOWNIKeAHGH 2Shx7vBbQGDepXPIZ5B3t94dQ+PBBU= IronPort-HdrOrdr: A9a23:fX9f2auso/S/P0NPO4adS7Pz7skDVNV00zEX/kB9WHVpmwKj+P xG+85rsiMc5wxxZJhNo7290ey7MBHhHP1OkO0s1MmZPDUO0VHAROoJ0WKh+UyEJ8SUzIBgPM lbH5SWcOeAbmRSvILd/BSyFcomzZ2s9aClgvqb8lJWJDsaDZ2JK2xCe36m+oocfng+OaYE X-Talos-CUID: 9a23:aGwEkmP9Qggwt+5DZy4603EJI54cf17w3VHUKXHlGEwyV+jA X-Talos-MUID: 9a23:awQIIgYFaBNBmeBT7RPpvyF+LflUyY+KFBpQkYcKpPilKnkl X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,232,1787011200"; d="scan'208";a="63625067" Received: from aer-l-core-06.cisco.com ([144.254.74.207]) by aer-iport-7.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 25 Nov 2026 05:18:16 +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 aer-l-core-06.cisco.com (Postfix) with ESMTPS id 67CF4180001F4; Wed, 25 Nov 2026 05:18:16 +0000 (GMT) Received: by sjc-ads-5675.cisco.com (Postfix, from userid 1887444) id 9E162CBEFAB; Tue, 24 Nov 2026 21:18:13 -0800 (PST) From: "Darsh Kelaiya -X (dkelaiya - E INFOCHIPS PRIVATE LIMITED at Cisco)" To: openembedded-devel@lists.openembedded.org Cc: Darsh Kelaiya Subject: [oe][meta-python][scarthgap][PATCH 9/9] python3-aiohttp: fix CVE-2026-69244 Date: Tue, 24 Nov 2026 21:18:11 -0800 Message-Id: <20261125051811.2524271-10-dkelaiya@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261125051811.2524271-1-dkelaiya@cisco.com> References: <20261125051811.2524271-1-dkelaiya@cisco.com> MIME-Version: 1.0 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: aer-l-core-06.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 25 Nov 2026 05:18:30 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132970 From: Darsh Kelaiya Backport the bounded parser diagnostic fix [1] to aiohttp 3.9.5, as identified by [2]. Build error snippets from bounded slices of the current input buffer. The recipe regenerates the C parser from the patched Cython source during configuration. [1] https://github.com/aio-libs/aiohttp/commit/49f65d54150397892f7bcc4aae887767d51c322d [2] https://github.com/aio-libs/aiohttp/security/advisories/GHSA-cq5v-8q36-5273 Signed-off-by: Darsh Kelaiya --- .../python3-aiohttp/CVE-2026-69244.patch | 248 ++++++++++++++++++ .../python/python3-aiohttp_3.9.5.bb | 1 + 2 files changed, 249 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69244.patch diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69244.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69244.patch new file mode 100644 index 0000000..73dfafa --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2026-69244.patch @@ -0,0 +1,248 @@ +From 49f65d54150397892f7bcc4aae887767d51c322d Mon Sep 17 00:00:00 2001 +From: "J. Nick Koston" +Date: Wed, 22 Jul 2026 11:14:50 -1000 +Subject: [PATCH] [PR #13222/f4866933 backport][3.14] Build C parser error + message from bounded buffer slice (#13223) + +CVE: CVE-2026-69244 +Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/49f65d54150397892f7bcc4aae887767d51c322d] + +Backport Changes: +- Keep the bounded slice and caret in a private Cython helper so the + diagnostic can be tested with ordinary byte strings. +- Adapt upstream malformed-input tests to a fresh C parser with an + invalid status code and check the rejected line in its diagnostic. + Check empty, start, middle-line and end-of-buffer offsets in the + private helper. +- Exercise the compiled parser with a valid response and verify its + header-limit exception on the same response under a lower limit. + This covers the header callback error path. +- Force a native llhttp error on a valid response in a Linux child + process to exercise the bounded fallback diagnostic. Pin the child + import to the same compiled parser loaded by the parent. + +Signed-off-by: Darsh Kelaiya +--- + CHANGES/13222.bugfix.rst | 1 + aiohttp/_http_parser.pyx | 17 +++- + tests/llhttp_diagnostic_fault.c | 10 ++ + tests/test_c_parser_diagnostics.py | 150 ++++++++++++++++++++++++++++++++++++ + 4 files changed, 172 insertions(+), 6 deletions(-) + create mode 100644 CHANGES/13222.bugfix.rst + create mode 100644 tests/llhttp_diagnostic_fault.c + create mode 100644 tests/test_c_parser_diagnostics.py + +diff --git a/CHANGES/13222.bugfix.rst b/CHANGES/13222.bugfix.rst +new file mode 100644 +index 0000000000000000000000000000000000000000..dcdda17051ca720c81703ec846e5be06d17025f8 +--- /dev/null ++++ b/CHANGES/13222.bugfix.rst +@@ -0,0 +1 @@ ++Fixed error message construction in the C HTTP parser -- by :user:`bdraco`. +diff --git a/aiohttp/_http_parser.pyx b/aiohttp/_http_parser.pyx +index 6f5975b7833643f1c4f3deb0efd80afaf035cdea..3c4506e5bc5b5ca95cc51790f16f31de94456df3 100644 +--- a/aiohttp/_http_parser.pyx ++++ b/aiohttp/_http_parser.pyx +@@ -634,12 +634,9 @@ cdef class HttpParser: + ex = self._last_error + self._last_error = None + else: +- after = cparser.llhttp_get_error_pos(self._cparser) +- before = data[:after - base] +- after_b = after.split(b"\r\n", 1)[0] +- before = before.rsplit(b"\r\n", 1)[-1] +- data = before + after_b +- pointer = " " * (len(repr(before))-1) + "^" ++ error_pos = cparser.llhttp_get_error_pos(self._cparser) ++ error_off = error_pos - base ++ data, pointer = _format_error_context(data, error_off) + ex = parser_error_from_errno(self._cparser, data, pointer) + self._payload = None + raise ex +@@ -929,6 +926,14 @@ cdef int cb_on_chunk_complete(cparser.llhttp_t* parser) except -1: + return 0 + + ++def _format_error_context(bytes data not None, Py_ssize_t error_off): ++ """Return the bounded diagnostic line and the pointer to the error.""" ++ before = data[:error_off].rsplit(b"\r\n", 1)[-1] ++ after = data[error_off:].split(b"\r\n", 1)[0] ++ pointer = " " * (len(repr(before)) - 1) + "^" ++ return before + after, pointer ++ ++ + cdef parser_error_from_errno(cparser.llhttp_t* parser, data, pointer): + cdef cparser.llhttp_errno_t errno = cparser.llhttp_get_errno(parser) + cdef bytes desc = cparser.llhttp_get_error_reason(parser) +diff --git a/tests/llhttp_diagnostic_fault.c b/tests/llhttp_diagnostic_fault.c +new file mode 100644 +index 0000000000000000000000000000000000000000..44a63c4f866b2246fddc5f78300541ab6978f691 +--- /dev/null ++++ b/tests/llhttp_diagnostic_fault.c +@@ -0,0 +1,10 @@ ++#include "llhttp.h" ++ ++/* Fault injection for the isolated Linux parser diagnostic test. */ ++llhttp_errno_t llhttp_execute(llhttp_t *parser, const char *data, size_t len) ++{ ++ parser->error = HPE_USER; ++ parser->reason = "Injected diagnostic test error"; ++ parser->error_pos = data + (len > 2 ? 2 : 0); ++ return HPE_USER; ++} +diff --git a/tests/test_c_parser_diagnostics.py b/tests/test_c_parser_diagnostics.py +new file mode 100644 +index 0000000000000000000000000000000000000000..555c25d64bdf365e8caa9e9437eff40b3dde892a +--- /dev/null ++++ b/tests/test_c_parser_diagnostics.py +@@ -0,0 +1,150 @@ ++import asyncio ++import os ++import shutil ++import subprocess ++import sys ++from asyncio import AbstractEventLoop ++from pathlib import Path ++ ++import pytest ++ ++from aiohttp.base_protocol import BaseProtocol ++from aiohttp.http_exceptions import BadHttpMessage, BadStatusLine, LineTooLong ++ ++ ++_RESPONSE = ( ++ b"HTTP/1.1 200 OK\r\n" ++ b"Content-Length: 5\r\n" ++ b"X-Sample: example header value\r\n" ++ b"\r\n" ++ b"hello" ++) ++ ++ ++@pytest.mark.parametrize( ++ ("data", "offset", "expected"), ++ [ ++ (b"", 0, (b"", " ^")), ++ (b"sample", 0, (b"sample", " ^")), ++ (b"north\r\ncenter\r\nsouth", 10, (b"center", " ^")), ++ (b"north\r\ncenter\r\nsouth", 20, (b"south", " ^")), ++ (b"end\r\n", 5, (b"", " ^")), ++ ], ++ ids=["empty", "start", "middle-line", "buffer-end", "empty-last-line"], ++) ++def test_c_parser_error_context( ++ data: bytes, offset: int, expected: tuple[bytes, str] ++) -> None: ++ parser = pytest.importorskip("aiohttp._http_parser") ++ assert parser._format_error_context(data, offset) == expected ++ ++ ++def test_c_parser_reads_complete_response(loop: AbstractEventLoop) -> None: ++ parser_module = pytest.importorskip("aiohttp._http_parser") ++ parser = parser_module.HttpResponseParser(BaseProtocol(loop), loop, 2**16) ++ ++ messages, upgraded, tail = parser.feed_data(_RESPONSE) ++ ++ (message, payload), = messages ++ assert message.code == 200 ++ assert message.headers["X-Sample"] == "example header value" ++ assert not upgraded ++ assert tail == b"" ++ assert payload.read_nowait() == b"hello" ++ assert payload.at_eof() ++ ++ ++def test_c_parser_enforces_response_header_limit(loop: AbstractEventLoop) -> None: ++ parser_module = pytest.importorskip("aiohttp._http_parser") ++ parser = parser_module.HttpResponseParser( ++ BaseProtocol(loop), loop, 2**16, max_field_size=20 ++ ) ++ ++ with pytest.raises(LineTooLong, match="Got more than 20 bytes"): ++ parser.feed_data(_RESPONSE) ++ ++ ++def test_c_parser_rejects_invalid_status_line(loop: AbstractEventLoop) -> None: ++ parser_module = pytest.importorskip("aiohttp._http_parser") ++ parser = parser_module.HttpResponseParser(BaseProtocol(loop), loop, 2**16) ++ ++ with pytest.raises(BadStatusLine) as caught: ++ parser.feed_data(b"HTTP/1.1 ABC Invalid\r\n\r\n") ++ ++ assert caught.value.code == 400 ++ assert "HTTP/1.1 ABC Invalid" in caught.value.message ++ ++ ++def _assert_c_parser_fallback_diagnostic(expected_parser: Path) -> None: ++ from aiohttp import _http_parser ++ ++ assert Path(_http_parser.__file__).resolve() == expected_parser ++ captured: list[tuple[bytes, int]] = [] ++ format_error_context = _http_parser._format_error_context ++ ++ def record_context(data: bytes, offset: int) -> tuple[bytes, str]: ++ captured.append((data, offset)) ++ return format_error_context(data, offset) ++ ++ _http_parser._format_error_context = record_context ++ loop = asyncio.new_event_loop() ++ try: ++ parser = _http_parser.HttpResponseParser(BaseProtocol(loop), loop, 2**16) ++ with pytest.raises(BadHttpMessage) as caught: ++ parser.feed_data(_RESPONSE) ++ finally: ++ loop.close() ++ ++ assert captured == [(_RESPONSE, 2)] ++ assert caught.value.message == ( ++ "Injected diagnostic test error:\n\n b'HTTP/1.1 200 OK'\n ^" ++ ) ++ ++ ++@pytest.mark.internal ++@pytest.mark.skipif(sys.platform != "linux", reason="requires Linux LD_PRELOAD") ++def test_c_parser_formats_injected_llhttp_error(tmp_path: Path) -> None: ++ parser = pytest.importorskip("aiohttp._http_parser") ++ parser_path = Path(parser.__file__).resolve() ++ compiler = shutil.which("cc") ++ if compiler is None: ++ pytest.skip("requires a C compiler for the test-only llhttp shim") ++ ++ test_file = Path(__file__).resolve() ++ llhttp_include = test_file.parent.parent / "vendor" / "llhttp" / "build" ++ if not (llhttp_include / "llhttp.h").is_file(): ++ pytest.skip("requires the bundled llhttp headers") ++ ++ shim = tmp_path / "llhttp_diagnostic_fault.so" ++ subprocess.run( ++ [ ++ compiler, ++ "-shared", ++ "-fPIC", ++ "-I", str(llhttp_include), ++ str(test_file.with_name("llhttp_diagnostic_fault.c")), ++ "-o", str(shim), ++ ], ++ check=True, ++ timeout=15, ++ ) ++ # Restrict symbol interposition to the subprocess that sends one valid ++ # response. The shim causes feed_data() to take the native fallback path. ++ env = dict(os.environ) ++ preload = env.get("LD_PRELOAD") ++ env["LD_PRELOAD"] = f"{preload}:{shim}" if preload else str(shim) ++ child = ( ++ "import runpy, sys\n" ++ "from pathlib import Path\n" ++ "parser_path = Path(sys.argv[2])\n" ++ "sys.path.insert(0, str(parser_path.parent.parent))\n" ++ "namespace = runpy.run_path(sys.argv[1])\n" ++ "namespace['_assert_c_parser_fallback_diagnostic'](parser_path)\n" ++ ) ++ subprocess.run( ++ [sys.executable, "-c", child, str(test_file), str(parser_path)], ++ cwd=test_file.parent.parent, ++ env=env, ++ check=True, ++ timeout=15, ++ ) diff --git a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb index bbd7b27..e880c61 100644 --- a/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb +++ b/meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb @@ -49,6 +49,7 @@ SRC_URI += "file://CVE-2024-52304.patch \ file://CVE-2026-69243_p1.patch \ file://CVE-2026-69243_p2.patch \ file://CVE-2026-69243_CVE-2026-128129.patch \ + file://CVE-2026-69244.patch \ " CVE_STATUS[CVE-2026-34515] = "not-applicable-platform: Vulnerability only affects applications running on Windows"