orion / rpms / python3x-pip

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