Skip to content

Commit efbb633

Browse files
authored
[Medium] patch python-requests for CVE-2024-47081 (#14019)
1 parent 10be9fa commit efbb633

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

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

SPECS/python-requests/python-requests.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
Summary: Awesome Python HTTP Library That's Actually Usable
22
Name: python-requests
33
Version: 2.31.0
4-
Release: 2%{?dist}
4+
Release: 3%{?dist}
55
License: ASL 2.0
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
88
Group: Development/Languages/Python
99
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
12+
Patch1: CVE-2024-47081.patch
1213
BuildArch: noarch
1314

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

7475
%changelog
76+
* Tue Jun 17 2025 Jyoti Kanase <v-jykanase@microsoft.com> - 2.31.0-3
77+
- Add patch for CVE-2024-47081
78+
7579
* Fri Dec 27 2024 Archana Choudhary <archana1@microsoft.com> - 2.31.0-2
7680
- Add patch for CVE-2024-35195
7781

0 commit comments

Comments
 (0)