Skip to content

Commit 51828d9

Browse files
[AutoPR- Security] Patch python-requests for CVE-2026-25645 [MEDIUM] (#16349)
Co-authored-by: Akarsh Chaudhary <v-akarshc@microsoft.com>
1 parent 3bb76e3 commit 51828d9

File tree

2 files changed

+45
-3
lines changed

2 files changed

+45
-3
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
From 2eab2a6fb330a595bc2943f23618da8d68a5a66e Mon Sep 17 00:00:00 2001
2+
From: Nate Prewitt <nate.prewitt@gmail.com>
3+
Date: Wed, 25 Mar 2026 08:57:56 -0600
4+
Subject: [PATCH] Merge commit from fork
5+
6+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
7+
Upstream-reference: https://github.com/psf/requests/commit/66d21cb07bd6255b1280291c4fafb71803cdb3b7.patch
8+
---
9+
requests/utils.py | 13 +++++++------
10+
1 file changed, 7 insertions(+), 6 deletions(-)
11+
12+
diff --git a/requests/utils.py b/requests/utils.py
13+
index 502c7bc..e0fcdbc 100644
14+
--- a/requests/utils.py
15+
+++ b/requests/utils.py
16+
@@ -282,12 +282,13 @@ def extract_zipped_paths(path):
17+
return path
18+
19+
# we have a valid zip archive and a valid member of that archive
20+
- tmp = tempfile.gettempdir()
21+
- extracted_path = os.path.join(tmp, member.split("/")[-1])
22+
- if not os.path.exists(extracted_path):
23+
- # use read + write to avoid the creating nested folders, we only want the file, avoids mkdir racing condition
24+
- with atomic_open(extracted_path) as file_handler:
25+
- file_handler.write(zip_file.read(member))
26+
+ suffix = os.path.splitext(member.split("/")[-1])[-1]
27+
+ fd, extracted_path = tempfile.mkstemp(suffix=suffix)
28+
+ try:
29+
+ os.write(fd, zip_file.read(member))
30+
+ finally:
31+
+ os.close(fd)
32+
+
33+
return extracted_path
34+
35+
36+
--
37+
2.45.4
38+

SPECS/python-requests/python-requests.spec

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: Awesome Python HTTP Library That's Actually Usable
22
Name: python-requests
33
Version: 2.31.0
4-
Release: 3%{?dist}
4+
Release: 4%{?dist}
55
License: ASL 2.0
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
@@ -10,6 +10,7 @@ URL: http://python-requests.org
1010
Source0: https://github.com/requests/requests/archive/v%{version}/requests-v%{version}.tar.gz#/requests-%{version}.tar.gz
1111
Patch0: CVE-2024-35195.patch
1212
Patch1: CVE-2024-47081.patch
13+
Patch2: CVE-2026-25645.patch
1314
BuildArch: noarch
1415

1516
%description
@@ -60,11 +61,11 @@ perform the simplest of tasks.
6061
%py3_install
6162

6263
%check
63-
pip3 install tox
64+
pip3 install --ignore-installed tox
6465
# 2.1.0+ versions of "markupsafe" make test fail.
6566
# No fix from upstream in version 2.28.1: https://github.com/psf/requests/commit/3ed60078e2376c847ba0b0c9d564af522623c5ba
6667
sed -i "/wheel/amarkupsafe==2.0.1" requirements-dev.txt
67-
LANG=en_US.UTF-8 tox -e py%{python3_version_nodots}
68+
LANG=en_US.UTF-8 python3 -m tox -e py%{python3_version_nodots}
6869

6970
%files -n python3-requests
7071
%defattr(-,root,root)
@@ -73,6 +74,9 @@ LANG=en_US.UTF-8 tox -e py%{python3_version_nodots}
7374
%{python3_sitelib}/*
7475

7576
%changelog
77+
* Mon Mar 30 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 2.31.0-4
78+
- Patch for CVE-2026-25645
79+
7680
* Tue Jun 17 2025 Jyoti Kanase <v-jykanase@microsoft.com> - 2.31.0-3
7781
- Add patch for CVE-2024-47081
7882

0 commit comments

Comments
 (0)