diff options
author | Peter Marko <peter.marko@siemens.com> | 2025-06-08 23:43:47 +0200 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2025-06-13 08:42:35 -0700 |
commit | 8cd040c21873bbba5008c725a8eb412b128b7f6a (patch) | |
tree | 9512b7d7da865b982b3e29bfaf86a1201c1ee150 | |
parent | 57421fdde6b8202f64ff0bdf911e56398fc07853 (diff) | |
download | poky-8cd040c21873bbba5008c725a8eb412b128b7f6a.tar.gz |
python3: upgrade 3.10.16 -> 3.10.18
Drop upstreamed patch and refresh remaining patches.
* https://www.python.org/downloads/release/python-31017/
Security content in this release
* gh-131809: Upgrade vendored expat to 2.7.1
* gh-80222: Folding of quoted string in display_name violates RFC
* gh-121284: Invalid RFC 2047 address header after refolding with
email.policy.default
* gh-131261: Update libexpat to 2.7.0
* gh-105704: CVE-2025-0938 urlparse does not flag hostname containing
[ or ] as incorrect
* gh-119511: OOM vulnerability in the imaplib module
* https://www.python.org/downloads/release/python-31018/
Security content in this release
* gh-135034: [CVE 2024-12718] [CVE 2025-4138] [CVE 2025-4330]
[CVE 2025-4435] [CVE 2025-4517] Fixes multiple issues that allowed
tarfile extraction filters (filter="data" and filter="tar") to be
bypassed using crafted symlinks and hard links.
* gh-133767: Fix use-after-free in the “unicode-escape” decoder with a
non-“strict” error handler.
* gh-128840: Short-circuit the processing of long IPv6 addresses early
in ipaddress to prevent excessive memory consumption and a minor
denial-of-service.
gh-133767 got meawhile CVE-2025-4516 assigned.
(From OE-Core rev: 838a8b5ca148dfa6c6c2c76f1705d1e358a31648)
Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
14 files changed, 23 insertions, 155 deletions
diff --git a/meta/recipes-devtools/python/python3/0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch b/meta/recipes-devtools/python/python3/0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch index 62ef6efc28..47637d24d8 100644 --- a/meta/recipes-devtools/python/python3/0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch +++ b/meta/recipes-devtools/python/python3/0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch | |||
@@ -15,7 +15,7 @@ diff --git a/setup.py b/setup.py | |||
15 | index 43e807f..11b5cf5 100644 | 15 | index 43e807f..11b5cf5 100644 |
16 | --- a/setup.py | 16 | --- a/setup.py |
17 | +++ b/setup.py | 17 | +++ b/setup.py |
18 | @@ -1149,7 +1149,6 @@ class PyBuildExt(build_ext): | 18 | @@ -1153,7 +1153,6 @@ class PyBuildExt(build_ext): |
19 | 'termcap'): | 19 | 'termcap'): |
20 | readline_libs.append('termcap') | 20 | readline_libs.append('termcap') |
21 | self.add(Extension('readline', ['readline.c'], | 21 | self.add(Extension('readline', ['readline.c'], |
diff --git a/meta/recipes-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch b/meta/recipes-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch index d98f243cb1..c74a1c58a1 100644 --- a/meta/recipes-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch +++ b/meta/recipes-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch | |||
@@ -18,7 +18,7 @@ diff --git a/Makefile.pre.in b/Makefile.pre.in | |||
18 | index ee85f35..f0aedb7 100644 | 18 | index ee85f35..f0aedb7 100644 |
19 | --- a/Makefile.pre.in | 19 | --- a/Makefile.pre.in |
20 | +++ b/Makefile.pre.in | 20 | +++ b/Makefile.pre.in |
21 | @@ -1640,12 +1640,9 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh | 21 | @@ -1641,12 +1641,9 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh |
22 | sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py | 22 | sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py |
23 | @ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} | 23 | @ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} |
24 | LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config | 24 | LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config |
diff --git a/meta/recipes-devtools/python/python3/0001-Makefile-do-not-compile-.pyc-in-parallel.patch b/meta/recipes-devtools/python/python3/0001-Makefile-do-not-compile-.pyc-in-parallel.patch index 2f037ecb09..88ba84d64d 100644 --- a/meta/recipes-devtools/python/python3/0001-Makefile-do-not-compile-.pyc-in-parallel.patch +++ b/meta/recipes-devtools/python/python3/0001-Makefile-do-not-compile-.pyc-in-parallel.patch | |||
@@ -26,7 +26,7 @@ diff --git a/Makefile.pre.in b/Makefile.pre.in | |||
26 | index edd70d4..5e13ba2 100644 | 26 | index edd70d4..5e13ba2 100644 |
27 | --- a/Makefile.pre.in | 27 | --- a/Makefile.pre.in |
28 | +++ b/Makefile.pre.in | 28 | +++ b/Makefile.pre.in |
29 | @@ -1601,30 +1601,30 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c | 29 | @@ -1602,30 +1602,30 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c |
30 | fi | 30 | fi |
31 | -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ | 31 | -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ |
32 | $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ | 32 | $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ |
diff --git a/meta/recipes-devtools/python/python3/0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch b/meta/recipes-devtools/python/python3/0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch index 96c5a3c840..07ab4ed540 100644 --- a/meta/recipes-devtools/python/python3/0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch +++ b/meta/recipes-devtools/python/python3/0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch | |||
@@ -20,7 +20,7 @@ diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing. | |||
20 | index 3bc5b8f..a6e106d 100644 | 20 | index 3bc5b8f..a6e106d 100644 |
21 | --- a/Lib/test/_test_multiprocessing.py | 21 | --- a/Lib/test/_test_multiprocessing.py |
22 | +++ b/Lib/test/_test_multiprocessing.py | 22 | +++ b/Lib/test/_test_multiprocessing.py |
23 | @@ -568,6 +568,7 @@ class _TestProcess(BaseTestCase): | 23 | @@ -575,6 +575,7 @@ class _TestProcess(BaseTestCase): |
24 | 24 | ||
25 | close_queue(q) | 25 | close_queue(q) |
26 | 26 | ||
@@ -28,7 +28,7 @@ index 3bc5b8f..a6e106d 100644 | |||
28 | def test_many_processes(self): | 28 | def test_many_processes(self): |
29 | if self.TYPE == 'threads': | 29 | if self.TYPE == 'threads': |
30 | self.skipTest('test not appropriate for {}'.format(self.TYPE)) | 30 | self.skipTest('test not appropriate for {}'.format(self.TYPE)) |
31 | @@ -4817,6 +4818,7 @@ class TestWait(unittest.TestCase): | 31 | @@ -4829,6 +4830,7 @@ class TestWait(unittest.TestCase): |
32 | sem.release() | 32 | sem.release() |
33 | time.sleep(period) | 33 | time.sleep(period) |
34 | 34 | ||
@@ -40,7 +40,7 @@ diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py | |||
40 | index 875615a..aebaa8c 100644 | 40 | index 875615a..aebaa8c 100644 |
41 | --- a/Lib/test/test_time.py | 41 | --- a/Lib/test/test_time.py |
42 | +++ b/Lib/test/test_time.py | 42 | +++ b/Lib/test/test_time.py |
43 | @@ -474,6 +474,7 @@ class TimeTestCase(unittest.TestCase): | 43 | @@ -475,6 +475,7 @@ class TimeTestCase(unittest.TestCase): |
44 | def test_perf_counter(self): | 44 | def test_perf_counter(self): |
45 | time.perf_counter() | 45 | time.perf_counter() |
46 | 46 | ||
diff --git a/meta/recipes-devtools/python/python3/0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch b/meta/recipes-devtools/python/python3/0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch index 88b84c6024..e6d7778ccd 100644 --- a/meta/recipes-devtools/python/python3/0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch +++ b/meta/recipes-devtools/python/python3/0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch | |||
@@ -16,7 +16,7 @@ diff --git a/Lib/tarfile.py b/Lib/tarfile.py | |||
16 | index 3bbbcaa..473167d 100755 | 16 | index 3bbbcaa..473167d 100755 |
17 | --- a/Lib/tarfile.py | 17 | --- a/Lib/tarfile.py |
18 | +++ b/Lib/tarfile.py | 18 | +++ b/Lib/tarfile.py |
19 | @@ -2557,7 +2557,8 @@ class TarFile(object): | 19 | @@ -2675,7 +2675,8 @@ class TarFile(object): |
20 | os.lchown(targetpath, u, g) | 20 | os.lchown(targetpath, u, g) |
21 | else: | 21 | else: |
22 | os.chown(targetpath, u, g) | 22 | os.chown(targetpath, u, g) |
diff --git a/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch b/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch index 6bb85fcb34..49c918b3b0 100644 --- a/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch +++ b/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch | |||
@@ -47,7 +47,7 @@ index 0c06914..299786b 100644 | |||
47 | gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;; | 47 | gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;; |
48 | cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;; | 48 | cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;; |
49 | clang|*/clang) AC_PATH_TOOL(CXX, [clang++], [clang++], [notfound]) ;; | 49 | clang|*/clang) AC_PATH_TOOL(CXX, [clang++], [clang++], [notfound]) ;; |
50 | @@ -976,7 +977,7 @@ rmdir CaseSensitiveTestDir | 50 | @@ -981,7 +982,7 @@ rmdir CaseSensitiveTestDir |
51 | 51 | ||
52 | case $ac_sys_system in | 52 | case $ac_sys_system in |
53 | hp*|HP*) | 53 | hp*|HP*) |
@@ -56,7 +56,7 @@ index 0c06914..299786b 100644 | |||
56 | cc|*/cc) CC="$CC -Ae";; | 56 | cc|*/cc) CC="$CC -Ae";; |
57 | esac;; | 57 | esac;; |
58 | esac | 58 | esac |
59 | @@ -1374,7 +1375,7 @@ else | 59 | @@ -1379,7 +1380,7 @@ else |
60 | fi], | 60 | fi], |
61 | [AC_MSG_RESULT(no)]) | 61 | [AC_MSG_RESULT(no)]) |
62 | if test "$Py_LTO" = 'true' ; then | 62 | if test "$Py_LTO" = 'true' ; then |
@@ -65,7 +65,7 @@ index 0c06914..299786b 100644 | |||
65 | *clang*) | 65 | *clang*) |
66 | AC_SUBST(LLVM_AR) | 66 | AC_SUBST(LLVM_AR) |
67 | AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path}) | 67 | AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path}) |
68 | @@ -1467,7 +1468,7 @@ then | 68 | @@ -1472,7 +1473,7 @@ then |
69 | fi | 69 | fi |
70 | fi | 70 | fi |
71 | LLVM_PROF_ERR=no | 71 | LLVM_PROF_ERR=no |
@@ -74,7 +74,7 @@ index 0c06914..299786b 100644 | |||
74 | *clang*) | 74 | *clang*) |
75 | # Any changes made here should be reflected in the GCC+Darwin case below | 75 | # Any changes made here should be reflected in the GCC+Darwin case below |
76 | PGO_PROF_GEN_FLAG="-fprofile-instr-generate" | 76 | PGO_PROF_GEN_FLAG="-fprofile-instr-generate" |
77 | @@ -1528,7 +1529,7 @@ esac | 77 | @@ -1533,7 +1534,7 @@ esac |
78 | # compiler and platform. BASECFLAGS tweaks need to be made even if the | 78 | # compiler and platform. BASECFLAGS tweaks need to be made even if the |
79 | # user set OPT. | 79 | # user set OPT. |
80 | 80 | ||
@@ -83,7 +83,7 @@ index 0c06914..299786b 100644 | |||
83 | *clang*) | 83 | *clang*) |
84 | cc_is_clang=1 | 84 | cc_is_clang=1 |
85 | ;; | 85 | ;; |
86 | @@ -1664,7 +1665,7 @@ yes) | 86 | @@ -1669,7 +1670,7 @@ yes) |
87 | 87 | ||
88 | # ICC doesn't recognize the option, but only emits a warning | 88 | # ICC doesn't recognize the option, but only emits a warning |
89 | ## XXX does it emit an unused result warning and can it be disabled? | 89 | ## XXX does it emit an unused result warning and can it be disabled? |
@@ -92,7 +92,7 @@ index 0c06914..299786b 100644 | |||
92 | *icc*) | 92 | *icc*) |
93 | ac_cv_disable_unused_result_warning=no | 93 | ac_cv_disable_unused_result_warning=no |
94 | ;; | 94 | ;; |
95 | @@ -2018,7 +2019,7 @@ yes) | 95 | @@ -2023,7 +2024,7 @@ yes) |
96 | ;; | 96 | ;; |
97 | esac | 97 | esac |
98 | 98 | ||
@@ -101,7 +101,7 @@ index 0c06914..299786b 100644 | |||
101 | *icc*) | 101 | *icc*) |
102 | # ICC needs -fp-model strict or floats behave badly | 102 | # ICC needs -fp-model strict or floats behave badly |
103 | CFLAGS_NODIST="$CFLAGS_NODIST -fp-model strict" | 103 | CFLAGS_NODIST="$CFLAGS_NODIST -fp-model strict" |
104 | @@ -2836,7 +2837,7 @@ then | 104 | @@ -2841,7 +2842,7 @@ then |
105 | then | 105 | then |
106 | LINKFORSHARED="-Wl,--export-dynamic" | 106 | LINKFORSHARED="-Wl,--export-dynamic" |
107 | fi;; | 107 | fi;; |
@@ -110,7 +110,7 @@ index 0c06914..299786b 100644 | |||
110 | *gcc*) | 110 | *gcc*) |
111 | if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null | 111 | if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null |
112 | then | 112 | then |
113 | @@ -5622,7 +5623,7 @@ if test "$have_gcc_asm_for_x87" = yes; then | 113 | @@ -5628,7 +5629,7 @@ if test "$have_gcc_asm_for_x87" = yes; then |
114 | # Some versions of gcc miscompile inline asm: | 114 | # Some versions of gcc miscompile inline asm: |
115 | # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491 | 115 | # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491 |
116 | # http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html | 116 | # http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html |
diff --git a/meta/recipes-devtools/python/python3/0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch b/meta/recipes-devtools/python/python3/0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch index 1844e0efa3..0e243325c7 100644 --- a/meta/recipes-devtools/python/python3/0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch +++ b/meta/recipes-devtools/python/python3/0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch | |||
@@ -27,7 +27,7 @@ diff --git a/setup.py b/setup.py | |||
27 | index 2e7f263..f7a3d39 100644 | 27 | index 2e7f263..f7a3d39 100644 |
28 | --- a/setup.py | 28 | --- a/setup.py |
29 | +++ b/setup.py | 29 | +++ b/setup.py |
30 | @@ -840,7 +840,8 @@ class PyBuildExt(build_ext): | 30 | @@ -839,7 +839,8 @@ class PyBuildExt(build_ext): |
31 | # only change this for cross builds for 3.3, issues on Mageia | 31 | # only change this for cross builds for 3.3, issues on Mageia |
32 | if CROSS_COMPILING: | 32 | if CROSS_COMPILING: |
33 | self.add_cross_compiling_paths() | 33 | self.add_cross_compiling_paths() |
diff --git a/meta/recipes-devtools/python/python3/0001-test_storlines-skip-due-to-load-variability.patch b/meta/recipes-devtools/python/python3/0001-test_storlines-skip-due-to-load-variability.patch index 199031d42a..20d125963f 100644 --- a/meta/recipes-devtools/python/python3/0001-test_storlines-skip-due-to-load-variability.patch +++ b/meta/recipes-devtools/python/python3/0001-test_storlines-skip-due-to-load-variability.patch | |||
@@ -19,7 +19,7 @@ diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py | |||
19 | index 082a90d46b..508814d56a 100644 | 19 | index 082a90d46b..508814d56a 100644 |
20 | --- a/Lib/test/test_ftplib.py | 20 | --- a/Lib/test/test_ftplib.py |
21 | +++ b/Lib/test/test_ftplib.py | 21 | +++ b/Lib/test/test_ftplib.py |
22 | @@ -629,6 +629,7 @@ def test_storbinary_rest(self): | 22 | @@ -629,6 +629,7 @@ class TestFTPClass(TestCase): |
23 | self.client.storbinary('stor', f, rest=r) | 23 | self.client.storbinary('stor', f, rest=r) |
24 | self.assertEqual(self.server.handler_instance.rest, str(r)) | 24 | self.assertEqual(self.server.handler_instance.rest, str(r)) |
25 | 25 | ||
diff --git a/meta/recipes-devtools/python/python3/0017-setup.py-do-not-report-missing-dependencies-for-disa.patch b/meta/recipes-devtools/python/python3/0017-setup.py-do-not-report-missing-dependencies-for-disa.patch index 8c554feb4b..025239df1d 100644 --- a/meta/recipes-devtools/python/python3/0017-setup.py-do-not-report-missing-dependencies-for-disa.patch +++ b/meta/recipes-devtools/python/python3/0017-setup.py-do-not-report-missing-dependencies-for-disa.patch | |||
@@ -23,7 +23,7 @@ diff --git a/setup.py b/setup.py | |||
23 | index 85a2b26357..7605347bf5 100644 | 23 | index 85a2b26357..7605347bf5 100644 |
24 | --- a/setup.py | 24 | --- a/setup.py |
25 | +++ b/setup.py | 25 | +++ b/setup.py |
26 | @@ -517,6 +517,14 @@ def print_three_column(lst): | 26 | @@ -517,6 +517,14 @@ class PyBuildExt(build_ext): |
27 | print("%-*s %-*s %-*s" % (longest, e, longest, f, | 27 | print("%-*s %-*s %-*s" % (longest, e, longest, f, |
28 | longest, g)) | 28 | longest, g)) |
29 | 29 | ||
diff --git a/meta/recipes-devtools/python/python3/0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch b/meta/recipes-devtools/python/python3/0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch index 30d2906439..78295e6791 100644 --- a/meta/recipes-devtools/python/python3/0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch +++ b/meta/recipes-devtools/python/python3/0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch | |||
@@ -21,7 +21,7 @@ diff --git a/configure.ac b/configure.ac | |||
21 | index e5e3df8..bfdd987 100644 | 21 | index e5e3df8..bfdd987 100644 |
22 | --- a/configure.ac | 22 | --- a/configure.ac |
23 | +++ b/configure.ac | 23 | +++ b/configure.ac |
24 | @@ -5092,12 +5092,6 @@ then | 24 | @@ -5097,12 +5097,6 @@ then |
25 | [Define if you have struct stat.st_mtimensec]) | 25 | [Define if you have struct stat.st_mtimensec]) |
26 | fi | 26 | fi |
27 | 27 | ||
@@ -38,7 +38,7 @@ diff --git a/setup.py b/setup.py | |||
38 | index 62f0e18..c190002 100644 | 38 | index 62f0e18..c190002 100644 |
39 | --- a/setup.py | 39 | --- a/setup.py |
40 | +++ b/setup.py | 40 | +++ b/setup.py |
41 | @@ -1169,8 +1169,6 @@ class PyBuildExt(build_ext): | 41 | @@ -1173,8 +1173,6 @@ class PyBuildExt(build_ext): |
42 | panel_library = 'panel' | 42 | panel_library = 'panel' |
43 | if curses_library == 'ncursesw': | 43 | if curses_library == 'ncursesw': |
44 | curses_defines.append(('HAVE_NCURSESW', '1')) | 44 | curses_defines.append(('HAVE_NCURSESW', '1')) |
diff --git a/meta/recipes-devtools/python/python3/CVE-2025-0938.patch b/meta/recipes-devtools/python/python3/CVE-2025-0938.patch deleted file mode 100644 index 5730008f4b..0000000000 --- a/meta/recipes-devtools/python/python3/CVE-2025-0938.patch +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | From b8b4b713c5f8ec0958c7ef8d29d6711889bc94ab Mon Sep 17 00:00:00 2001 | ||
2 | From: "Miss Islington (bot)" | ||
3 | <31488909+miss-islington@users.noreply.github.com> | ||
4 | Date: Wed, 19 Feb 2025 14:36:23 +0100 | ||
5 | Subject: [PATCH] [3.10] gh-105704: Disallow square brackets (`[` and `]`) in | ||
6 | domain names for parsed URLs (GH-129418) (#129529) | ||
7 | MIME-Version: 1.0 | ||
8 | Content-Type: text/plain; charset=UTF-8 | ||
9 | Content-Transfer-Encoding: 8bit | ||
10 | |||
11 | (cherry picked from commit d89a5f6a6e65511a5f6e0618c4c30a7aa5aba56a) | ||
12 | |||
13 | Co-authored-by: Seth Michael Larson <seth@python.org> | ||
14 | Co-authored-by: Peter Bierma <zintensitydev@gmail.com> | ||
15 | Co-authored-by: Łukasz Langa <lukasz@langa.pl> | ||
16 | |||
17 | CVE: CVE-2025-0938 | ||
18 | Upstream-Status: Backport [https://github.com/python/cpython/commit/b8b4b713c5f8ec0958c7ef8d29d6711889bc94ab] | ||
19 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
20 | --- | ||
21 | Lib/test/test_urlparse.py | 37 ++++++++++++++++++- | ||
22 | Lib/urllib/parse.py | 20 +++++++++- | ||
23 | ...-01-28-14-08-03.gh-issue-105704.EnhHxu.rst | 4 ++ | ||
24 | 3 files changed, 58 insertions(+), 3 deletions(-) | ||
25 | create mode 100644 Misc/NEWS.d/next/Security/2025-01-28-14-08-03.gh-issue-105704.EnhHxu.rst | ||
26 | |||
27 | diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py | ||
28 | index f2ffc452e5..280644ef0b 100644 | ||
29 | --- a/Lib/test/test_urlparse.py | ||
30 | +++ b/Lib/test/test_urlparse.py | ||
31 | @@ -1149,16 +1149,51 @@ class UrlParseTestCase(unittest.TestCase): | ||
32 | self.assertRaises(ValueError, urllib.parse.urlsplit, 'Scheme://user@[0439:23af::2309::fae7:1234]/Path?Query') | ||
33 | self.assertRaises(ValueError, urllib.parse.urlsplit, 'Scheme://user@[0439:23af:2309::fae7:1234:2342:438e:192.0.2.146]/Path?Query') | ||
34 | self.assertRaises(ValueError, urllib.parse.urlsplit, 'Scheme://user@]v6a.ip[/Path') | ||
35 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[v6a.ip]') | ||
36 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[v6a.ip].suffix') | ||
37 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[v6a.ip]/') | ||
38 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[v6a.ip].suffix/') | ||
39 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[v6a.ip]?') | ||
40 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[v6a.ip].suffix?') | ||
41 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]') | ||
42 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix') | ||
43 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]/') | ||
44 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix/') | ||
45 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]?') | ||
46 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix?') | ||
47 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:a') | ||
48 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix:a') | ||
49 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:a1') | ||
50 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix:a1') | ||
51 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:1a') | ||
52 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix:1a') | ||
53 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:') | ||
54 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix:/') | ||
55 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:?') | ||
56 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://user@prefix.[v6a.ip]') | ||
57 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://user@[v6a.ip].suffix') | ||
58 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[v6a.ip') | ||
59 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://v6a.ip]') | ||
60 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://]v6a.ip[') | ||
61 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://]v6a.ip') | ||
62 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://v6a.ip[') | ||
63 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[v6a.ip') | ||
64 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://v6a.ip].suffix') | ||
65 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix]v6a.ip[suffix') | ||
66 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix]v6a.ip') | ||
67 | + self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://v6a.ip[suffix') | ||
68 | |||
69 | def test_splitting_bracketed_hosts(self): | ||
70 | - p1 = urllib.parse.urlsplit('scheme://user@[v6a.ip]/path?query') | ||
71 | + p1 = urllib.parse.urlsplit('scheme://user@[v6a.ip]:1234/path?query') | ||
72 | self.assertEqual(p1.hostname, 'v6a.ip') | ||
73 | self.assertEqual(p1.username, 'user') | ||
74 | self.assertEqual(p1.path, '/path') | ||
75 | + self.assertEqual(p1.port, 1234) | ||
76 | p2 = urllib.parse.urlsplit('scheme://user@[0439:23af:2309::fae7%test]/path?query') | ||
77 | self.assertEqual(p2.hostname, '0439:23af:2309::fae7%test') | ||
78 | self.assertEqual(p2.username, 'user') | ||
79 | self.assertEqual(p2.path, '/path') | ||
80 | + self.assertIs(p2.port, None) | ||
81 | p3 = urllib.parse.urlsplit('scheme://user@[0439:23af:2309::fae7:1234:192.0.2.146%test]/path?query') | ||
82 | self.assertEqual(p3.hostname, '0439:23af:2309::fae7:1234:192.0.2.146%test') | ||
83 | self.assertEqual(p3.username, 'user') | ||
84 | diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py | ||
85 | index 07e3248504..e1ee36d98e 100644 | ||
86 | --- a/Lib/urllib/parse.py | ||
87 | +++ b/Lib/urllib/parse.py | ||
88 | @@ -442,6 +442,23 @@ def _checknetloc(netloc): | ||
89 | raise ValueError("netloc '" + netloc + "' contains invalid " + | ||
90 | "characters under NFKC normalization") | ||
91 | |||
92 | +def _check_bracketed_netloc(netloc): | ||
93 | + # Note that this function must mirror the splitting | ||
94 | + # done in NetlocResultMixins._hostinfo(). | ||
95 | + hostname_and_port = netloc.rpartition('@')[2] | ||
96 | + before_bracket, have_open_br, bracketed = hostname_and_port.partition('[') | ||
97 | + if have_open_br: | ||
98 | + # No data is allowed before a bracket. | ||
99 | + if before_bracket: | ||
100 | + raise ValueError("Invalid IPv6 URL") | ||
101 | + hostname, _, port = bracketed.partition(']') | ||
102 | + # No data is allowed after the bracket but before the port delimiter. | ||
103 | + if port and not port.startswith(":"): | ||
104 | + raise ValueError("Invalid IPv6 URL") | ||
105 | + else: | ||
106 | + hostname, _, port = hostname_and_port.partition(':') | ||
107 | + _check_bracketed_host(hostname) | ||
108 | + | ||
109 | # Valid bracketed hosts are defined in | ||
110 | # https://www.rfc-editor.org/rfc/rfc3986#page-49 and https://url.spec.whatwg.org/ | ||
111 | def _check_bracketed_host(hostname): | ||
112 | @@ -505,8 +522,7 @@ def urlsplit(url, scheme='', allow_fragments=True): | ||
113 | (']' in netloc and '[' not in netloc)): | ||
114 | raise ValueError("Invalid IPv6 URL") | ||
115 | if '[' in netloc and ']' in netloc: | ||
116 | - bracketed_host = netloc.partition('[')[2].partition(']')[0] | ||
117 | - _check_bracketed_host(bracketed_host) | ||
118 | + _check_bracketed_netloc(netloc) | ||
119 | if allow_fragments and '#' in url: | ||
120 | url, fragment = url.split('#', 1) | ||
121 | if '?' in url: | ||
122 | 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 | ||
123 | new file mode 100644 | ||
124 | index 0000000000..bff1bc6b0d | ||
125 | --- /dev/null | ||
126 | +++ b/Misc/NEWS.d/next/Security/2025-01-28-14-08-03.gh-issue-105704.EnhHxu.rst | ||
127 | @@ -0,0 +1,4 @@ | ||
128 | +When using :func:`urllib.parse.urlsplit` and :func:`urllib.parse.urlparse` host | ||
129 | +parsing would not reject domain names containing square brackets (``[`` and | ||
130 | +``]``). Square brackets are only valid for IPv6 and IPvFuture hosts according to | ||
131 | +`RFC 3986 Section 3.2.2 <https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2>`__. | ||
diff --git a/meta/recipes-devtools/python/python3/avoid_warning_about_tkinter.patch b/meta/recipes-devtools/python/python3/avoid_warning_about_tkinter.patch index 2de72b7199..3b4b170f7f 100644 --- a/meta/recipes-devtools/python/python3/avoid_warning_about_tkinter.patch +++ b/meta/recipes-devtools/python/python3/avoid_warning_about_tkinter.patch | |||
@@ -18,7 +18,7 @@ diff --git a/setup.py b/setup.py | |||
18 | index 11b5cf5..2be4738 100644 | 18 | index 11b5cf5..2be4738 100644 |
19 | --- a/setup.py | 19 | --- a/setup.py |
20 | +++ b/setup.py | 20 | +++ b/setup.py |
21 | @@ -1895,8 +1895,8 @@ class PyBuildExt(build_ext): | 21 | @@ -1902,8 +1902,8 @@ class PyBuildExt(build_ext): |
22 | self.detect_decimal() | 22 | self.detect_decimal() |
23 | self.detect_ctypes() | 23 | self.detect_ctypes() |
24 | self.detect_multiprocessing() | 24 | self.detect_multiprocessing() |
diff --git a/meta/recipes-devtools/python/python3/makerace.patch b/meta/recipes-devtools/python/python3/makerace.patch index 2c06784ffc..cfcc798c05 100644 --- a/meta/recipes-devtools/python/python3/makerace.patch +++ b/meta/recipes-devtools/python/python3/makerace.patch | |||
@@ -21,7 +21,7 @@ diff --git a/Makefile.pre.in b/Makefile.pre.in | |||
21 | index 5e13ba2..026bffd 100644 | 21 | index 5e13ba2..026bffd 100644 |
22 | --- a/Makefile.pre.in | 22 | --- a/Makefile.pre.in |
23 | +++ b/Makefile.pre.in | 23 | +++ b/Makefile.pre.in |
24 | @@ -1527,7 +1527,7 @@ TESTSUBDIRS= ctypes/test \ | 24 | @@ -1528,7 +1528,7 @@ TESTSUBDIRS= ctypes/test \ |
25 | unittest/test unittest/test/testmock | 25 | unittest/test unittest/test/testmock |
26 | 26 | ||
27 | TEST_MODULES=@TEST_MODULES@ | 27 | TEST_MODULES=@TEST_MODULES@ |
diff --git a/meta/recipes-devtools/python/python3_3.10.16.bb b/meta/recipes-devtools/python/python3_3.10.18.bb index 932791f38d..0b57a0ebee 100644 --- a/meta/recipes-devtools/python/python3_3.10.16.bb +++ b/meta/recipes-devtools/python/python3_3.10.18.bb | |||
@@ -37,7 +37,6 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ | |||
37 | file://0001-Avoid-shebang-overflow-on-python-config.py.patch \ | 37 | file://0001-Avoid-shebang-overflow-on-python-config.py.patch \ |
38 | file://0001-test_storlines-skip-due-to-load-variability.patch \ | 38 | file://0001-test_storlines-skip-due-to-load-variability.patch \ |
39 | file://0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch \ | 39 | file://0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch \ |
40 | file://CVE-2025-0938.patch \ | ||
41 | " | 40 | " |
42 | 41 | ||
43 | SRC_URI:append:class-native = " \ | 42 | SRC_URI:append:class-native = " \ |
@@ -46,7 +45,7 @@ SRC_URI:append:class-native = " \ | |||
46 | file://12-distutils-prefix-is-inside-staging-area.patch \ | 45 | file://12-distutils-prefix-is-inside-staging-area.patch \ |
47 | file://0001-Don-t-search-system-for-headers-libraries.patch \ | 46 | file://0001-Don-t-search-system-for-headers-libraries.patch \ |
48 | " | 47 | " |
49 | SRC_URI[sha256sum] = "bfb249609990220491a1b92850a07135ed0831e41738cf681d63cf01b2a8fbd1" | 48 | SRC_URI[sha256sum] = "ae665bc678abd9ab6a6e1573d2481625a53719bc517e9a634ed2b9fefae3817f" |
50 | 49 | ||
51 | # exclude pre-releases for both python 2.x and 3.x | 50 | # exclude pre-releases for both python 2.x and 3.x |
52 | UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar" | 51 | UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar" |