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