Skip to content

Commit ed2c8d6

Browse files
azurelinux-securityKanishk Bansalarchana25-ms
authored
[AutoPR- Security] Patch python-pip for CVE-2026-1703 [LOW] (#15938)
Signed-off-by: Kanishk Bansal <kanbansal@microsoft.com> Co-authored-by: Kanishk Bansal <kanbansal@microsoft.com> Co-authored-by: Archana Shettigar <v-shettigara@microsoft.com>
1 parent f4ee0e9 commit ed2c8d6

4 files changed

Lines changed: 51 additions & 6 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
From 351d71b3c284eef7e381cc42b1a9d545142ed095 Mon Sep 17 00:00:00 2001
2+
From: Seth Michael Larson <seth@python.org>
3+
Date: Fri, 30 Jan 2026 09:49:11 -0600
4+
Subject: [PATCH] Use os.path.commonpath() instead of commonprefix()
5+
6+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
7+
Upstream-reference: https://github.com/pypa/pip/commit/8e227a9be4faa9594e05d02ca05a413a2a4e7735.patch
8+
---
9+
src/pip/_internal/utils/unpacking.py | 2 +-
10+
tests/unit/test_utils_unpacking.py | 2 ++
11+
2 files changed, 3 insertions(+), 1 deletion(-)
12+
13+
diff --git a/src/pip/_internal/utils/unpacking.py b/src/pip/_internal/utils/unpacking.py
14+
index 03467e8..6bda973 100644
15+
--- a/src/pip/_internal/utils/unpacking.py
16+
+++ b/src/pip/_internal/utils/unpacking.py
17+
@@ -82,7 +82,7 @@ def is_within_directory(directory: str, target: str) -> bool:
18+
abs_directory = os.path.abspath(directory)
19+
abs_target = os.path.abspath(target)
20+
21+
- prefix = os.path.commonprefix([abs_directory, abs_target])
22+
+ prefix = os.path.commonpath([abs_directory, abs_target])
23+
return prefix == abs_directory
24+
25+
26+
diff --git a/tests/unit/test_utils_unpacking.py b/tests/unit/test_utils_unpacking.py
27+
index d681fcb..313bd9e 100644
28+
--- a/tests/unit/test_utils_unpacking.py
29+
+++ b/tests/unit/test_utils_unpacking.py
30+
@@ -412,6 +412,8 @@ def test_unpack_tar_unicode(tmpdir: Path) -> None:
31+
(("parent/", "parent/sub"), True),
32+
# Test target outside parent
33+
(("parent/", "parent/../sub"), False),
34+
+ # Test target sub-string of parent
35+
+ (("parent/child", "parent/childfoo"), False),
36+
],
37+
)
38+
def test_is_within_directory(args: Tuple[str, str], expected: bool) -> None:
39+
--
40+
2.45.4
41+

SPECS/python-pip/python-pip.spec

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@ A tool for installing and managing Python packages}
55
Summary: A tool for installing and managing Python packages
66
Name: python-pip
77
Version: 24.2
8-
Release: 5%{?dist}
8+
Release: 6%{?dist}
99
License: MIT AND Python-2.0.1 AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND LGPL-2.1-only AND MPL-2.0 AND (Apache-2.0 OR BSD-2-Clause)
1010
Vendor: Microsoft Corporation
1111
Distribution: Azure Linux
1212
Group: Development/Tools
1313
URL: https://pip.pypa.io/
1414
Source0: https://github.com/pypa/pip/archive/%{version}/%{srcname}-%{version}.tar.gz
15-
Patch0: CVE-2024-37891.patch
16-
Patch1: CVE-2025-8869.patch
15+
Patch0: CVE-2024-37891.patch
16+
Patch1: CVE-2025-8869.patch
1717
Patch2: CVE-2025-50181.patch
18+
Patch3: CVE-2026-1703.patch
1819

1920
BuildArch: noarch
2021

@@ -58,7 +59,10 @@ BuildRequires: python3-wheel
5859
%{python3_sitelib}/pip*
5960

6061
%changelog
61-
* Tue Sep 30 2025 Jyoti Kanase <v-jykanase@microsoft.com> - 24.2-4
62+
* Fri Feb 20 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 24.2-6
63+
- Patch for CVE-2026-1703
64+
65+
* Tue Sep 30 2025 Jyoti Kanase <v-jykanase@microsoft.com> - 24.2-5
6266
- Patch for CVE-2025-50181
6367
- Added %check
6468

toolkit/resources/manifests/package/toolchain_aarch64.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ python3-magic-5.45-1.azl3.noarch.rpm
550550
python3-markupsafe-2.1.3-1.azl3.aarch64.rpm
551551
python3-newt-0.52.23-1.azl3.aarch64.rpm
552552
python3-packaging-23.2-3.azl3.noarch.rpm
553-
python3-pip-24.2-5.azl3.noarch.rpm
553+
python3-pip-24.2-6.azl3.noarch.rpm
554554
python3-pygments-2.7.4-2.azl3.noarch.rpm
555555
python3-rpm-4.18.2-1.azl3.aarch64.rpm
556556
python3-rpm-generators-14-11.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
@@ -558,7 +558,7 @@ python3-magic-5.45-1.azl3.noarch.rpm
558558
python3-markupsafe-2.1.3-1.azl3.x86_64.rpm
559559
python3-newt-0.52.23-1.azl3.x86_64.rpm
560560
python3-packaging-23.2-3.azl3.noarch.rpm
561-
python3-pip-24.2-5.azl3.noarch.rpm
561+
python3-pip-24.2-6.azl3.noarch.rpm
562562
python3-pygments-2.7.4-2.azl3.noarch.rpm
563563
python3-rpm-4.18.2-1.azl3.x86_64.rpm
564564
python3-rpm-generators-14-11.azl3.noarch.rpm

0 commit comments

Comments
 (0)