public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python3.12] f44: Fixup for CVE-2026-19553
@ 2026-10-30  8:53 Charalampos Stratakis
  0 siblings, 0 replies; only message in thread
From: Charalampos Stratakis @ 2026-10-30  8:53 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/python3.12
Branch : f44
Commit : c2c61ecd5f10f4defa4343dc48af05e0723c10db
Author : Charalampos Stratakis <cstratak@redhat.com>
Date   : 2026-10-29T13:56:27+01:00
Stats  : +249/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/python3.12/c/c2c61ecd5f10f4defa4343dc48af05e0723c10db?branch=f44

Log:
Fixup for CVE-2026-19553

---
diff --git a/00499-fixup-for-cve-2026-19553.patch b/00499-fixup-for-cve-2026-19553.patch
new file mode 100644
index 0000000..7cd7580
--- /dev/null
+++ b/00499-fixup-for-cve-2026-19553.patch
@@ -0,0 +1,237 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Charalampos Stratakis <cstratak@redhat.com>
+Date: Thu, 29 Oct 2026 02:58:48 +0100
+Subject: 00499: Fixup for CVE-2026-19553
+
+It now raises ValueError instead of DeprecationWarning
+
+Downstream only, same upstream behavior on 3.13+
+---
+ Doc/library/asyncio-eventloop.rst      |  5 ++-
+ Doc/library/asyncio-stream.rst         |  5 ++-
+ Doc/library/ssl.rst                    |  4 +--
+ Lib/ssl.py                             | 40 +++++++++++-------------
+ Lib/test/test_asyncio/test_sslproto.py | 16 +++-------
+ Lib/test/test_ssl.py                   | 43 +++++++++++++-------------
+ 6 files changed, 50 insertions(+), 63 deletions(-)
+
+diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
+index caa137403e..7928fa6b69 100644
+--- a/Doc/library/asyncio-eventloop.rst
++++ b/Doc/library/asyncio-eventloop.rst
+@@ -545,9 +545,8 @@ Opening network connections
+       *all_errors* was added.
+ 
+    .. versionchanged:: 3.12.15
+-      Raises a ``DeprecationWarning`` if ``ssl.check_hostname`` is ``True``
+-      and ``server_hostname`` is not supplied. In Python 3.13 and
+-      later a ``ValueError`` is raised instead.
++      Raises a ``ValueError`` if ``ssl.check_hostname`` is ``True``
++      and ``server_hostname`` is not supplied.
+ 
+    .. seealso::
+ 
+diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst
+index 31b3951af3..47f75a9741 100644
+--- a/Doc/library/asyncio-stream.rst
++++ b/Doc/library/asyncio-stream.rst
+@@ -383,9 +383,8 @@ StreamWriter
+          Added the *ssl_shutdown_timeout* parameter.
+ 
+       .. versionchanged:: 3.12.15
+-         Raises a ``DeprecationWarning`` if ``ssl.check_hostname`` is ``True``
+-         and ``server_hostname`` is not supplied. In Python 3.13 and
+-         later a ``ValueError`` is raised instead.
++         Raises a ``ValueError`` if ``ssl.check_hostname`` is ``True``
++         and ``server_hostname`` is not supplied.
+ 
+ 
+    .. method:: is_closing()
+diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
+index 0dcbd5e3cd..72fb591f9a 100644
+--- a/Doc/library/ssl.rst
++++ b/Doc/library/ssl.rst
+@@ -1821,10 +1821,10 @@ to speed up repeated connections from the same clients.
+ 
+    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.
+diff --git a/Lib/ssl.py b/Lib/ssl.py
+index f243c1c406..393104c956 100644
+--- a/Lib/ssl.py
++++ b/Lib/ssl.py
+@@ -373,6 +373,20 @@ def _ipaddress_match(cert_ipaddress, host_ip):
+     return ip == host_ip
+ 
+ 
++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")
+@@ -803,19 +817,8 @@ def __init__(self, *args, **kwargs):
+     @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(
+             incoming, outgoing, server_side=server_side,
+@@ -971,15 +974,8 @@ def _create(cls, sock, server_side=False, do_handshake_on_connect=True,
+                 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)
+ 
+         sock_timeout = sock.gettimeout()
+         kwargs = dict(
+diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py
+index c8351e107e..f82075e103 100644
+--- a/Lib/test/test_asyncio/test_sslproto.py
++++ b/Lib/test/test_asyncio/test_sslproto.py
+@@ -82,7 +82,8 @@ def test_check_hostname_accepts_server_hostname(self):
+                              server_hostname='example.org')
+         self.addCleanup(ssl_proto._app_transport.close)
+ 
+-    def test_check_hostname_requires_server_hostname(self):
++    @support.subTests("server_hostname", [None, ''])
++    def test_check_hostname_requires_server_hostname(self, server_hostname):
+         # A caller-supplied context asking for hostname checking used to be
+         # taken through wrap_bio() with no name to check against, verifying
+         # the certificate chain but never the peer's identity.
+@@ -93,17 +94,10 @@ def test_check_hostname_requires_server_hostname(self):
+         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'):
+-            sslproto.SSLProtocol(self.loop, app_proto, sslcontext,
+-                                 waiter)
+-
+-        with self.assertWarnsRegex(
+-                DeprecationWarning,
++        # Supplying an empty server_hostname fails with check_hostname enabled.
++        with self.assertRaisesRegex(
++                ValueError,
+                 'check_hostname requires server_hostname'):
+             sslproto.SSLProtocol(self.loop, app_proto, sslcontext,
+                                  waiter,
+diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
+index 0f828ded52..0f955feb09 100644
+--- a/Lib/test/test_ssl.py
++++ b/Lib/test/test_ssl.py
+@@ -1737,7 +1737,7 @@ def test_subclass(self):
+     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):
+@@ -1827,37 +1827,36 @@ def test_private_init(self):
+     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,

diff --git a/python3.12.spec b/python3.12.spec
index 63646d9..b299eab 100644
--- a/python3.12.spec
+++ b/python3.12.spec
@@ -17,7 +17,7 @@ URL: https://www.python.org/
 #global prerel ...
 %global upstream_version %{general_version}%{?prerel}
 Version: %{general_version}%{?prerel:~%{prerel}}
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: Python-2.0.1
 
 
@@ -410,6 +410,14 @@ Patch475: 00475-cve-2025-15367.patch
 # It has started to fail randomly when run on s390x architecture.
 Patch494: 00494-increase-the-timeout-of-test_large_content_length_truncated.patch
 
+# 00499 # baa63364a364f89123f316beed8d81dda84555db
+# Fixup for CVE-2026-19553
+#
+# It now raises ValueError instead of DeprecationWarning
+#
+# Downstream only, same upstream behavior on 3.13+
+Patch499: 00499-fixup-for-cve-2026-19553.patch
+
 # (New patches go here ^^^)
 #
 # When adding new patches to "python" and "python3" in Fedora, EL, etc.,
@@ -1743,6 +1751,9 @@ CheckPython optimized
 # ======================================================
 
 %changelog
+* Thu Oct 29 2026 Charalampos Stratakis <cstratak@redhat.com> - 3.12.16-2
+- Fixup for CVE-2026-19553
+
 * Mon Oct 26 2026 Karolina Surma <ksurma@redhat.com> - 3.12.16-1
 - Update to Python 3.12.16
 - CVE 2026-114583: tar filter allows writing outside destination via empty-named symlink

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

only message in thread, other threads:[~2026-10-30  8:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30  8:53 [rpms/python3.12] f44: Fixup for CVE-2026-19553 Charalampos Stratakis

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