Security fix for the bundled urllib3 for CVE-2025-50181
Taken from Fedora 8ddd39d
This commit is contained in:
parent
103136a731
commit
ba2a9ac387
@ -104,6 +104,11 @@ Patch: truststore-pem-path.patch
|
||||
# We don't need a layer to check that, as we're by default in an offline environment
|
||||
Patch: downstream-remove-pytest-subket.patch
|
||||
|
||||
# Patch for the bundled urllib3 for CVE-2025-50181
|
||||
# Redirects are not disabled when retries are disabled on PoolManager instantiation
|
||||
# Upstream fix: https://github.com/urllib3/urllib3/commit/f05b1329126d5be6de501f9d1e3e36738bc08857
|
||||
Patch: urllib3-CVE-2025-50181.patch
|
||||
|
||||
# Remove -s from Python shebang - ensure that packages installed with pip
|
||||
# to user locations are seen by pip itself
|
||||
%undefine _py3_shebang_s
|
||||
|
||||
51
urllib3-CVE-2025-50181.patch
Normal file
51
urllib3-CVE-2025-50181.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From b3d543d7e16af844394316360ef1bf0b9d10f1b1 Mon Sep 17 00:00:00 2001
|
||||
From: Illia Volochii <illia.volochii@gmail.com>
|
||||
Date: Wed, 18 Jun 2025 16:25:01 +0300
|
||||
Subject: [PATCH] Security fix for CVE-2025-50181
|
||||
|
||||
Co-authored-by: Seth Michael Larson <sethmichaellarson@gmail.com>
|
||||
Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>
|
||||
Co-authored-by: Seth Michael Larson <sethmichaellarson@gmail.com>
|
||||
---
|
||||
src/pip/_vendor/urllib3/poolmanager.py | 18 +++++++++++++++++-
|
||||
1 file changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/pip/_vendor/urllib3/poolmanager.py b/src/pip/_vendor/urllib3/poolmanager.py
|
||||
index fb51bf7..a8de7c6 100644
|
||||
--- a/src/pip/_vendor/urllib3/poolmanager.py
|
||||
+++ b/src/pip/_vendor/urllib3/poolmanager.py
|
||||
@@ -170,6 +170,22 @@ class PoolManager(RequestMethods):
|
||||
|
||||
def __init__(self, num_pools=10, headers=None, **connection_pool_kw):
|
||||
RequestMethods.__init__(self, headers)
|
||||
+ if "retries" in connection_pool_kw:
|
||||
+ retries = connection_pool_kw["retries"]
|
||||
+ if not isinstance(retries, Retry):
|
||||
+ # When Retry is initialized, raise_on_redirect is based
|
||||
+ # on a redirect boolean value.
|
||||
+ # But requests made via a pool manager always set
|
||||
+ # redirect to False, and raise_on_redirect always ends
|
||||
+ # up being False consequently.
|
||||
+ # Here we fix the issue by setting raise_on_redirect to
|
||||
+ # a value needed by the pool manager without considering
|
||||
+ # the redirect boolean.
|
||||
+ raise_on_redirect = retries is not False
|
||||
+ retries = Retry.from_int(retries, redirect=False)
|
||||
+ retries.raise_on_redirect = raise_on_redirect
|
||||
+ connection_pool_kw = connection_pool_kw.copy()
|
||||
+ connection_pool_kw["retries"] = retries
|
||||
self.connection_pool_kw = connection_pool_kw
|
||||
self.pools = RecentlyUsedContainer(num_pools)
|
||||
|
||||
@@ -389,7 +405,7 @@ class PoolManager(RequestMethods):
|
||||
kw["body"] = None
|
||||
kw["headers"] = HTTPHeaderDict(kw["headers"])._prepare_for_method_change()
|
||||
|
||||
- retries = kw.get("retries")
|
||||
+ retries = kw.get("retries", response.retries)
|
||||
if not isinstance(retries, Retry):
|
||||
retries = Retry.from_int(retries, redirect=redirect)
|
||||
|
||||
--
|
||||
2.51.0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user