Skip to content

Commit df3c346

Browse files
[AutoPR- Security] Patch python-requests for CVE-2026-25645 [MEDIUM] (#16352)
1 parent a1ba234 commit df3c346

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

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

SPECS/python-requests/python-requests.spec

Lines changed: 5 additions & 1 deletion
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.27.1
4-
Release: 8%{?dist}
4+
Release: 9%{?dist}
55
License: ASL 2.0
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -11,6 +11,7 @@ Source0: https://github.com/requests/requests/archive/v%{version}/request
1111
Patch0: CVE-2023-32681.patch
1212
Patch1: CVE-2024-35195.patch
1313
Patch2: CVE-2024-47081.patch
14+
Patch3: CVE-2026-25645.patch
1415
BuildArch: noarch
1516

1617
%description
@@ -74,6 +75,9 @@ LANG=en_US.UTF-8 tox -e py%{python3_version_nodots}
7475
%{python3_sitelib}/*
7576

7677
%changelog
78+
* Mon Mar 30 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 2.27.1-9
79+
- Patch for CVE-2026-25645
80+
7781
* Tue Jun 17 2025 Jyoti Kanase <v-jykanase@microsoft.com> - 2.27.1-8
7882
- Add patch for CVE-2024-47081
7983

0 commit comments

Comments
 (0)