summaryrefslogtreecommitdiffstats
path: root/meta-python
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2026-02-07 11:33:51 +0100
committerAnuj Mittal <anuj.mittal@oss.qualcomm.com>2026-02-12 13:38:12 +0530
commitcd71a1e57c96bcfaaba7ed00f9fbd7be83cf09e8 (patch)
treea03dbf51a9d40641094be25e79fb85356ce89c9c /meta-python
parent0f91805c4b9de8d70a247159b34992bbfa723fab (diff)
downloadmeta-openembedded-cd71a1e57c96bcfaaba7ed00f9fbd7be83cf09e8.tar.gz
python3-aiohttp: patch CVE-2025-69226
Details: https://nvd.nist.gov/vuln/detail/CVE-2025-69226 Backport the patch that is referenced by the NVD advisory. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
Diffstat (limited to 'meta-python')
-rw-r--r--meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69226.patch134
-rw-r--r--meta-python/recipes-devtools/python/python3-aiohttp_3.9.5.bb1
2 files changed, 135 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69226.patch b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69226.patch
new file mode 100644
index 0000000000..77dd89a805
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-aiohttp/CVE-2025-69226.patch
@@ -0,0 +1,134 @@
1From 8d718d1fb8ee7a923c0e42cf100908ecead4f564 Mon Sep 17 00:00:00 2001
2From: Gyorgy Sarvari <skandigraun@gmail.com>
3Date: Sat, 3 Jan 2026 01:55:05 +0000
4Subject: [PATCH] Reject static URLs that traverse outside static root (#11888)
5 (#11906)
6
7From: Sam Bull <git@sambull.org>
8
9(cherry picked from commit 63961fa77fa2443109f25c3d8ab94772d3878626)
10
11Co-authored-by: J. Nick Koston <nick@koston.org>
12
13CVE: CVE-2025-69226
14Upstream-Status: Backport [https://github.com/aio-libs/aiohttp/commit/f2a86fd5ac0383000d1715afddfa704413f0711e]
15Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
16---
17 aiohttp/web_urldispatcher.py | 17 +++++++++--------
18 tests/test_urldispatch.py | 18 +++++++++++++++++-
19 tests/test_web_sendfile_functional.py | 2 +-
20 tests/test_web_urldispatcher.py | 4 ++--
21 4 files changed, 29 insertions(+), 12 deletions(-)
22
23diff --git a/aiohttp/web_urldispatcher.py b/aiohttp/web_urldispatcher.py
24index 954291f..864f8dd 100644
25--- a/aiohttp/web_urldispatcher.py
26+++ b/aiohttp/web_urldispatcher.py
27@@ -7,6 +7,7 @@ import html
28 import inspect
29 import keyword
30 import os
31+import platform
32 import re
33 import warnings
34 from contextlib import contextmanager
35@@ -88,6 +89,7 @@ ROUTE_RE: Final[Pattern[str]] = re.compile(
36 )
37 PATH_SEP: Final[str] = re.escape("/")
38
39+IS_WINDOWS: Final[bool] = platform.system() == "Windows"
40
41 _ExpectHandler = Callable[[Request], Awaitable[Optional[StreamResponse]]]
42 _Resolve = Tuple[Optional["UrlMappingMatchInfo"], Set[str]]
43@@ -647,7 +649,12 @@ class StaticResource(PrefixResource):
44 path = request.rel_url.raw_path
45 method = request.method
46 allowed_methods = set(self._routes)
47- if not path.startswith(self._prefix2) and path != self._prefix:
48+ # We normalise here to avoid matches that traverse below the static root.
49+ # e.g. /static/../../../../home/user/webapp/static/
50+ norm_path = os.path.normpath(path)
51+ if IS_WINDOWS:
52+ norm_path = norm_path.replace("\\", "/")
53+ if not norm_path.startswith(self._prefix2) and norm_path != self._prefix:
54 return None, set()
55
56 if method not in allowed_methods:
57@@ -663,14 +670,8 @@ class StaticResource(PrefixResource):
58 return iter(self._routes.values())
59
60 async def _handle(self, request: Request) -> StreamResponse:
61- rel_url = request.match_info["filename"]
62 try:
63- filename = Path(rel_url)
64- if filename.anchor:
65- # rel_url is an absolute name like
66- # /static/\\machine_name\c$ or /static/D:\path
67- # where the static dir is totally different
68- raise HTTPForbidden()
69+ filename = request.match_info["filename"]
70 unresolved_path = self._directory.joinpath(filename)
71 if self._follow_symlinks:
72 normalized_path = Path(os.path.normpath(unresolved_path))
73diff --git a/tests/test_urldispatch.py b/tests/test_urldispatch.py
74index 4f3abb8..cec4cd0 100644
75--- a/tests/test_urldispatch.py
76+++ b/tests/test_urldispatch.py
77@@ -1,4 +1,5 @@
78 import pathlib
79+import platform
80 import re
81 from collections.abc import Container, Iterable, Mapping, MutableMapping, Sized
82 from urllib.parse import unquote
83@@ -967,7 +968,22 @@ async def test_405_for_resource_adapter(router) -> None:
84 assert (None, {"HEAD", "GET"}) == ret
85
86
87-async def test_check_allowed_method_for_found_resource(router) -> None:
88+@pytest.mark.skipif(platform.system() == "Windows", reason="Different path formats")
89+async def test_static_resource_outside_traversal(router: web.UrlDispatcher) -> None:
90+ """Test relative path traversing outside root does not resolve."""
91+ static_file = pathlib.Path(aiohttp.__file__)
92+ request_path = "/st" + "/.." * (len(static_file.parts) - 2) + str(static_file)
93+ assert pathlib.Path(request_path).resolve() == static_file
94+
95+ resource = router.add_static("/st", static_file.parent)
96+ ret = await resource.resolve(make_mocked_request("GET", request_path))
97+ # Should not resolve, otherwise filesystem information may be leaked.
98+ assert (None, set()) == ret
99+
100+
101+async def test_check_allowed_method_for_found_resource(
102+ router: web.UrlDispatcher,
103+) -> None:
104 handler = make_handler()
105 resource = router.add_resource("/")
106 resource.add_route("GET", handler)
107diff --git a/tests/test_web_sendfile_functional.py b/tests/test_web_sendfile_functional.py
108index 57ac084..aa53726 100644
109--- a/tests/test_web_sendfile_functional.py
110+++ b/tests/test_web_sendfile_functional.py
111@@ -565,7 +565,7 @@ async def test_static_file_directory_traversal_attack(aiohttp_client) -> None:
112
113 url_abspath = "/static/" + str(full_path.resolve())
114 resp = await client.get(url_abspath)
115- assert 403 == resp.status
116+ assert resp.status == 404
117 await resp.release()
118
119 await client.close()
120diff --git a/tests/test_web_urldispatcher.py b/tests/test_web_urldispatcher.py
121index 0441890..4164677 100644
122--- a/tests/test_web_urldispatcher.py
123+++ b/tests/test_web_urldispatcher.py
124@@ -701,8 +701,8 @@ async def test_static_absolute_url(
125 here = pathlib.Path(__file__).parent
126 app.router.add_static("/static", here)
127 client = await aiohttp_client(app)
128- resp = await client.get("/static/" + str(file_path.resolve()))
129- assert resp.status == 403
130+ async with client.get("/static/" + str(file_path.resolve())) as resp:
131+ assert resp.status == 404
132
133
134 async def test_for_issue_5250(
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 43482db392..f2332065ea 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
@@ -9,6 +9,7 @@ SRC_URI[sha256sum] = "edea7d15772ceeb29db4aff55e482d4bcfb6ae160ce144f2682de02f6d
9SRC_URI += "file://CVE-2024-52304.patch \ 9SRC_URI += "file://CVE-2024-52304.patch \
10 file://CVE-2025-53643.patch \ 10 file://CVE-2025-53643.patch \
11 file://CVE-2025-69225.patch \ 11 file://CVE-2025-69225.patch \
12 file://CVE-2025-69226.patch \
12 " 13 "
13 14
14PYPI_PACKAGE = "aiohttp" 15PYPI_PACKAGE = "aiohttp"