summaryrefslogtreecommitdiffstats
path: root/meta-python/recipes-devtools
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2026-01-07 10:27:47 +0100
committerGyorgy Sarvari <skandigraun@gmail.com>2026-01-08 22:03:03 +0100
commit1bd2effd23f752dc53eafb8032c8874fd36f872d (patch)
treeb20559f32d72eb87cc8f3c1c350e93212d209f7d /meta-python/recipes-devtools
parent1ea440cd62d4fc1a0cd4d391bef16cc0ee894458 (diff)
downloadmeta-openembedded-1bd2effd23f752dc53eafb8032c8874fd36f872d.tar.gz
python3-waitress: patch CVE-2024-49769
Details: https://nvd.nist.gov/vuln/detail/CVE-2024-49769 Pick the patch that is referenced in the NVD report (which is a merge commit. The patches here are the individual patches from that merge). Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Diffstat (limited to 'meta-python/recipes-devtools')
-rw-r--r--meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-1.patch27
-rw-r--r--meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-2.patch53
-rw-r--r--meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-3.patch34
-rw-r--r--meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-4.patch34
-rw-r--r--meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-5.patch211
-rw-r--r--meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-6.patch41
-rw-r--r--meta-python/recipes-devtools/python/python3-waitress_2.1.2.bb6
7 files changed, 406 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-1.patch b/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-1.patch
new file mode 100644
index 0000000000..a8a0a2e594
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-1.patch
@@ -0,0 +1,27 @@
1From fdabcb31093507f50fcaeb46012ec8df8bf76359 Mon Sep 17 00:00:00 2001
2From: Delta Regeer <bertjw@regeer.org>
3Date: Sun, 3 Mar 2024 16:15:51 -0700
4Subject: [PATCH] HTTPChannel is always created from accept, explicitly set
5 self.connected to True
6
7CVE: CVE-2024-49769
8Upstream-Status: Backport [https://github.com/Pylons/waitress/commit/03cc640fe7106902899f82115c26e37002bca7f1]
9Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
10---
11 src/waitress/channel.py | 3 +--
12 1 file changed, 1 insertion(+), 2 deletions(-)
13
14diff --git a/src/waitress/channel.py b/src/waitress/channel.py
15index 756adce..cf19ef2 100644
16--- a/src/waitress/channel.py
17+++ b/src/waitress/channel.py
18@@ -67,8 +67,7 @@ class HTTPChannel(wasyncore.dispatcher):
19 self.outbuf_lock = threading.Condition()
20
21 wasyncore.dispatcher.__init__(self, sock, map=map)
22-
23- # Don't let wasyncore.dispatcher throttle self.addr on us.
24+ self.connected = True
25 self.addr = addr
26 self.requests = []
27
diff --git a/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-2.patch b/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-2.patch
new file mode 100644
index 0000000000..a34ee4fb11
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-2.patch
@@ -0,0 +1,53 @@
1From 646d7bfa81185b961b4797965f5c7ff0e380bc5c Mon Sep 17 00:00:00 2001
2From: Delta Regeer <bertjw@regeer.org>
3Date: Sun, 3 Mar 2024 16:16:48 -0700
4Subject: [PATCH] Assume socket is not connected when passed to
5 wasyncore.dispatcher
6
7No longer call getpeername() on the remote socket either, as it is not
8necessary for any of the places where waitress requires that self.addr
9in a subclass of the dispatcher needs it.
10
11This removes a race condition when setting up a HTTPChannel where we
12accepted the socket, and know the remote address, yet call getpeername()
13again which would have the unintended side effect of potentially setting
14self.connected to False because the remote has already shut down part of
15the socket.
16
17This issue was uncovered in #418, where the server would go into a hard
18loop because self.connected was used in various parts of the code base.
19
20CVE: CVE-2024-49769
21Upstream-Status: Backport [https://github.com/Pylons/waitress/commit/840aebce1c4c1bfd9036f402c1f5d5a4d2f4a1c2]
22Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
23---
24 src/waitress/wasyncore.py | 16 ----------------
25 1 file changed, 16 deletions(-)
26
27diff --git a/src/waitress/wasyncore.py b/src/waitress/wasyncore.py
28index b3459e0..b5ddce2 100644
29--- a/src/waitress/wasyncore.py
30+++ b/src/waitress/wasyncore.py
31@@ -298,22 +298,6 @@ class dispatcher:
32 # get a socket from a blocking source.
33 sock.setblocking(0)
34 self.set_socket(sock, map)
35- self.connected = True
36- # The constructor no longer requires that the socket
37- # passed be connected.
38- try:
39- self.addr = sock.getpeername()
40- except OSError as err:
41- if err.args[0] in (ENOTCONN, EINVAL):
42- # To handle the case where we got an unconnected
43- # socket.
44- self.connected = False
45- else:
46- # The socket is broken in some unknown way, alert
47- # the user and remove it from the map (to prevent
48- # polling of broken sockets).
49- self.del_channel(map)
50- raise
51 else:
52 self.socket = None
53
diff --git a/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-3.patch b/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-3.patch
new file mode 100644
index 0000000000..165ede95c7
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-3.patch
@@ -0,0 +1,34 @@
1From 28377c0e0fdd8669fb250e69745caf1c27ba541b Mon Sep 17 00:00:00 2001
2From: Delta Regeer <bertjw@regeer.org>
3Date: Sun, 3 Mar 2024 16:23:33 -0700
4Subject: [PATCH] Remove test for getpeername()
5
6CVE: CVE-2024-49769
7Upstream-Status: Backport [https://github.com/Pylons/waitress/commit/86c680df4e4bdd40c78dec771cddcee059e802c4]
8Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
9---
10 tests/test_wasyncore.py | 11 -----------
11 1 file changed, 11 deletions(-)
12
13diff --git a/tests/test_wasyncore.py b/tests/test_wasyncore.py
14index e833c7e..5f38bd9 100644
15--- a/tests/test_wasyncore.py
16+++ b/tests/test_wasyncore.py
17@@ -1451,17 +1451,6 @@ class Test_dispatcher(unittest.TestCase):
18
19 return dispatcher(sock=sock, map=map)
20
21- def test_unexpected_getpeername_exc(self):
22- sock = dummysocket()
23-
24- def getpeername():
25- raise OSError(errno.EBADF)
26-
27- map = {}
28- sock.getpeername = getpeername
29- self.assertRaises(socket.error, self._makeOne, sock=sock, map=map)
30- self.assertEqual(map, {})
31-
32 def test___repr__accepting(self):
33 sock = dummysocket()
34 map = {}
diff --git a/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-4.patch b/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-4.patch
new file mode 100644
index 0000000000..6ea5bdb065
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-4.patch
@@ -0,0 +1,34 @@
1From ee501847c38e21be0683ba81925472f219044a65 Mon Sep 17 00:00:00 2001
2From: Delta Regeer <bertjw@regeer.org>
3Date: Sun, 3 Mar 2024 16:26:22 -0700
4Subject: [PATCH] Don't exit handle_write early -- even if socket is not
5 connected
6
7Calling handle_close() multiple times does not hurt anything, and is
8safe.
9
10CVE: CVE-2024-49769
11Upstream-Status: Backport [https://github.com/Pylons/waitress/commit/8cba302b1ac08c2874ae179b2af2445e89311bac]
12Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
13---
14 src/waitress/channel.py | 6 ------
15 1 file changed, 6 deletions(-)
16
17diff --git a/src/waitress/channel.py b/src/waitress/channel.py
18index cf19ef2..f4d9677 100644
19--- a/src/waitress/channel.py
20+++ b/src/waitress/channel.py
21@@ -91,13 +91,7 @@ class HTTPChannel(wasyncore.dispatcher):
22 # Precondition: there's data in the out buffer to be sent, or
23 # there's a pending will_close request
24
25- if not self.connected:
26- # we dont want to close the channel twice
27-
28- return
29-
30 # try to flush any pending output
31-
32 if not self.requests:
33 # 1. There are no running tasks, so we don't need to try to lock
34 # the outbuf before sending
diff --git a/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-5.patch b/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-5.patch
new file mode 100644
index 0000000000..14fe56e021
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-5.patch
@@ -0,0 +1,211 @@
1From aa161b98cc787f266d8ef358f00fc5b2b3944157 Mon Sep 17 00:00:00 2001
2From: Delta Regeer <bertjw@regeer.org>
3Date: Sun, 3 Mar 2024 16:35:39 -0700
4Subject: [PATCH] Remove code not used by waitress from vendored asyncore
5
6CVE: CVE-2024-49769
7Upstream-Status: Backport [https://github.com/Pylons/waitress/commit/63678e652d912e67621580123c603e37c319d8c4]
8Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
9---
10 src/waitress/wasyncore.py | 45 ------------------
11 tests/test_wasyncore.py | 96 ++++++++-------------------------------
12 2 files changed, 18 insertions(+), 123 deletions(-)
13
14diff --git a/src/waitress/wasyncore.py b/src/waitress/wasyncore.py
15index b5ddce2..117f78a 100644
16--- a/src/waitress/wasyncore.py
17+++ b/src/waitress/wasyncore.py
18@@ -379,23 +379,6 @@ class dispatcher:
19 self.addr = addr
20 return self.socket.bind(addr)
21
22- def connect(self, address):
23- self.connected = False
24- self.connecting = True
25- err = self.socket.connect_ex(address)
26- if (
27- err in (EINPROGRESS, EALREADY, EWOULDBLOCK)
28- or err == EINVAL
29- and os.name == "nt"
30- ): # pragma: no cover
31- self.addr = address
32- return
33- if err in (0, EISCONN):
34- self.addr = address
35- self.handle_connect_event()
36- else:
37- raise OSError(err, errorcode[err])
38-
39 def accept(self):
40 # XXX can return either an address pair or None
41 try:
42@@ -557,34 +540,6 @@ class dispatcher:
43 self.close()
44
45
46-# ---------------------------------------------------------------------------
47-# adds simple buffered output capability, useful for simple clients.
48-# [for more sophisticated usage use asynchat.async_chat]
49-# ---------------------------------------------------------------------------
50-
51-
52-class dispatcher_with_send(dispatcher):
53- def __init__(self, sock=None, map=None):
54- dispatcher.__init__(self, sock, map)
55- self.out_buffer = b""
56-
57- def initiate_send(self):
58- num_sent = 0
59- num_sent = dispatcher.send(self, self.out_buffer[:65536])
60- self.out_buffer = self.out_buffer[num_sent:]
61-
62- handle_write = initiate_send
63-
64- def writable(self):
65- return (not self.connected) or len(self.out_buffer)
66-
67- def send(self, data):
68- if self.debug: # pragma: no cover
69- self.log_info("sending %s" % repr(data))
70- self.out_buffer = self.out_buffer + data
71- self.initiate_send()
72-
73-
74 def close_all(map=None, ignore_all=False):
75 if map is None: # pragma: no cover
76 map = socket_map
77diff --git a/tests/test_wasyncore.py b/tests/test_wasyncore.py
78index 5f38bd9..44b8e19 100644
79--- a/tests/test_wasyncore.py
80+++ b/tests/test_wasyncore.py
81@@ -1,6 +1,7 @@
82 import _thread as thread
83 import contextlib
84 import errno
85+from errno import EALREADY, EINPROGRESS, EINVAL, EISCONN, EWOULDBLOCK, errorcode
86 import functools
87 import gc
88 from io import BytesIO
89@@ -641,62 +642,6 @@ class DispatcherTests(unittest.TestCase):
90 self.assertTrue(err != "")
91
92
93-class dispatcherwithsend_noread(asyncore.dispatcher_with_send): # pragma: no cover
94- def readable(self):
95- return False
96-
97- def handle_connect(self):
98- pass
99-
100-
101-class DispatcherWithSendTests(unittest.TestCase):
102- def setUp(self):
103- pass
104-
105- def tearDown(self):
106- asyncore.close_all()
107-
108- @reap_threads
109- def test_send(self):
110- evt = threading.Event()
111- sock = socket.socket()
112- sock.settimeout(3)
113- port = bind_port(sock)
114-
115- cap = BytesIO()
116- args = (evt, cap, sock)
117- t = threading.Thread(target=capture_server, args=args)
118- t.start()
119- try:
120- # wait a little longer for the server to initialize (it sometimes
121- # refuses connections on slow machines without this wait)
122- time.sleep(0.2)
123-
124- data = b"Suppose there isn't a 16-ton weight?"
125- d = dispatcherwithsend_noread()
126- d.create_socket()
127- d.connect((HOST, port))
128-
129- # give time for socket to connect
130- time.sleep(0.1)
131-
132- d.send(data)
133- d.send(data)
134- d.send(b"\n")
135-
136- n = 1000
137-
138- while d.out_buffer and n > 0: # pragma: no cover
139- asyncore.poll()
140- n -= 1
141-
142- evt.wait()
143-
144- self.assertEqual(cap.getvalue(), data * 2)
145- finally:
146- join_thread(t, timeout=TIMEOUT)
147-
148-
149 @unittest.skipUnless(
150 hasattr(asyncore, "file_wrapper"), "asyncore.file_wrapper required"
151 )
152@@ -839,6 +784,23 @@ class BaseClient(BaseTestHandler):
153 self.create_socket(family)
154 self.connect(address)
155
156+ def connect(self, address):
157+ self.connected = False
158+ self.connecting = True
159+ err = self.socket.connect_ex(address)
160+ if (
161+ err in (EINPROGRESS, EALREADY, EWOULDBLOCK)
162+ or err == EINVAL
163+ and os.name == "nt"
164+ ): # pragma: no cover
165+ self.addr = address
166+ return
167+ if err in (0, EISCONN):
168+ self.addr = address
169+ self.handle_connect_event()
170+ else:
171+ raise OSError(err, errorcode[err])
172+
173 def handle_connect(self):
174 pass
175
176@@ -1486,13 +1448,6 @@ class Test_dispatcher(unittest.TestCase):
177 inst.set_reuse_addr()
178 self.assertTrue(sock.errored)
179
180- def test_connect_raise_socket_error(self):
181- sock = dummysocket()
182- map = {}
183- sock.connect_ex = lambda *arg: 1
184- inst = self._makeOne(sock=sock, map=map)
185- self.assertRaises(socket.error, inst.connect, 0)
186-
187 def test_accept_raise_TypeError(self):
188 sock = dummysocket()
189 map = {}
190@@ -1661,21 +1616,6 @@ class Test_dispatcher(unittest.TestCase):
191 self.assertTrue(sock.closed)
192
193
194-class Test_dispatcher_with_send(unittest.TestCase):
195- def _makeOne(self, sock=None, map=None):
196- from waitress.wasyncore import dispatcher_with_send
197-
198- return dispatcher_with_send(sock=sock, map=map)
199-
200- def test_writable(self):
201- sock = dummysocket()
202- map = {}
203- inst = self._makeOne(sock=sock, map=map)
204- inst.out_buffer = b"123"
205- inst.connected = True
206- self.assertTrue(inst.writable())
207-
208-
209 class Test_close_all(unittest.TestCase):
210 def _callFUT(self, map=None, ignore_all=False):
211 from waitress.wasyncore import close_all
diff --git a/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-6.patch b/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-6.patch
new file mode 100644
index 0000000000..dedfa0d41c
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-waitress/CVE-2024-49769-6.patch
@@ -0,0 +1,41 @@
1From 4a5ce98ecaed785a14781700106d60c4072c9b87 Mon Sep 17 00:00:00 2001
2From: Delta Regeer <bertjw@regeer.org>
3Date: Sun, 3 Mar 2024 16:37:12 -0700
4Subject: [PATCH] When closing the socket, set it to None
5
6This avoids calling close() twice on the same socket if self.close() or
7self.handle_close() is called multiple times
8
9CVE: CVE-2024-49769
10Upstream-Status: Backport [https://github.com/Pylons/waitress/commit/9d99c89ae4aa8449313eea210a5ec9f3994a87b2]
11Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
12---
13 src/waitress/wasyncore.py | 8 +++++++-
14 1 file changed, 7 insertions(+), 1 deletion(-)
15
16diff --git a/src/waitress/wasyncore.py b/src/waitress/wasyncore.py
17index 117f78a..f0cd23e 100644
18--- a/src/waitress/wasyncore.py
19+++ b/src/waitress/wasyncore.py
20@@ -437,6 +437,8 @@ class dispatcher:
21 if why.args[0] not in (ENOTCONN, EBADF):
22 raise
23
24+ self.socket = None
25+
26 # log and log_info may be overridden to provide more sophisticated
27 # logging and warning methods. In general, log is for 'hit' logging
28 # and 'log_info' is for informational, warning and error logging.
29@@ -487,7 +489,11 @@ class dispatcher:
30 # handle_expt_event() is called if there might be an error on the
31 # socket, or if there is OOB data
32 # check for the error condition first
33- err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
34+ err = (
35+ self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
36+ if self.socket is not None
37+ else 1
38+ )
39 if err != 0:
40 # we can get here when select.select() says that there is an
41 # exceptional condition on the socket
diff --git a/meta-python/recipes-devtools/python/python3-waitress_2.1.2.bb b/meta-python/recipes-devtools/python/python3-waitress_2.1.2.bb
index dbb8b05e52..a480c1ac55 100644
--- a/meta-python/recipes-devtools/python/python3-waitress_2.1.2.bb
+++ b/meta-python/recipes-devtools/python/python3-waitress_2.1.2.bb
@@ -14,6 +14,12 @@ SRC_URI += "file://CVE-2024-49768-1.patch \
14 file://CVE-2024-49768-2.patch \ 14 file://CVE-2024-49768-2.patch \
15 file://CVE-2024-49768-3.patch \ 15 file://CVE-2024-49768-3.patch \
16 file://CVE-2024-49768-4.patch \ 16 file://CVE-2024-49768-4.patch \
17 file://CVE-2024-49769-1.patch \
18 file://CVE-2024-49769-2.patch \
19 file://CVE-2024-49769-3.patch \
20 file://CVE-2024-49769-4.patch \
21 file://CVE-2024-49769-5.patch \
22 file://CVE-2024-49769-6.patch \
17 " 23 "
18SRC_URI[sha256sum] = "780a4082c5fbc0fde6a2fcfe5e26e6efc1e8f425730863c04085769781f51eba" 24SRC_URI[sha256sum] = "780a4082c5fbc0fde6a2fcfe5e26e6efc1e8f425730863c04085769781f51eba"
19 25