Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python310 for openSUSE:Factory checked in at 2026-11-25 16:12:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python310 (Old) and /work/SRC/openSUSE:Factory/.python310.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python310" Wed Nov 25 16:12:56 2026 rev:87 rq:1400419 version:3.10.22 Changes: -------- --- /work/SRC/openSUSE:Factory/python310/python310.changes 2026-11-09 17:45:34.026426245 +0100 +++ /work/SRC/openSUSE:Factory/.python310.new.1340718/python310.changes 2026-11-25 16:14:07.548374534 +0100 @@ -1,0 +2,28 @@ +Mon Nov 23 17:37:38 UTC 2026 - Matej Cepl <[email protected]> + +- CVE-2026-114583: Reject links replacing the destination in + tarfile.tar_filter (bsc#1288258) + CVE-2026-114583-tarfile-reject-link-at-destination.patch + +------------------------------------------------------------------- +Mon Nov 23 11:58:06 UTC 2026 - Matej Cepl <[email protected]> + +- CVE-2026-103995: Validate http.client Content-Length + and chunk-size (bsc#1288328) + CVE-2026-103995-http-client-content-length-chunk-size.patch + +------------------------------------------------------------------- +Fri Nov 20 16:57:59 UTC 2026 - Matej Cepl <[email protected]> + +- CVE-2026-19553: Validate SSLContext.wrap_bio() parameters + like wrap_socket() (bsc#1283826) + CVE-2026-19553-validate-wrap_bio-parameters.patch + +------------------------------------------------------------------- +Fri Nov 20 14:42:21 UTC 2026 - Matej Cepl <[email protected]> + +- CVE-2026-116566: Reject null bytes in socket.getaddrinfo() + host and port (bsc#1289106) + CVE-2026-116566-getaddrinfo-null-bytes.patch + +------------------------------------------------------------------- New: ---- CVE-2026-103995-http-client-content-length-chunk-size.patch CVE-2026-114583-tarfile-reject-link-at-destination.patch CVE-2026-116566-getaddrinfo-null-bytes.patch CVE-2026-19553-validate-wrap_bio-parameters.patch ----------(New B)---------- New: and chunk-size (bsc#1288328) CVE-2026-103995-http-client-content-length-chunk-size.patch New: tarfile.tar_filter (bsc#1288258) CVE-2026-114583-tarfile-reject-link-at-destination.patch New: host and port (bsc#1289106) CVE-2026-116566-getaddrinfo-null-bytes.patch New: like wrap_socket() (bsc#1283826) CVE-2026-19553-validate-wrap_bio-parameters.patch ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python310.spec ++++++ --- /var/tmp/diff_new_pack.1QYOqI/_old 2026-11-25 16:14:13.142610617 +0100 +++ /var/tmp/diff_new_pack.1QYOqI/_new 2026-11-25 16:14:13.152611039 +0100 @@ -230,9 +230,21 @@ # PATCH-FIX-UPSTREAM bsc1263083-http-cookies-atob-utf8.patch bsc#1263083 [email protected] # Use decodeURIComponent() for UTF-8 support in js_output() Patch63: bsc1263083-http-cookies-atob-utf8.patch -# PATCH-FIX-UPSTREAM CVE-2026-115557-distrust-emudhra-ca-keys.patch bsc#1287357 Matej Cepl <[email protected]> +# PATCH-FIX-UPSTREAM CVE-2026-115557-distrust-emudhra-ca-keys.patch bsc#1287357 [email protected] # Distrust compromised eMudhra intermediate CA keys Patch64: CVE-2026-115557-distrust-emudhra-ca-keys.patch +# PATCH-FIX-UPSTREAM CVE-2026-116566-getaddrinfo-null-bytes.patch bsc#1289106 [email protected] +# Reject null bytes in socket.getaddrinfo() host and port +Patch65: CVE-2026-116566-getaddrinfo-null-bytes.patch +# PATCH-FIX-UPSTREAM CVE-2026-19553-validate-wrap_bio-parameters.patch bsc#1283826 [email protected] +# Validate SSLContext.wrap_bio() parameters like wrap_socket() +Patch66: CVE-2026-19553-validate-wrap_bio-parameters.patch +# PATCH-FIX-UPSTREAM CVE-2026-103995-http-client-content-length-chunk-size.patch bsc#1288328 [email protected] +# Validate http.client Content-Length and chunk-size +Patch67: CVE-2026-103995-http-client-content-length-chunk-size.patch +# PATCH-FIX-UPSTREAM CVE-2026-114583-tarfile-reject-link-at-destination.patch bsc#1288258 [email protected] +# Reject links replacing the destination in tarfile.tar_filter +Patch68: CVE-2026-114583-tarfile-reject-link-at-destination.patch ### END OF PATCHES BuildRequires: autoconf-archive BuildRequires: automake ++++++ CVE-2026-103995-http-client-content-length-chunk-size.patch ++++++ >From 2eb2af805c156ca52b316bb4ced5e0ab3971d0ae Mon Sep 17 00:00:00 2001 From: metsw24-max <[email protected]> Date: Thu, 8 Oct 2026 18:10:51 +0530 Subject: [PATCH] gh-150751: validate http.client Content-Length and chunk-size (GH-150752) RFC 9112 defines Content-Length as 1*DIGIT and chunk-size as 1*HEXDIG, but int() also accepts a sign, underscores and an 0x prefix, so malformed framing values were parsed instead of rejected. Backport PR https://github.com/python/cpython/pull/160771 also carries the follow-up fix "gh-150751: Ignore optional whitespace around Content-Length in http.client (GH-159156)", upstream commit 9f52b443c002cccfb54bda0706a9276b6b4a109d. Index: Python-3.10.22/Lib/http/client.py =================================================================== --- Python-3.10.22.orig/Lib/http/client.py 2026-11-23 13:24:23.816142096 +0100 +++ Python-3.10.22/Lib/http/client.py 2026-11-23 13:25:11.645649192 +0100 @@ -165,6 +165,11 @@ # to prevent http header injection. _contains_disallowed_method_pchar_re = re.compile('[\x00-\x1f]') +# RFC 9112: Content-Length = 1*DIGIT and chunk-size = 1*HEXDIG. +# int() is more permissive, so we match against the grammar before calling it. +_is_legal_content_length = re.compile(r'[0-9]+').fullmatch +_is_legal_chunk_size = re.compile(rb'[0-9a-fA-F]+').fullmatch + # We always set the Content-Length header for these methods because some # servers will otherwise respond with a 411 _METHODS_EXPECTING_BODY = {'PATCH', 'POST', 'PUT'} @@ -370,14 +375,12 @@ # NOTE: RFC 2616, S4.4, #3 says we ignore this if tr_enc is "chunked" self.length = None length = self.headers.get("content-length") - if length and not self.chunked: - try: - self.length = int(length) - except ValueError: - self.length = None - else: - if self.length < 0: # ignore nonsensical negative lengths - self.length = None + if length is not None: + # RFC 9112, section 5.1: optional whitespace (SP / HTAB) around + # the field value is not part of the value. + length = length.strip(' \t') + if length and not self.chunked and _is_legal_content_length(length): + self.length = int(length) else: self.length = None @@ -544,7 +547,10 @@ i = line.find(b";") if i >= 0: line = line[:i] # strip chunk-extensions + line = line.rstrip() try: + if not _is_legal_chunk_size(line): + raise ValueError("invalid chunk size") return int(line, 16) except ValueError: # close the connection as protocol synchronisation is Index: Python-3.10.22/Lib/test/test_httplib.py =================================================================== --- Python-3.10.22.orig/Lib/test/test_httplib.py 2026-11-23 13:24:23.816142096 +0100 +++ Python-3.10.22/Lib/test/test_httplib.py 2026-11-23 13:25:11.652649266 +0100 @@ -1034,6 +1034,49 @@ self.assertEqual(resp.read(), b'Hello\r\n') self.assertTrue(resp.isclosed()) + def test_malformed_content_length(self): + # RFC 9112: Content-Length = 1*DIGIT. Values that int() accepts but + # the grammar forbids must not be used to frame the body. + for value in ('+5', '5_0', '5 0'): + with self.subTest(value=value): + sock = FakeSocket( + 'HTTP/1.1 200 OK\r\nContent-Length: %s\r\n\r\nHello\r\n' % value) + resp = client.HTTPResponse(sock, method="GET") + resp.begin() + self.assertIsNone(resp.length) + self.assertEqual(resp.read(), b'Hello\r\n') + resp.close() + + def test_content_length_with_whitespace(self): + # RFC 9112, section 5.1: optional whitespace (SP / HTAB) around + # the field value is not part of the value, so it must not + # prevent the Content-Length from being used to frame the body. + for value in ('7 ', '7\t', '7 \t ', ' 7 '): + with self.subTest(value=value): + sock = FakeSocket( + 'HTTP/1.1 200 OK\r\nContent-Length: %s\r\n\r\n' + 'Hello\r\nextra' % value) + resp = client.HTTPResponse(sock, method="GET") + resp.begin() + self.assertEqual(resp.length, 7) + self.assertEqual(resp.read(), b'Hello\r\n') + self.assertTrue(resp.isclosed()) + resp.close() + + def test_malformed_chunk_size(self): + # RFC 9112: chunk-size = 1*HEXDIG. Reject sizes that int(_, 16) accepts + # but the grammar forbids (a sign, an "0x" prefix, underscores or + # leading whitespace). + start = 'HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n' + for size in ('-5', '+5', '0x5', '1_f', ' 5'): + with self.subTest(size=size): + sock = FakeSocket(start + '%s\r\nHELLO\r\n0\r\n\r\n' % size) + resp = client.HTTPResponse(sock, method="GET") + resp.begin() + self.assertRaises(client.IncompleteRead, resp.read) + self.assertTrue(resp.isclosed()) + resp.close() + def test_incomplete_read(self): sock = FakeSocket('HTTP/1.1 200 OK\r\nContent-Length: 10\r\n\r\nHello\r\n') resp = client.HTTPResponse(sock, method="GET") Index: Python-3.10.22/Misc/NEWS.d/next/Library/2026-06-02-13-10-00.gh-issue-150751.Hk2Vw9.rst =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ Python-3.10.22/Misc/NEWS.d/next/Library/2026-06-02-13-10-00.gh-issue-150751.Hk2Vw9.rst 2026-11-23 13:25:11.655026189 +0100 @@ -0,0 +1,5 @@ +:mod:`http.client` now validates the ``Content-Length`` header and the +chunked ``chunk-size`` against the RFC 9112 grammar (``1*DIGIT`` and +``1*HEXDIG``) before parsing them, rejecting values such as ``+5``, ``5_0`` +or a ``0x``-prefixed or negative chunk size that :func:`int` would otherwise +accept. This avoids framing a response differently from a strict peer. ++++++ CVE-2026-114583-tarfile-reject-link-at-destination.patch ++++++ >From e7e0b3523ad6ba8472873dda594cf4021a16f8b5 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <[email protected]> Subject: [PATCH] gh-160097: Reject links replacing the destination in `tarfile.tar_filter` (GH-160098) Backported via https://github.com/python/cpython/pull/160343 ([3.11] backport). Reject link members whose name resolves to the destination directory itself for the 'tar' filter as well, matching the 'data' filter. Otherwise the destination is replaced by a link and subsequent members can be redirected through it. Index: Python-3.10.22/Doc/library/tarfile.rst =================================================================== --- Python-3.10.22.orig/Doc/library/tarfile.rst 2026-10-01 02:48:01.000000000 +0200 +++ Python-3.10.22/Doc/library/tarfile.rst 2026-11-23 18:35:36.990743602 +0100 @@ -957,6 +957,11 @@ - :ref:`Refuse <tarfile-extraction-refuse>` to extract files whose absolute path (after following symlinks) would end up outside the destination. This raises :class:`~tarfile.OutsideDestinationError`. + - :ref:`Refuse <tarfile-extraction-refuse>` to extract links (hard or soft) + whose name refers to the destination directory itself. + This raises :class:`~tarfile.OutsideDestinationError`. + Note that such files are refused even on platforms that do not support + symbolic links. - Clear high mode bits (setuid, setgid, sticky) and group/other write bits (:attr:`~stat.S_IWGRP`|:attr:`~stat.S_IWOTH`). Index: Python-3.10.22/Lib/tarfile.py =================================================================== --- Python-3.10.22.orig/Lib/tarfile.py 2026-11-20 17:10:53.967450201 +0100 +++ Python-3.10.22/Lib/tarfile.py 2026-11-23 18:35:36.991731554 +0100 @@ -787,6 +787,12 @@ strict=os.path.ALLOW_MISSING) if os.path.commonpath([target_path, dest_path]) != dest_path: raise OutsideDestinationError(member, target_path) + # A link member named after the destination directory itself + # would replace it with a (sym)link, redirecting the destination + # for all subsequent members. + if ((member.islnk() or member.issym()) + and os.path.normpath(name) == os.curdir): + raise OutsideDestinationError(member, target_path) # Limit permissions (no high bits, and go-w) mode = member.mode if mode is not None: @@ -822,11 +828,6 @@ if member.islnk() or member.issym(): if os.path.isabs(member.linkname): raise AbsoluteLinkError(member) - # A link member that resolves to the destination directory itself - # would replace it with a (sym)link, redirecting the destination - # for all subsequent members. - if target_path == dest_path: - raise OutsideDestinationError(member, target_path) normalized = os.path.normpath(member.linkname) if normalized != member.linkname: new_attrs['linkname'] = normalized Index: Python-3.10.22/Lib/test/test_tarfile.py =================================================================== --- Python-3.10.22.orig/Lib/test/test_tarfile.py 2026-11-20 17:10:55.886483920 +0100 +++ Python-3.10.22/Lib/test/test_tarfile.py 2026-11-23 18:35:36.994456598 +0100 @@ -3881,8 +3881,10 @@ t.linkname = '.' arc.tar_w.addfile(t) - with self.check_context(arc.open(), 'data'): - self.expect_exception(tarfile.OutsideDestinationError) + for filter in 'tar', 'data': + with self.subTest(name=name, filter=filter): + with self.check_context(arc.open(), filter): + self.expect_exception(tarfile.OutsideDestinationError) @os_helper.skip_unless_symlink def test_empty_name_symlink_chain(self): Index: Python-3.10.22/Misc/NEWS.d/next/Security/2026-10-21-19-58-53.gh-issue-160097.-opfAL.rst =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ Python-3.10.22/Misc/NEWS.d/next/Security/2026-10-21-19-58-53.gh-issue-160097.-opfAL.rst 2026-11-23 18:35:36.996149875 +0100 @@ -0,0 +1,5 @@ +.. cve: CVE-2026-114583 + +:func:`tarfile.tar_filter` now rejects link members whose path resolves to +the destination directory itself, as :func:`tarfile.data_filter` already +did. ++++++ CVE-2026-116566-getaddrinfo-null-bytes.patch ++++++ >From 2cd10854b42f3ebe44072a501d06241fc250e161 Mon Sep 17 00:00:00 2001 From: Seth Larson <[email protected]> Date: Thu, 29 Oct 2026 12:15:29 -0500 Subject: [PATCH] [3.11] gh-160898: Reject null bytes in `socket.getaddrinfo()` host and port (GH-160899) (cherry picked from commit 131a3a66c5f400b588f9fd2732a5ed4e89623ee3) (cherry picked from commit ee60d5db8f1668db57f3fc46b97ecf6cd0e251ac) (cherry picked from commit 589379e4f11e07c15269dfc00dae2bd648e2b4da) Co-authored-by: Seth Larson <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]> --- Doc/library/socket.rst | 3 ++ Lib/test/test_socket.py | 33 +++++++++++++++++++ ...-10-27-16-25-40.gh-issue-160898.epi53X.rst | 4 +++ Modules/socketmodule.c | 30 +++++++++++++---- 4 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 Misc/NEWS.d/next/Security/2026-10-27-16-25-40.gh-issue-160898.epi53X.rst Index: Python-3.10.22/Doc/library/socket.rst =================================================================== --- Python-3.10.22.orig/Doc/library/socket.rst 2026-11-20 15:35:44.272320295 +0100 +++ Python-3.10.22/Doc/library/socket.rst 2026-11-20 15:39:54.494694912 +0100 @@ -806,6 +806,9 @@ for IPv6 multicast addresses, string representing an address will not contain ``%scope_id`` part. + .. versionchanged:: next + Null characters are now rejected in the *host* and *port* parameters. + .. function:: getfqdn([name]) Return a fully qualified domain name for *name*. If *name* is omitted or empty, Index: Python-3.10.22/Lib/test/test_socket.py =================================================================== --- Python-3.10.22.orig/Lib/test/test_socket.py 2026-11-20 15:35:21.985930664 +0100 +++ Python-3.10.22/Lib/test/test_socket.py 2026-11-20 15:39:54.505695104 +0100 @@ -1858,6 +1858,39 @@ nameinfo = socket.getnameinfo(sockaddr, socket.NI_NUMERICHOST | socket.NI_NUMERICSERV) self.assertEqual(nameinfo, ('ff02::1de:c0:face:8d%' + str(ifindex), '1234')) + def test_getaddrinfo_null_bytes(self): + # getaddrinfo() must reject embedded null bytes instead of silently + # truncating the host or port at the C boundary. The checks run + # before any name resolution, so no network access is needed. + hosts = [ + # embedded + 'local\0host', b'local\0host', + # trailing + 'localhost\0', b'localhost\0', + # leading (truncates to '') + '\0localhost', b'\0localhost', + '\0', b'\0', + # non-ASCII, goes through IDNA + 'b\xfccher\0.example', + ] + for host in hosts: + with self.subTest(host=host): + with self.assertRaisesRegex(ValueError, 'host'): + socket.getaddrinfo(host, 80) + + ports = [ + '8\x000', + b'8\x000', + 'http\0', + b'http\0', + '\0', + b'\0' + ] + for port in ports: + with self.subTest(port=port): + with self.assertRaisesRegex(ValueError, 'port'): + socket.getaddrinfo("localhost", port) + def test_str_for_enums(self): # Make sure that the AF_* and SOCK_* constants have enum-like string # reprs. Index: Python-3.10.22/Misc/NEWS.d/next/Security/2026-10-27-16-25-40.gh-issue-160898.epi53X.rst =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ Python-3.10.22/Misc/NEWS.d/next/Security/2026-10-27-16-25-40.gh-issue-160898.epi53X.rst 2026-11-20 15:39:54.507695139 +0100 @@ -0,0 +1,4 @@ +.. cve: CVE-2026-116566 + +:func:`socket.getaddrinfo` now rejects null bytes within *host* and *port* +parameters as this previously caused the values to be silently truncated. Index: Python-3.10.22/Modules/socketmodule.c =================================================================== --- Python-3.10.22.orig/Modules/socketmodule.c 2026-10-01 02:48:01.000000000 +0200 +++ Python-3.10.22/Modules/socketmodule.c 2026-11-20 15:41:19.663183905 +0100 @@ -6445,8 +6445,9 @@ struct addrinfo *res0 = NULL; PyObject *hobj = NULL; PyObject *pobj = (PyObject *)NULL; - char pbuf[30]; + PyObject *pstr = NULL; const char *hptr, *pptr; + Py_ssize_t hlen = 0, plen = 0; int family, socktype, protocol, flags; int error; PyObject *all = (PyObject *)NULL; @@ -6467,31 +6468,46 @@ return NULL; assert(PyBytes_Check(idna)); hptr = PyBytes_AS_STRING(idna); + hlen = PyBytes_GET_SIZE(idna); } else if (PyBytes_Check(hobj)) { - hptr = PyBytes_AsString(hobj); + hptr = PyBytes_AS_STRING(hobj); + hlen = PyBytes_GET_SIZE(hobj); } else { PyErr_SetString(PyExc_TypeError, "getaddrinfo() argument 1 must be string or None"); return NULL; } + if (hptr != NULL && strlen(hptr) != (size_t)hlen) { + PyErr_SetString(PyExc_ValueError, + "getaddrinfo() host must not contain null characters"); + goto err; + } if (PyLong_CheckExact(pobj)) { - long value = PyLong_AsLong(pobj); - if (value == -1 && PyErr_Occurred()) + pstr = PyObject_Str(pobj); + if (pstr == NULL) + goto err; + assert(PyUnicode_Check(pstr)); + pptr = PyUnicode_AsUTF8AndSize(pstr, &plen); + if (pptr == NULL) goto err; - PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", value); - pptr = pbuf; } else if (PyUnicode_Check(pobj)) { - pptr = PyUnicode_AsUTF8(pobj); + pptr = PyUnicode_AsUTF8AndSize(pobj, &plen); if (pptr == NULL) goto err; } else if (PyBytes_Check(pobj)) { pptr = PyBytes_AS_STRING(pobj); + plen = PyBytes_GET_SIZE(pobj); } else if (pobj == Py_None) { pptr = (char *)NULL; } else { PyErr_SetString(PyExc_OSError, "Int or String expected"); goto err; } + if (pptr != NULL && strlen(pptr) != (size_t)plen) { + PyErr_SetString(PyExc_ValueError, + "getaddrinfo() port must not contain null characters"); + goto err; + } #if defined(__APPLE__) && defined(AI_NUMERICSERV) if ((flags & AI_NUMERICSERV) && (pptr == NULL || (pptr[0] == '0' && pptr[1] == 0))) { /* On OSX up to at least OSX 10.8 getaddrinfo crashes @@ -6504,7 +6520,7 @@ if (PySys_Audit("socket.getaddrinfo", "OOiii", hobj, pobj, family, socktype, protocol) < 0) { - return NULL; + goto err; } memset(&hints, 0, sizeof(hints)); @@ -6545,12 +6561,14 @@ Py_DECREF(single); } Py_XDECREF(idna); + Py_XDECREF(pstr); if (res0) freeaddrinfo(res0); return all; err: Py_XDECREF(all); Py_XDECREF(idna); + Py_XDECREF(pstr); if (res0) freeaddrinfo(res0); return (PyObject *)NULL; ++++++ CVE-2026-19553-validate-wrap_bio-parameters.patch ++++++ >From b327cd6457005d796a3e07f322a381d00b08f99a Mon Sep 17 00:00:00 2001 From: Seth Larson <[email protected]> Date: Wed, 30 Sep 2026 10:31:18 -0500 Subject: [PATCH] [3.10] gh-156793: Validate SSLContext.wrap_bio() parameters like wrap_socket() (GH-158503) (cherry picked from commit 1697ea386c707142555d98a1263176bbbc014a96) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Seth Larson <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]> --- Doc/library/asyncio-eventloop.rst | 4 + Doc/library/ssl.rst | 13 ++- Lib/ssl.py | 27 ++++-- Lib/test/test_asyncio/test_sslproto.py | 68 ++++++++++++++ Lib/test/test_ssl.py | 92 +++++++++++++++++++ ...-09-16-14-05-19.gh-issue-156793.Qa1T5Z.rst | 9 ++ ...-09-23-11-34-30.gh-issue-156793.zC_AjF.rst | 4 + 7 files changed, 207 insertions(+), 10 deletions(-) create mode 100644 Misc/NEWS.d/next/Security/2026-09-16-14-05-19.gh-issue-156793.Qa1T5Z.rst create mode 100644 Misc/NEWS.d/next/Security/2026-09-23-11-34-30.gh-issue-156793.zC_AjF.rst Index: Python-3.10.22/Doc/library/asyncio-eventloop.rst =================================================================== --- Python-3.10.22.orig/Doc/library/asyncio-eventloop.rst 2026-10-01 02:48:01.000000000 +0200 +++ Python-3.10.22/Doc/library/asyncio-eventloop.rst 2026-11-20 17:48:16.423822546 +0100 @@ -510,6 +510,10 @@ and ``server_hostname`` is not supplied. In Python 3.13 and later a ``ValueError`` is raised instead. + .. versionchanged:: next + Raises a ``ValueError`` if ``ssl.check_hostname`` is ``True`` + and ``server_hostname`` is not supplied. + .. seealso:: The :func:`open_connection` function is a high-level alternative Index: Python-3.10.22/Doc/library/ssl.rst =================================================================== --- Python-3.10.22.orig/Doc/library/ssl.rst 2026-10-01 02:48:01.000000000 +0200 +++ Python-3.10.22/Doc/library/ssl.rst 2026-11-20 17:51:00.294693847 +0100 @@ -1902,10 +1902,10 @@ The *server_side*, *server_hostname* and *session* parameters have the same meaning as in :meth:`SSLContext.wrap_socket`, and are validated in - the same way: in particular a :exc:`DeprecationWarning` is raised when + the same way: in particular a :exc:`ValueError` is raised when :attr:`~SSLContext.check_hostname` is enabled but no *server_hostname* is given, since there would be no name to match the peer's certificate - against. In Python 3.13 and later a ``ValueError`` is raised instead. + against. .. versionchanged:: 3.6 *session* argument was added. @@ -1921,6 +1921,11 @@ *server_hostname* was accepted, and verified the certificate chain but never the peer's identity. + .. versionchanged:: next + Raises a :exc:`ValueError` instead of :exc:`DeprecationWarning` if + :attr:`~SSLContext.check_hostname` is enabled and no *server_hostname* + is given. + .. attribute:: SSLContext.sslobject_class The return type of :meth:`SSLContext.wrap_bio`, defaults to Index: Python-3.10.22/Lib/ssl.py =================================================================== --- Python-3.10.22.orig/Lib/ssl.py 2026-11-20 17:10:53.929449533 +0100 +++ Python-3.10.22/Lib/ssl.py 2026-11-20 17:51:17.593996961 +0100 @@ -431,6 +431,20 @@ "subjectAltName fields were found") +def _check_sslobject_params(server_side, context=None, server_hostname=None, session=None): + """Raises a ValueError if SSLObject._create() parameters aren't valid. + """ + if server_side: + if server_hostname: + raise ValueError("server_hostname can only be specified " + "in client mode") + if session is not None: + raise ValueError("session can only be specified in " + "client mode") + if context.check_hostname and not server_hostname: + raise ValueError("check_hostname requires server_hostname") + + DefaultVerifyPaths = namedtuple("DefaultVerifyPaths", "cafile capath openssl_cafile_env openssl_cafile openssl_capath_env " "openssl_capath") @@ -862,18 +876,8 @@ @classmethod def _create(cls, incoming, outgoing, server_side=False, server_hostname=None, session=None, context=None): - if server_side: - if server_hostname: - raise ValueError("server_hostname can only be specified " - "in client mode") - if session is not None: - raise ValueError("session can only be specified in " - "client mode") - if context.check_hostname and server_hostname is None: - # Note: server_hostname='' is handled within _wrap_bio(). - warnings.warn("check_hostname requires server_hostname", - category=DeprecationWarning, - stacklevel=3) + _check_sslobject_params(server_side=server_side, context=context, + server_hostname=server_hostname, session=session) self = cls.__new__(cls) sslobj = context._wrap_bio( @@ -1030,15 +1034,8 @@ context=None, session=None): if sock.getsockopt(SOL_SOCKET, SO_TYPE) != SOCK_STREAM: raise NotImplementedError("only stream sockets are supported") - if server_side: - if server_hostname: - raise ValueError("server_hostname can only be specified " - "in client mode") - if session is not None: - raise ValueError("session can only be specified in " - "client mode") - if context.check_hostname and not server_hostname: - raise ValueError("check_hostname requires server_hostname") + _check_sslobject_params(server_side=server_side, context=context, + server_hostname=server_hostname, session=session) kwargs = dict( family=sock.family, type=sock.type, proto=sock.proto, Index: Python-3.10.22/Lib/test/test_asyncio/test_sslproto.py =================================================================== --- Python-3.10.22.orig/Lib/test/test_asyncio/test_sslproto.py 2026-11-20 17:10:54.505504496 +0100 +++ Python-3.10.22/Lib/test/test_asyncio/test_sslproto.py 2026-11-20 17:51:45.282482111 +0100 @@ -78,11 +78,15 @@ app_proto = mock.Mock() waiter = mock.Mock() - # No ValueError is raised from SSLProtocol with 'server_hostname'. + # On this branch wrap_bio() runs when the connection is made, not + # in the constructor, so drive that with a mock transport. ssl_proto = sslproto.SSLProtocol(self.loop, app_proto, sslcontext, waiter, server_hostname='example.org') - self.addCleanup(ssl_proto.connection_lost, None) - ssl_proto.connection_made(mock.Mock()) + self.addCleanup(ssl_proto._app_transport.close) + transport = mock.Mock() + ssl_proto.connection_made(transport) + transport._force_close.assert_not_called() + self.assertIsNotNone(ssl_proto._sslpipe.ssl_object) def test_check_hostname_requires_server_hostname(self): # A caller-supplied context asking for hostname checking used to be @@ -91,42 +95,50 @@ # loop.start_tls() defaults server_hostname to None, and # loop.create_connection() turns server_hostname='' into None here, # so both reached that state. - sslcontext = test_utils.simple_client_sslcontext(disable_verify=False) - sslcontext.check_hostname = True - app_proto = mock.Mock() - waiter = mock.Mock() - server_hostname = None - - # Supplying no server_hostname warns with check_hostname enabled. - with self.assertWarnsRegex( - DeprecationWarning, - 'check_hostname requires server_hostname'): - ssl_proto = sslproto.SSLProtocol( - self.loop, app_proto, sslcontext, waiter) - self.addCleanup(ssl_proto.connection_lost, None) - ssl_proto.connection_made(mock.Mock()) - - with self.assertWarnsRegex( - DeprecationWarning, - 'check_hostname requires server_hostname'): - ssl_proto = sslproto.SSLProtocol( - self.loop, app_proto, sslcontext, waiter, - server_hostname=server_hostname) - self.addCleanup(ssl_proto.connection_lost, None) - ssl_proto.connection_made(mock.Mock()) - - # Disabling check_hostname allows for an empty or unset server_hostname. - sslcontext.check_hostname = False - - ssl_proto = sslproto.SSLProtocol(self.loop, app_proto, sslcontext, waiter) - self.addCleanup(ssl_proto.connection_lost, None) - ssl_proto.connection_made(mock.Mock()) - - ssl_proto = sslproto.SSLProtocol(self.loop, app_proto, sslcontext, - waiter, - server_hostname=server_hostname) - self.addCleanup(ssl_proto.connection_lost, None) - ssl_proto.connection_made(mock.Mock()) + for server_hostname in (None, ''): + with self.subTest(server_hostname=server_hostname): + sslcontext = test_utils.simple_client_sslcontext(disable_verify=False) + sslcontext.check_hostname = True + app_proto = mock.Mock() + waiter = self.loop.create_future() + + # Supplying an empty server_hostname fails with check_hostname enabled. + # On this branch wrap_bio() runs when the connection is made, not in + # the constructor: the ValueError is reported as a fatal error that + # closes the transport. + ssl_proto = sslproto.SSLProtocol(self.loop, app_proto, sslcontext, + waiter, + server_hostname=server_hostname) + self.addCleanup(ssl_proto._app_transport.close) + transport = mock.Mock() + with test_utils.disable_logger(): + ssl_proto.connection_made(transport) + transport._force_close.assert_called_once() + exc = transport._force_close.call_args.args[0] + self.assertIsInstance(exc, ValueError) + self.assertRegex(str(exc), 'check_hostname requires server_hostname') + + # A real transport reports the close back to the protocol, which is + # how loop.create_connection() gets to see the error. + ssl_proto.connection_lost(exc) + with self.assertRaisesRegex( + ValueError, + 'check_hostname requires server_hostname'): + waiter.result() + + # Disabling check_hostname allows for an empty or unset server_hostname. + sslcontext.check_hostname = False + + for kwargs in ({}, {'server_hostname': server_hostname}): + with self.subTest(kwargs=kwargs): + waiter = mock.Mock() + ssl_proto = sslproto.SSLProtocol(self.loop, app_proto, sslcontext, + waiter, **kwargs) + self.addCleanup(ssl_proto._app_transport.close) + transport = mock.Mock() + ssl_proto.connection_made(transport) + transport._force_close.assert_not_called() + self.assertIsNotNone(ssl_proto._sslpipe.ssl_object) def test_eof_received_waiter(self): waiter = self.loop.create_future() Index: Python-3.10.22/Lib/test/test_ssl.py =================================================================== --- Python-3.10.22.orig/Lib/test/test_ssl.py 2026-11-20 17:46:24.130855258 +0100 +++ Python-3.10.22/Lib/test/test_ssl.py 2026-11-20 17:52:43.199496918 +0100 @@ -1922,7 +1922,7 @@ def test_bad_server_hostname(self): ctx = ssl.create_default_context() # Omitting the name entirely is bad too: this context checks it. - with self.assertWarns(DeprecationWarning): + with self.assertRaises(ValueError): ctx.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO(), server_hostname=None) with self.assertRaises(ValueError): @@ -2008,37 +2008,36 @@ def test_check_hostname_requires_server_hostname(self): # wrap_bio() used to accept a context asking for hostname checking # without a name to check against, and then verify the certificate - # chain but never the peer's identity without a warning. Now - # a warning is emitted in this scenario. + # chain but never the peer's identity, with check_hostname still + # reporting True and nothing reporting the check had been skipped. + # It must refuse that call, as wrap_socket() already did. client_context, _, hostname = testing_context() self.assertTrue(client_context.check_hostname) - server_hostname = None - with self.assertWarnsRegex( - DeprecationWarning, - "check_hostname requires server_hostname"): - client_context.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO(), - server_hostname=server_hostname) - # The sibling constructor refuses the very same call, but with - # a ValueError instead of DeprecationWarning. - with socket.socket() as sock: - with self.assertRaisesRegex( - ValueError, - "check_hostname requires server_hostname"): - client_context.wrap_socket( - sock, server_hostname=server_hostname) + for server_hostname in (None, ""): + with self.subTest(server_hostname=server_hostname): + with self.assertRaisesRegex( + ValueError, + "check_hostname requires server_hostname"): + client_context.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO(), + server_hostname=server_hostname) + # The sibling constructor refuses the very same call. + with socket.socket() as sock: + with self.assertRaisesRegex( + ValueError, + "check_hostname requires server_hostname"): + client_context.wrap_socket( + sock, server_hostname=server_hostname) # A name was all that was missing. - with warnings_helper.check_no_warnings(self): - client_context.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO(), - server_hostname=hostname) + client_context.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO(), + server_hostname=hostname) # Asking for no hostname check remains a way to say so explicitly. context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) context.check_hostname = False self.assertFalse(context.check_hostname) - with warnings_helper.check_no_warnings(self): - context.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO()) + context.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO()) def test_server_side_bad_params(self): # A server neither sends a hostname nor resumes a client's session, Index: Python-3.10.22/Misc/NEWS.d/next/Security/2026-09-16-14-05-19.gh-issue-156793.Qa1T5Z.rst =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ Python-3.10.22/Misc/NEWS.d/next/Security/2026-09-16-14-05-19.gh-issue-156793.Qa1T5Z.rst 2026-11-20 17:48:16.430791819 +0100 @@ -0,0 +1,9 @@ +:meth:`ssl.SSLContext.wrap_bio` now validates its *server_side*, +*server_hostname* and *session* arguments similar to +:meth:`ssl.SSLContext.wrap_socket`. + +In particular, a context with :attr:`~ssl.SSLContext.check_hostname` enabled +and no *server_hostname* passed to :meth:`!wrap_bio` now raises :exc:`ValueError` +instead of completing a handshake that verified the certificate chain +without verifying the peer's identity, with no indication that the +check had been skipped. Index: Python-3.10.22/Misc/NEWS.d/next/Security/2026-09-23-11-34-30.gh-issue-156793.zC_AjF.rst =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ Python-3.10.22/Misc/NEWS.d/next/Security/2026-09-23-11-34-30.gh-issue-156793.zC_AjF.rst 2026-11-20 17:48:16.431358499 +0100 @@ -0,0 +1,4 @@ +:mod:`asyncio`: :meth:`loop.start_tls() <asyncio.loop.start_tls>` and +:meth:`loop.create_connection() <asyncio.loop.create_connection>` now +validate the *server_hostname* argument if an :class:`ssl.SSLContext` is +passed with *check_hostname* set to ``True``. ++++++ _scmsync.obsinfo ++++++ --- /var/tmp/diff_new_pack.1QYOqI/_old 2026-11-25 16:14:13.529626949 +0100 +++ /var/tmp/diff_new_pack.1QYOqI/_new 2026-11-25 16:14:13.537627287 +0100 @@ -1,6 +1,6 @@ -mtime: 1794237305 -commit: fde74c86307c5936d62ae926ec7306121f0156bb8b65965c2688f89a8231b7dd +mtime: 1795456278 +commit: 1738bc9d9bfaa4e2d83086a00c650c7fa50dcf56180f2d43f3f208049eea47b5 url: https://src.opensuse.org/python-interpreters/python310 -revision: fde74c86307c5936d62ae926ec7306121f0156bb8b65965c2688f89a8231b7dd +revision: 1738bc9d9bfaa4e2d83086a00c650c7fa50dcf56180f2d43f3f208049eea47b5 projectscmsync: https://src.opensuse.org/python-interpreters/_ObsPrj ++++++ build.specials.obscpio ++++++ ++++++ build.specials.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.gitignore new/.gitignore --- old/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/.gitignore 2026-11-23 18:51:18.000000000 +0100 @@ -0,0 +1,7 @@ +.osc +*.obscpio +*.osc +_build.* +.pbuild +*.rej +python310*-build/
