import python3.12-setuptools-68.2.2-3.el9_4.1

i9c changed/i9c/python3.12-setuptools-68.2.2-3.el9_4.1
MSVSphere Packaging Team 6 months ago
parent 98e5b46ebf
commit 1755d4db9c

@ -0,0 +1,116 @@
From 472528deea4063f20c5d9525f0faf64ae0cd0a90 Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com>
Date: Wed, 24 Jul 2024 14:26:09 +0200
Subject: [PATCH] CVE-2024-6345
---
setuptools/package_index.py | 21 +++++----------------
setuptools/tests/test_packageindex.py | 20 ++++++++++----------
2 files changed, 15 insertions(+), 26 deletions(-)
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index 7095585..1368bde 100644
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -1,5 +1,6 @@
"""PyPI and direct package downloading."""
+import subprocess
import sys
import os
import re
@@ -881,17 +882,11 @@ class PackageIndex(Environment):
url, rev = self._vcs_split_rev_from_url(url, pop_prefix=True)
self.info("Doing git clone from %s to %s", url, filename)
- os.system("git clone --quiet %s %s" % (url, filename))
+ subprocess.check_call(["git", "clone", "--quiet", url, filename])
if rev is not None:
self.info("Checking out %s", rev)
- os.system(
- "git -C %s checkout --quiet %s"
- % (
- filename,
- rev,
- )
- )
+ subprocess.check_call(["git", "-C", filename, "checkout", "--quiet", rev])
return filename
@@ -900,17 +895,11 @@ class PackageIndex(Environment):
url, rev = self._vcs_split_rev_from_url(url, pop_prefix=True)
self.info("Doing hg clone from %s to %s", url, filename)
- os.system("hg clone --quiet %s %s" % (url, filename))
+ subprocess.check_call(["hg", "clone", "--quiet", url, filename])
if rev is not None:
self.info("Updating to %s", rev)
- os.system(
- "hg --cwd %s up -C -r %s -q"
- % (
- filename,
- rev,
- )
- )
+ subprocess.check_call(["hg", "--cwd", filename, "up", "-C", "-r", rev, "-q"])
return filename
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 0287063..c136e8d 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -190,37 +190,37 @@ class TestPackageIndex:
url = 'git+https://github.example/group/project@master#egg=foo'
index = setuptools.package_index.PackageIndex()
- with mock.patch("os.system") as os_system_mock:
+ with mock.patch("subprocess.check_call") as subprocess_check_call_mock:
result = index.download(url, str(tmpdir))
- os_system_mock.assert_called()
+ subprocess_check_call_mock.assert_called()
expected_dir = str(tmpdir / 'project@master')
expected = (
'git clone --quiet ' 'https://github.example/group/project {expected_dir}'
- ).format(**locals())
- first_call_args = os_system_mock.call_args_list[0][0]
+ ).format(**locals()).split()
+ first_call_args = subprocess_check_call_mock.call_args_list[0][0]
assert first_call_args == (expected,)
tmpl = 'git -C {expected_dir} checkout --quiet master'
- expected = tmpl.format(**locals())
- assert os_system_mock.call_args_list[1][0] == (expected,)
+ expected = tmpl.format(**locals()).split()
+ assert subprocess_check_call_mock.call_args_list[1][0] == (expected,)
assert result == expected_dir
def test_download_git_no_rev(self, tmpdir):
url = 'git+https://github.example/group/project#egg=foo'
index = setuptools.package_index.PackageIndex()
- with mock.patch("os.system") as os_system_mock:
+ with mock.patch("subprocess.check_call") as subprocess_check_call_mock:
result = index.download(url, str(tmpdir))
- os_system_mock.assert_called()
+ subprocess_check_call_mock.assert_called()
expected_dir = str(tmpdir / 'project')
expected = (
'git clone --quiet ' 'https://github.example/group/project {expected_dir}'
- ).format(**locals())
- os_system_mock.assert_called_once_with(expected)
+ ).format(**locals()).split()
+ subprocess_check_call_mock.assert_called_once_with(expected)
def test_download_svn(self, tmpdir):
url = 'svn+https://svn.example/project#egg=foo'
--
2.45.2

@ -19,7 +19,7 @@
Name: python%{python3_pkgversion}-setuptools
# When updating, update the bundled libraries versions bellow!
Version: 68.2.2
Release: 3%{?dist}
Release: 3%{?dist}.1
Summary: Easily build and distribute Python packages
# setuptools is MIT
# platformdirs is MIT
@ -42,6 +42,13 @@ Source0: %{pypi_source %{srcname} %{version}}
# adjust it, but only when $RPM_BUILD_ROOT is set
Patch: Adjust-the-setup.py-install-deprecation-message.patch
# Security fix for CVE-2024-6345
# Remote code execution via download functions in the package_index module
# Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=2297771
# Upstream solution: https://github.com/pypa/setuptools/pull/4332
# Patch simplified because upstream doesn't support SVN anymore.
Patch: CVE-2024-6345.patch
BuildArch: noarch
BuildRequires: python%{python3_pkgversion}-devel
@ -219,8 +226,12 @@ PYTHONPATH=$(pwd) %pytest \
%changelog
* Tue Apr 02 2024 Arkady L. Shane <tigro@msvsphere-os.ru> - 68.2.2-3
- Initial build for MSVSphere 9.3
* Tue Aug 20 2024 MSVSphere Packaging Team <packager@msvsphere-os.ru> - 68.2.2-3.1
- Rebuilt for MSVSphere 9.4
* Wed Jul 24 2024 Lumír Balhar <lbalhar@redhat.com> - 68.2.2-3.1
- Security fix for CVE-2024-6345
Resolves: RHEL-50481
* Tue Jan 23 2024 Miro Hrončok <mhroncok@redhat.com> - 68.2.2-3
- Rebuilt for timestamp .pyc invalidation mode

Loading…
Cancel
Save