Skip to content

Commit 06a004e

Browse files
CBL-Mariner-BotmayankfzMayank SinghPawelWMS
authored
[AUTO-CHERRYPICK] Patch python-setuptools for CVE-2025-47273 [High]. - branch 3.0-dev (#13909)
Signed-off-by: Mayank Singh <mayansingh@microsoft.com> Co-authored-by: mayankfz <mayankfz@gmail.com> Co-authored-by: Mayank Singh <mayansingh@microsoft.com> Co-authored-by: Pawel Winogrodzki <pawelwi@microsoft.com>
1 parent fb89ca4 commit 06a004e

File tree

6 files changed

+73
-5
lines changed

6 files changed

+73
-5
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
From 28da95e0be5197aa84708aa0696c70c42be80439 Mon Sep 17 00:00:00 2001
2+
From: Mayank Singh <mayansingh@microsoft.com>
3+
Date: Mon, 26 May 2025 06:42:09 +0000
4+
Subject: [PATCH] Patch CVE-2025-47273
5+
6+
Upstream Patch Reference: https://github.com/pypa/setuptools/commit/250a6d17978f9f6ac3ac887091f2d32886fbbb0b
7+
---
8+
setuptools/package_index.py | 33 +++++++++++++++++++++++++++++----
9+
1 file changed, 29 insertions(+), 4 deletions(-)
10+
11+
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
12+
index cf25f83..d8f350e 100644
13+
--- a/setuptools/package_index.py
14+
+++ b/setuptools/package_index.py
15+
@@ -813,10 +813,25 @@ class PackageIndex(Environment):
16+
else:
17+
raise DistutilsError("Download error for %s: %s" % (url, v)) from v
18+
19+
- def _download_url(self, url, tmpdir):
20+
- # Determine download filename
21+
- #
22+
- name, fragment = egg_info_for_url(url)
23+
+ @staticmethod
24+
+ def _resolve_download_filename(url, tmpdir):
25+
+ """
26+
+ >>> import pathlib
27+
+ >>> du = PackageIndex._resolve_download_filename
28+
+ >>> root = getfixture('tmp_path')
29+
+ >>> url = 'https://files.pythonhosted.org/packages/a9/5a/0db.../setuptools-78.1.0.tar.gz'
30+
+ >>> str(pathlib.Path(du(url, root)).relative_to(root))
31+
+ 'setuptools-78.1.0.tar.gz'
32+
+
33+
+ Ensures the target is always in tmpdir.
34+
+
35+
+ >>> url = 'https://anyhost/%2fhome%2fuser%2f.ssh%2fauthorized_keys'
36+
+ >>> du(url, root)
37+
+ Traceback (most recent call last):
38+
+ ...
39+
+ ValueError: Invalid filename...
40+
+ """
41+
+ name, _fragment = egg_info_for_url(url)
42+
if name:
43+
while '..' in name:
44+
name = name.replace('..', '.').replace('\\', '_')
45+
@@ -828,6 +843,16 @@ class PackageIndex(Environment):
46+
47+
filename = os.path.join(tmpdir, name)
48+
49+
+ # ensure path resolves within the tmpdir
50+
+ if not filename.startswith(str(tmpdir)):
51+
+ raise ValueError(f"Invalid filename {filename}")
52+
+
53+
+ return filename
54+
+
55+
+ def _download_url(self, url, tmpdir):
56+
+ # Determine download filename
57+
+ #
58+
+ filename = self._resolve_download_filename(url, tmpdir)
59+
return self._download_vcs(url, filename) or self._download_other(url, filename)
60+
61+
@staticmethod
62+
--
63+
2.45.3
64+

SPECS/python-setuptools/python-setuptools.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ Setuptools is a fully-featured, actively-maintained, and stable library designed
66
Summary: Easily build and distribute Python packages
77
Name: python-setuptools
88
Version: 69.0.3
9-
Release: 4%{?dist}
9+
Release: 5%{?dist}
1010
License: MIT
1111
Vendor: Microsoft Corporation
1212
Distribution: Azure Linux
1313
Group: Development/Tools
1414
URL: https://pypi.python.org/pypi/setuptools
1515
Source0: https://pypi.org/packages/source/s/setuptools/setuptools-%{version}.tar.gz
1616
Patch0: CVE-2024-6345.patch
17+
Patch1: CVE-2025-47273.patch
1718

1819
%description %{_description}
1920

@@ -58,6 +59,9 @@ EOF
5859
%{python3_sitelib}/setuptools-%{version}.dist-info/*
5960

6061
%changelog
62+
* Mon May 26 2025 <mayansingh@microsoft.com> - 69.0.3-5
63+
- Fix CVE-2025-47273 with an upstream patch
64+
6165
* Tue Sep 10 2024 <lakarri@microsoft.com> - 69.0.3-4
6266
- Fix CVE-2024-6345 with a patch
6367

toolkit/resources/manifests/package/pkggen_core_aarch64.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ unzip-6.0-22.azl3.aarch64.rpm
247247
python3-3.12.9-1.azl3.aarch64.rpm
248248
python3-devel-3.12.9-1.azl3.aarch64.rpm
249249
python3-libs-3.12.9-1.azl3.aarch64.rpm
250-
python3-setuptools-69.0.3-4.azl3.noarch.rpm
250+
python3-setuptools-69.0.3-5.azl3.noarch.rpm
251251
python3-pygments-2.7.4-2.azl3.noarch.rpm
252252
which-2.21-8.azl3.aarch64.rpm
253253
libselinux-3.6-3.azl3.aarch64.rpm

toolkit/resources/manifests/package/pkggen_core_x86_64.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ unzip-6.0-22.azl3.x86_64.rpm
247247
python3-3.12.9-1.azl3.x86_64.rpm
248248
python3-devel-3.12.9-1.azl3.x86_64.rpm
249249
python3-libs-3.12.9-1.azl3.x86_64.rpm
250-
python3-setuptools-69.0.3-4.azl3.noarch.rpm
250+
python3-setuptools-69.0.3-5.azl3.noarch.rpm
251251
python3-pygments-2.7.4-2.azl3.noarch.rpm
252252
which-2.21-8.azl3.x86_64.rpm
253253
libselinux-3.6-3.azl3.x86_64.rpm

toolkit/resources/manifests/package/toolchain_aarch64.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ python3-pip-24.2-2.azl3.noarch.rpm
553553
python3-pygments-2.7.4-2.azl3.noarch.rpm
554554
python3-rpm-4.18.2-1.azl3.aarch64.rpm
555555
python3-rpm-generators-14-11.azl3.noarch.rpm
556-
python3-setuptools-69.0.3-4.azl3.noarch.rpm
556+
python3-setuptools-69.0.3-5.azl3.noarch.rpm
557557
python3-test-3.12.9-1.azl3.aarch64.rpm
558558
python3-tools-3.12.9-1.azl3.aarch64.rpm
559559
python3-wheel-0.43.0-1.azl3.noarch.rpm

toolkit/resources/manifests/package/toolchain_x86_64.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ python3-pip-24.2-2.azl3.noarch.rpm
561561
python3-pygments-2.7.4-2.azl3.noarch.rpm
562562
python3-rpm-4.18.2-1.azl3.x86_64.rpm
563563
python3-rpm-generators-14-11.azl3.noarch.rpm
564-
python3-setuptools-69.0.3-4.azl3.noarch.rpm
564+
python3-setuptools-69.0.3-5.azl3.noarch.rpm
565565
python3-test-3.12.9-1.azl3.x86_64.rpm
566566
python3-tools-3.12.9-1.azl3.x86_64.rpm
567567
python3-wheel-0.43.0-1.azl3.noarch.rpm

0 commit comments

Comments
 (0)