Skip to content

Commit a559ed5

Browse files
authored
[Medium] patch python-requests for CVE-2024-47081 (#14022)
1 parent abae7a4 commit a559ed5

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From f39e5f610545a89aadbc714cb9cc2071781b1d02 Mon Sep 17 00:00:00 2001
2+
From: jykanase <[email protected]>
3+
Date: Tue, 17 Jun 2025 05:20:20 +0000
4+
Subject: [PATCH] CVE-2024-47081
5+
6+
Upstream Patch Reference: https://github.com/psf/requests/commit/96ba401c1296ab1dda74a2365ef36d88f7d144ef
7+
---
8+
requests/utils.py | 7 +------
9+
1 file changed, 1 insertion(+), 6 deletions(-)
10+
11+
diff --git a/requests/utils.py b/requests/utils.py
12+
index 153776c..cb9d01d 100644
13+
--- a/requests/utils.py
14+
+++ b/requests/utils.py
15+
@@ -209,12 +209,7 @@ def get_netrc_auth(url, raise_errors=False):
16+
17+
ri = urlparse(url)
18+
19+
- # Strip port numbers from netloc. This weird `if...encode`` dance is
20+
- # used for Python 3.2, which doesn't support unicode literals.
21+
- splitstr = b':'
22+
- if isinstance(url, str):
23+
- splitstr = splitstr.decode('ascii')
24+
- host = ri.netloc.split(splitstr)[0]
25+
+ host = ri.hostname
26+
27+
try:
28+
_netrc = netrc(netrc_path).authenticators(host)
29+
--
30+
2.45.2
31+

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: 7%{?dist}
4+
Release: 8%{?dist}
55
License: ASL 2.0
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -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-2023-32681.patch
1212
Patch1: CVE-2024-35195.patch
13+
Patch2: CVE-2024-47081.patch
1314
BuildArch: noarch
1415

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

7576
%changelog
77+
* Tue Jun 17 2025 Jyoti Kanase <[email protected]> - 2.27.1-8
78+
- Add patch for CVE-2024-47081
79+
7680
* Tue May 28 2024 Lanze Liu <[email protected]> - 2.27.1-7
7781
- Add patch for CVE-2024-35195
7882

0 commit comments

Comments
 (0)