!31 update to 1.26.7 and remove python-nose dependency

Merge pull request !31 from kerongw/master
This commit is contained in:
openeuler-ci-bot 2022-01-26 02:04:05 +00:00 committed by Gitee
commit 39fd5fc014
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 25 additions and 83 deletions

Binary file not shown.

BIN
1.26.7.tar.gz Normal file

Binary file not shown.

View File

@ -17,14 +17,14 @@ Signed-off-by: Jorge Lopez Silva <jalopezsilva@gmail.com>
--- ---
src/urllib3/connection.py | 4 ++++ src/urllib3/connection.py | 4 ++++
test/conftest.py | 11 ++++++++++ test/conftest.py | 11 ++++++++++
.../test_proxy_poolmanager.py | 22 +++++++++++++++++++ .../test_proxy_poolmanager.py | 20 +++++++++++++++++++
3 files changed, 37 insertions(+) 3 files changed, 35 insertions(+)
diff --git a/src/urllib3/connection.py b/src/urllib3/connection.py diff --git a/src/urllib3/connection.py b/src/urllib3/connection.py
index 9066e6ade4..45580b7e1e 100644 index 60f70f7..f59f29b 100644
--- a/src/urllib3/connection.py --- a/src/urllib3/connection.py
+++ b/src/urllib3/connection.py +++ b/src/urllib3/connection.py
@@ -490,6 +490,10 @@ def _connect_tls_proxy(self, hostname, conn): @@ -495,6 +495,10 @@ class HTTPSConnection(HTTPConnection):
self.ca_cert_dir, self.ca_cert_dir,
self.ca_cert_data, self.ca_cert_data,
) )
@ -36,10 +36,10 @@ index 9066e6ade4..45580b7e1e 100644
# If no cert was provided, use only the default options for server # If no cert was provided, use only the default options for server
# certificate validation # certificate validation
diff --git a/test/conftest.py b/test/conftest.py diff --git a/test/conftest.py b/test/conftest.py
index ff8e463186..96c9b2b5bc 100644 index 10c3a54..d4bbd97 100644
--- a/test/conftest.py --- a/test/conftest.py
+++ b/test/conftest.py +++ b/test/conftest.py
@@ -64,6 +64,17 @@ def no_san_server(tmp_path_factory): @@ -103,6 +103,17 @@ def no_san_server(tmp_path_factory):
yield cfg yield cfg
@ -55,18 +55,16 @@ index ff8e463186..96c9b2b5bc 100644
+ +
+ +
@pytest.fixture @pytest.fixture
def ip_san_server(tmp_path_factory): def no_san_proxy(tmp_path_factory):
tmpdir = tmp_path_factory.mktemp("certs") tmpdir = tmp_path_factory.mktemp("certs")
diff --git a/test/with_dummyserver/test_proxy_poolmanager.py b/test/with_dummyserver/test_proxy_poolmanager.py diff --git a/test/with_dummyserver/test_proxy_poolmanager.py b/test/with_dummyserver/test_proxy_poolmanager.py
index 737e5f7afa..c1535bd087 100644 index d5e91a0..0f8df60 100644
--- a/test/with_dummyserver/test_proxy_poolmanager.py --- a/test/with_dummyserver/test_proxy_poolmanager.py
+++ b/test/with_dummyserver/test_proxy_poolmanager.py +++ b/test/with_dummyserver/test_proxy_poolmanager.py
@@ -543,3 +543,25 @@ def test_basic_ipv6_proxy(self): @@ -565,6 +565,26 @@ class TestIPv6HTTPProxyManager(IPv6HTTPDummyProxyTestCase):
r = http.request("GET", "%s/" % self.https_url) r = http.request("GET", "%s/" % self.https_url)
assert r.status == 200 assert r.status == 200
+
+
+class TestHTTPSProxyVerification: +class TestHTTPSProxyVerification:
+ @onlyPy3 + @onlyPy3
+ def test_https_proxy_hostname_verification(self, no_localhost_san_server): + def test_https_proxy_hostname_verification(self, no_localhost_san_server):
@ -87,3 +85,9 @@ index 737e5f7afa..c1535bd087 100644
+ assert "hostname 'localhost' doesn't match" in str( + assert "hostname 'localhost' doesn't match" in str(
+ e.value.reason + e.value.reason
+ ) or "Hostname mismatch" in str(e.value.reason) + ) or "Hostname mismatch" in str(e.value.reason)
class TestHTTPSProxyVerification:
@onlyPy3
--
2.27.0

View File

@ -1,64 +0,0 @@
From 2d4a3fee6de2fa45eb82169361918f759269b4ec Mon Sep 17 00:00:00 2001
From: Seth Michael Larson <sethmichaellarson@gmail.com>
Date: Wed, 26 May 2021 10:43:12 -0500
Subject: [PATCH] Improve performance of sub-authority splitting in URL
---
src/urllib3/util/url.py | 8 +++++---
test/test_util.py | 10 ++++++++++
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py
index 793324e..318a6d6 100644
--- a/src/urllib3/util/url.py
+++ b/src/urllib3/util/url.py
@@ -63,12 +63,12 @@ IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT + "$")
BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT[2:-2] + "$")
ZONE_ID_RE = re.compile("(" + ZONE_ID_PAT + r")\]$")
-SUBAUTHORITY_PAT = (u"^(?:(.*)@)?(%s|%s|%s)(?::([0-9]{0,5}))?$") % (
+_HOST_PORT_PAT = ("^(%s|%s|%s)(?::([0-9]{0,5}))?$") % (
REG_NAME_PAT,
IPV4_PAT,
IPV6_ADDRZ_PAT,
)
-SUBAUTHORITY_RE = re.compile(SUBAUTHORITY_PAT, re.UNICODE | re.DOTALL)
+_HOST_PORT_RE = re.compile(_HOST_PORT_PAT, re.UNICODE | re.DOTALL)
UNRESERVED_CHARS = set(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-~"
@@ -365,7 +365,9 @@ def parse_url(url):
scheme = scheme.lower()
if authority:
- auth, host, port = SUBAUTHORITY_RE.match(authority).groups()
+ auth, _, host_port = authority.rpartition("@")
+ auth = auth or None
+ host, port = _HOST_PORT_RE.match(host_port).groups()
if auth and normalize_uri:
auth = _encode_invalid_chars(auth, USERINFO_CHARS)
if port == "":
diff --git a/test/test_util.py b/test/test_util.py
index 838c751..ef6aa11 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -437,6 +437,16 @@ class TestUtil(object):
fragment="hash",
),
),
+ # Tons of '@' causing backtracking
+ ("https://" + ("@" * 10000) + "[", False),
+ (
+ "https://user:" + ("@" * 10000) + "example.com",
+ Url(
+ scheme="https",
+ auth="user:" + ("%40" * 9999),
+ host="example.com",
+ ),
+ ),
]
@pytest.mark.parametrize("url, expected_url", url_vulnerabilities)
--
2.23.0

View File

@ -2,8 +2,8 @@
%bcond_without tests %bcond_without tests
Name: python-%{srcname} Name: python-%{srcname}
Version: 1.26.3 Version: 1.26.7
Release: 3 Release: 1
Summary: Sanity-friendly HTTP client for Python Summary: Sanity-friendly HTTP client for Python
License: MIT License: MIT
URL: https://urllib3.readthedocs.io URL: https://urllib3.readthedocs.io
@ -12,7 +12,6 @@ Source1: ssl_match_hostname_py3.py
Patch0001: remove_mock.patch Patch0001: remove_mock.patch
Patch6000: backport-CVE-2021-28363.patch Patch6000: backport-CVE-2021-28363.patch
Patch6001: backport-CVE-2021-33503.patch
BuildArch: noarch BuildArch: noarch
@ -26,7 +25,7 @@ BuildRequires: python3-devel
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
%if %{with tests} %if %{with tests}
BuildRequires: python3-nose python3-mock python3-six python-idna python-dateutil BuildRequires: python3-cryptography python3-mock python3-six python-idna python-dateutil
BuildRequires: python3-pysocks python3-pytest python3-tornado python-trustme BuildRequires: python3-pysocks python3-pytest python3-tornado python-trustme
%endif %endif
@ -49,8 +48,8 @@ rm -rf test/test_no_ssl.py
%install %install
%py3_install %py3_install
rm -rf %{buildroot}%{python3_sitelib}/urllib3/packages/six.py* rm -rf %{buildroot}%{python3_sitelib}/urllib3/packages/six.py
rm -rf %{buildroot}%{python3_sitelib}/urllib3/packages/__pycache__/six* rm -rf %{buildroot}%{python3_sitelib}/urllib3/packages/__pycache__/six.*
rm -rf %{buildroot}%{python3_sitelib}/urllib3/packages/ssl_match_hostname/ rm -rf %{buildroot}%{python3_sitelib}/urllib3/packages/ssl_match_hostname/
mkdir -p %{buildroot}/%{python3_sitelib}/urllib3/packages/ mkdir -p %{buildroot}/%{python3_sitelib}/urllib3/packages/
@ -69,11 +68,14 @@ PYTHONPATH=%{buildroot}%{python3_sitelib}:%{python3_sitelib} %{__python3} -m pyt
%files -n python3-urllib3 %files -n python3-urllib3
%defattr(-,root,root) %defattr(-,root,root)
%license LICENSE.txt %license LICENSE.txt
%doc CHANGES.rst README.rst CONTRIBUTORS.txt %doc CHANGES.rst README.rst
%{python3_sitelib}/urllib3/ %{python3_sitelib}/urllib3/
%{python3_sitelib}/urllib3-*.egg-info %{python3_sitelib}/urllib3-*.egg-info
%changelog %changelog
* Wed Jan 19 2022 wangkerong <wangkerong@huawei.com> - 1.26.7-1
- update to 1.26.7 and remove python-nose dependency
* Mon Jul 5 2021 zhanzhimin <zhanzhimin@huawei.com> - 1.26.3-3 * Mon Jul 5 2021 zhanzhimin <zhanzhimin@huawei.com> - 1.26.3-3
- fix CVE-2021-33503 - fix CVE-2021-33503