Compare commits

..

20 Commits

Author SHA1 Message Date
Eduard Abdullin
57b76f6e6f Add AlmaLinux to supported distros 2026-02-05 19:41:54 +00:00
Eduard Abdullin
abc701df16 Add AlmaLinux to supported distros 2026-02-02 08:09:44 +00:00
Eduard Abdullin
a71ef53091 Add AlmaLinux to supported distros 2025-08-26 08:47:05 +00:00
Eduard Abdullin
570ec9d800 Add AlmaLinux to supported distros 2025-07-01 21:58:30 +00:00
bd6971bee7 Merge branch 'c8' into a8 2024-12-05 15:53:51 +03:00
8d3d925919 Merge branch 'c8' into a8 2024-09-24 14:26:35 +03:00
bdbf48b9b5 Merge branch 'c8' into a8 2024-05-23 18:21:31 +03:00
f3cf09f99c Merge branch 'c8' into a8 2024-01-16 13:37:58 +03:00
17a8498e33 Merge tag 'imports/c8/python3-3.6.8-56.el8_9.2' into a8 2024-01-16 13:36:51 +03:00
9e83f4dfcf Merge branch 'c8' into a8 2023-11-17 10:29:27 +03:00
bd2db93423 Merge branch 'c8' into a8 2023-10-24 18:37:21 +00:00
c89b6ec208 Merge branch 'c8' into a8 2023-06-22 10:27:36 +00:00
eabdullin
18cf2f85c2 Merge branch 'c8' into a8 2023-05-17 02:59:04 +00:00
7b5facad40 Fix Release 2023-02-21 20:21:33 +00:00
eabdullin
5cfeb69b84 Merge branch 'c8' into a8 2023-02-21 08:47:54 +00:00
eabdullin
4d68a8f267 Merge branch 'c8' into a8 2022-11-08 14:38:53 +00:00
eabdullin
3b658081cd Merge branch 'c8' into a8 2022-09-13 09:52:58 +00:00
eabdullin
64c6635563 Merge branch 'c8' into a8 2022-05-10 11:35:50 +00:00
eabdullin
35ba6d59a5 Almalinux changes 2021-12-29 11:42:02 +03:00
3714d7eba9 AlmaLinux changes 2021-09-15 11:30:41 +00:00
3 changed files with 21 additions and 128 deletions

View File

@ -1,119 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Seth Michael Larson <seth@python.org>
Date: Fri, 31 Jan 2025 11:41:34 -0600
Subject: [PATCH] 00450: CVE-2025-0938: Disallow square brackets ([ and ]) in
domain names for parsed URLs
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
---
Lib/test/test_urlparse.py | 37 ++++++++++++++++++-
Lib/urllib/parse.py | 20 +++++++++-
...-01-28-14-08-03.gh-issue-105704.EnhHxu.rst | 4 ++
3 files changed, 58 insertions(+), 3 deletions(-)
create mode 100644 Misc/NEWS.d/next/Security/2025-01-28-14-08-03.gh-issue-105704.EnhHxu.rst
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py
index 090d2f17bf..8b2f5ca50f 100644
--- a/Lib/test/test_urlparse.py
+++ b/Lib/test/test_urlparse.py
@@ -1087,16 +1087,51 @@ class UrlParseTestCase(unittest.TestCase):
self.assertRaises(ValueError, urllib.parse.urlsplit, 'Scheme://user@[0439:23af::2309::fae7:1234]/Path?Query')
self.assertRaises(ValueError, urllib.parse.urlsplit, 'Scheme://user@[0439:23af:2309::fae7:1234:2342:438e:192.0.2.146]/Path?Query')
self.assertRaises(ValueError, urllib.parse.urlsplit, 'Scheme://user@]v6a.ip[/Path')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[v6a.ip]')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[v6a.ip].suffix')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[v6a.ip]/')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[v6a.ip].suffix/')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[v6a.ip]?')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[v6a.ip].suffix?')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]/')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix/')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]?')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix?')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:a')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix:a')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:a1')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix:a1')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:1a')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix:1a')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix:/')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:?')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://user@prefix.[v6a.ip]')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://user@[v6a.ip].suffix')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[v6a.ip')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://v6a.ip]')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://]v6a.ip[')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://]v6a.ip')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://v6a.ip[')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[v6a.ip')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://v6a.ip].suffix')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix]v6a.ip[suffix')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix]v6a.ip')
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://v6a.ip[suffix')
def test_splitting_bracketed_hosts(self):
- p1 = urllib.parse.urlsplit('scheme://user@[v6a.ip]/path?query')
+ p1 = urllib.parse.urlsplit('scheme://user@[v6a.ip]:1234/path?query')
self.assertEqual(p1.hostname, 'v6a.ip')
self.assertEqual(p1.username, 'user')
self.assertEqual(p1.path, '/path')
+ self.assertEqual(p1.port, 1234)
p2 = urllib.parse.urlsplit('scheme://user@[0439:23af:2309::fae7]/path?query')
self.assertEqual(p2.hostname, '0439:23af:2309::fae7')
self.assertEqual(p2.username, 'user')
self.assertEqual(p2.path, '/path')
+ self.assertIs(p2.port, None)
p3 = urllib.parse.urlsplit('scheme://user@[0439:23af:2309::fae7:1234:192.0.2.146]/path?query')
self.assertEqual(p3.hostname, '0439:23af:2309::fae7:1234:192.0.2.146')
self.assertEqual(p3.username, 'user')
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
index bf186b7984..af41edf2ca 100644
--- a/Lib/urllib/parse.py
+++ b/Lib/urllib/parse.py
@@ -426,6 +426,23 @@ def _remove_unsafe_bytes_from_url(url):
url = url.replace(b, "")
return url
+def _check_bracketed_netloc(netloc):
+ # Note that this function must mirror the splitting
+ # done in NetlocResultMixins._hostinfo().
+ hostname_and_port = netloc.rpartition('@')[2]
+ before_bracket, have_open_br, bracketed = hostname_and_port.partition('[')
+ if have_open_br:
+ # No data is allowed before a bracket.
+ if before_bracket:
+ raise ValueError("Invalid IPv6 URL")
+ hostname, _, port = bracketed.partition(']')
+ # No data is allowed after the bracket but before the port delimiter.
+ if port and not port.startswith(":"):
+ raise ValueError("Invalid IPv6 URL")
+ else:
+ hostname, _, port = hostname_and_port.partition(':')
+ _check_bracketed_host(hostname)
+
# Valid bracketed hosts are defined in
# https://www.rfc-editor.org/rfc/rfc3986#page-49 and https://url.spec.whatwg.org/
def _check_bracketed_host(hostname):
@@ -493,8 +510,7 @@ def urlsplit(url, scheme='', allow_fragments=True):
(']' in netloc and '[' not in netloc)):
raise ValueError("Invalid IPv6 URL")
if '[' in netloc and ']' in netloc:
- bracketed_host = netloc.partition('[')[2].partition(']')[0]
- _check_bracketed_host(bracketed_host)
+ _check_bracketed_netloc(netloc)
if allow_fragments and '#' in url:
url, fragment = url.split('#', 1)
if '?' in url:
diff --git a/Misc/NEWS.d/next/Security/2025-01-28-14-08-03.gh-issue-105704.EnhHxu.rst b/Misc/NEWS.d/next/Security/2025-01-28-14-08-03.gh-issue-105704.EnhHxu.rst
new file mode 100644
index 0000000000..bff1bc6b0d
--- /dev/null
+++ b/Misc/NEWS.d/next/Security/2025-01-28-14-08-03.gh-issue-105704.EnhHxu.rst
@@ -0,0 +1,4 @@
+When using :func:`urllib.parse.urlsplit` and :func:`urllib.parse.urlparse` host
+parsing would not reject domain names containing square brackets (``[`` and
+``]``). Square brackets are only valid for IPv6 and IPvFuture hosts according to
+`RFC 3986 Section 3.2.2 <https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2>`__.

View File

@ -0,0 +1,12 @@
diff -Naur Python-3.6.8.orig/Lib/platform.py Python-3.6.8.almalinux/Lib/platform.py
--- Python-3.6.8.orig/Lib/platform.py 2018-12-24 00:37:14.000000000 +0300
+++ Python-3.6.8.almalinux/Lib/platform.py 2021-03-09 11:46:50.252385459 +0300
@@ -297,7 +297,7 @@
# and http://www.die.net/doc/linux/man/man1/lsb_release.1.html
_supported_dists = (
- 'SuSE', 'debian', 'fedora', 'redhat', 'centos',
+ 'SuSE', 'debian', 'fedora', 'redhat', 'centos', 'almalinux',
'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo',
'UnitedLinux', 'turbolinux', 'arch', 'mageia')

View File

@ -14,7 +14,7 @@ URL: https://www.python.org/
# WARNING When rebasing to a new Python version, # WARNING When rebasing to a new Python version,
# remember to update the python3-docs package as well # remember to update the python3-docs package as well
Version: %{pybasever}.8 Version: %{pybasever}.8
Release: 74%{?dist} Release: 73%{?dist}.alma.1
License: Python License: Python
@ -918,10 +918,6 @@ Patch443: 00443-gh-124651-quote-template-strings-in-venv-activation-scripts.patc
# Tests are adjusted because Python <3.9 don't support scoped IPv6 addresses. # Tests are adjusted because Python <3.9 don't support scoped IPv6 addresses.
Patch444: 00444-security-fix-for-cve-2024-11168.patch Patch444: 00444-security-fix-for-cve-2024-11168.patch
# 00450 # 31aa7c11975e890489e31d8b293c3f92d3ea1180
# CVE-2025-0938: Disallow square brackets ([ and ]) in domain names for parsed URLs
Patch450: 00450-cve-2025-0938-disallow-square-brackets-and-in-domain-names-for-parsed-urls.patch
# 00465 # # 00465 #
# Security fixes for CVE-2025-4517, CVE-2025-4330, CVE-2025-4138, CVE-2024-12718, CVE-2025-4435 on tarfile # Security fixes for CVE-2025-4517, CVE-2025-4330, CVE-2025-4138, CVE-2024-12718, CVE-2025-4435 on tarfile
# #
@ -992,6 +988,9 @@ Patch475: 00475-cve-2025-15367.patch
# (cherry-picked from commit 45b2f8893c1b7ab3b3981a966f82e42beea82106) # (cherry-picked from commit 45b2f8893c1b7ab3b3981a966f82e42beea82106)
Patch476: 00476-cve-2026-1299.patch Patch476: 00476-cve-2026-1299.patch
# AlmaLinux Patch
Patch1000: python-3.6-almalinux_support.patch
# (New patches go here ^^^) # (New patches go here ^^^)
# #
# When adding new patches to "python" and "python3" in Fedora, EL, etc., # When adding new patches to "python" and "python3" in Fedora, EL, etc.,
@ -1361,7 +1360,6 @@ GIT_DIR=$PWD git apply %{PATCH351}
%patch437 -p1 %patch437 -p1
%patch443 -p1 %patch443 -p1
%patch444 -p1 %patch444 -p1
%patch450 -p1
%patch465 -p1 %patch465 -p1
%patch467 -p1 %patch467 -p1
%patch471 -p1 %patch471 -p1
@ -1370,6 +1368,9 @@ GIT_DIR=$PWD git apply %{PATCH351}
%patch475 -p1 %patch475 -p1
%patch476 -p1 %patch476 -p1
# Applying AlmaLinux Patch
%patch1000 -p1 -b .python-36-almalinux_support
# Remove files that should be generated by the build # Remove files that should be generated by the build
# (This is after patching, so that we can use patches directly from upstream) # (This is after patching, so that we can use patches directly from upstream)
rm configure pyconfig.h.in rm configure pyconfig.h.in
@ -2300,9 +2301,8 @@ fi
# ====================================================== # ======================================================
%changelog %changelog
* Fri Mar 06 2026 Lumír Balhar <lbalhar@redhat.com> - 3.6.8-74 * Thu Feb 05 2026 Eduard Abdullin <eabdullin@almalinux.org> - 3.6.8-73.alma.1
- Security fix for CVE-2025-0938 - Add AlmaLinux to supported distros
Resolves: RHEL-153235
* Thu Jan 29 2026 Lumír Balhar <lbalhar@redhat.com> - 3.6.8-73 * Thu Jan 29 2026 Lumír Balhar <lbalhar@redhat.com> - 3.6.8-73
- Security fixes for CVE-2026-0865, CVE-2025-15366, CVE-2025-15367, CVE-2026-1299 - Security fixes for CVE-2026-0865, CVE-2025-15366, CVE-2025-15367, CVE-2026-1299