orion / rpms / python3x-pip

Forked from rpms/python3x-pip 2 years ago
Clone
269077
From 6d2dcef3427b96c36ddfebf217f774a2c5ecad38 Mon Sep 17 00:00:00 2001
269077
From: Lumir Balhar <lbalhar@redhat.com>
269077
Date: Wed, 30 Jun 2021 09:27:07 +0200
269077
Subject: [PATCH] CVE-2021-33503
269077
269077
---
269077
 src/pip/_vendor/urllib3/util/url.py | 8 +++++---
269077
 1 file changed, 5 insertions(+), 3 deletions(-)
269077
269077
diff --git a/src/pip/_vendor/urllib3/util/url.py b/src/pip/_vendor/urllib3/util/url.py
269077
index 5fe37a7..addaeb7 100644
269077
--- a/src/pip/_vendor/urllib3/util/url.py
269077
+++ b/src/pip/_vendor/urllib3/util/url.py
269077
@@ -63,12 +63,12 @@ IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT + "$")
269077
 BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT[2:-2] + "$")
269077
 ZONE_ID_RE = re.compile("(" + ZONE_ID_PAT + r")\]$")
269077
 
269077
-SUBAUTHORITY_PAT = (u"^(?:(.*)@)?(%s|%s|%s)(?::([0-9]{0,5}))?$") % (
269077
+_HOST_PORT_PAT = ("^(%s|%s|%s)(?::([0-9]{0,5}))?$") % (
269077
     REG_NAME_PAT,
269077
     IPV4_PAT,
269077
     IPV6_ADDRZ_PAT,
269077
 )
269077
-SUBAUTHORITY_RE = re.compile(SUBAUTHORITY_PAT, re.UNICODE | re.DOTALL)
269077
+_HOST_PORT_RE = re.compile(_HOST_PORT_PAT, re.UNICODE | re.DOTALL)
269077
 
269077
 UNRESERVED_CHARS = set(
269077
     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-~"
269077
@@ -374,7 +374,9 @@ def parse_url(url):
269077
             scheme = scheme.lower()
269077
 
269077
         if authority:
269077
-            auth, host, port = SUBAUTHORITY_RE.match(authority).groups()
269077
+            auth, _, host_port = authority.rpartition("@")
269077
+            auth = auth or None
269077
+            host, port = _HOST_PORT_RE.match(host_port).groups()
269077
             if auth and normalize_uri:
269077
                 auth = _encode_invalid_chars(auth, USERINFO_CHARS)
269077
             if port == "":
269077
-- 
269077
2.31.1
269077