Compare commits

...

11 Commits

Author SHA1 Message Date
openeuler-ci-bot
428794e8c7
!108 [sync] PR-104: fix CVE-2024-37891
From: @openeuler-sync-bot 
Reviewed-by: @zengwefeng 
Signed-off-by: @zengwefeng
2024-07-16 09:12:46 +00:00
chengyechun
73ccd2269b fix CVE-2024-37891
(cherry picked from commit f94cef58e3319ac235c642aec283ee89ef3605aa)
2024-07-16 16:49:59 +08:00
openeuler-ci-bot
907cd76381
!97 update python-urllib3 to version 1.26.18
From: @chengyechun 
Reviewed-by: @robertxw 
Signed-off-by: @robertxw
2024-02-06 03:09:16 +00:00
chengyechun
7df32e14fd update to python-urllib3-1.26.18 2024-02-06 01:53:39 +00:00
openeuler-ci-bot
6ac8d6a0b1
!89 fix CVE-2023-45803
From: @chengyechun 
Reviewed-by: @gebidelidaye 
Signed-off-by: @gebidelidaye
2023-11-01 02:15:21 +00:00
chengyechun
f04f587a91 fix CVE-2023-45803 2023-10-31 20:31:38 +08:00
openeuler-ci-bot
1874e537e7
!78 Update to version 1.26.17 to fix CVE-2023-43804
From: @fundawang 
Reviewed-by: @sunsuwan 
Signed-off-by: @sunsuwan
2023-10-10 03:09:10 +00:00
root
2a34220a3d 1.26.17 2023-10-04 21:27:19 +08:00
openeuler-ci-bot
1e7e884a98
!77 Delete unnecessary patches.
From: @chengyechun 
Reviewed-by: @robertxw 
Signed-off-by: @robertxw
2023-08-01 11:31:30 +00:00
chengyechun
646a9b1dc8 delete the patch 2023-08-01 17:13:02 +08:00
openeuler-ci-bot
26d287ff04
!76 update to urllib3-1.26.16
From: @chengyechun 
Reviewed-by: @kircher 
Signed-off-by: @kircher
2023-08-01 08:25:37 +00:00
5 changed files with 103 additions and 96 deletions

Binary file not shown.

BIN
1.26.18.tar.gz Normal file

Binary file not shown.

View File

@ -1,93 +0,0 @@
From 8d65ea1ecf6e2cdc27d42124e587c1b83a3118b0 Mon Sep 17 00:00:00 2001
From: Jorge <JALopezSilva@gmail.com>
Date: Mon, 15 Mar 2021 06:49:49 -0700
Subject: [PATCH] Merge pull request from GHSA-5phf-pp7p-vc2r
* Enable hostname verification for HTTPS proxies with default cert.
Signed-off-by: Jorge Lopez Silva <jalopezsilva@gmail.com>
* Adjust exception check for Python 3.9+
Signed-off-by: Jorge Lopez Silva <jalopezsilva@gmail.com>
* Use a SAN instead of a common name.
Signed-off-by: Jorge Lopez Silva <jalopezsilva@gmail.com>
---
src/urllib3/connection.py | 4 ++++
test/conftest.py | 11 ++++++++++
.../test_proxy_poolmanager.py | 20 +++++++++++++++++++
3 files changed, 35 insertions(+)
diff --git a/src/urllib3/connection.py b/src/urllib3/connection.py
index 60f70f7..f59f29b 100644
--- a/src/urllib3/connection.py
+++ b/src/urllib3/connection.py
@@ -495,6 +495,10 @@ class HTTPSConnection(HTTPConnection):
self.ca_cert_dir,
self.ca_cert_data,
)
+ # By default urllib3's SSLContext disables `check_hostname` and uses
+ # a custom check. For proxies we're good with relying on the default
+ # verification.
+ ssl_context.check_hostname = True
# If no cert was provided, use only the default options for server
# certificate validation
diff --git a/test/conftest.py b/test/conftest.py
index 10c3a54..d4bbd97 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -103,6 +103,17 @@ def no_san_server(tmp_path_factory):
yield cfg
+@pytest.fixture
+def no_localhost_san_server(tmp_path_factory):
+ tmpdir = tmp_path_factory.mktemp("certs")
+ ca = trustme.CA()
+ # non localhost common name
+ server_cert = ca.issue_cert(u"example.com")
+
+ with run_server_in_thread("https", "localhost", tmpdir, ca, server_cert) as cfg:
+ yield cfg
+
+
@pytest.fixture
def no_san_proxy(tmp_path_factory):
tmpdir = tmp_path_factory.mktemp("certs")
diff --git a/test/with_dummyserver/test_proxy_poolmanager.py b/test/with_dummyserver/test_proxy_poolmanager.py
index d5e91a0..0f8df60 100644
--- a/test/with_dummyserver/test_proxy_poolmanager.py
+++ b/test/with_dummyserver/test_proxy_poolmanager.py
@@ -565,6 +565,26 @@ class TestIPv6HTTPProxyManager(IPv6HTTPDummyProxyTestCase):
r = http.request("GET", "%s/" % self.https_url)
assert r.status == 200
+class TestHTTPSProxyVerification:
+ @onlyPy3
+ def test_https_proxy_hostname_verification(self, no_localhost_san_server):
+ bad_server = no_localhost_san_server
+ bad_proxy_url = "https://%s:%s" % (bad_server.host, bad_server.port)
+
+ # An exception will be raised before we contact the destination domain.
+ test_url = "testing.com"
+ with proxy_from_url(bad_proxy_url, ca_certs=bad_server.ca_certs) as https:
+ with pytest.raises(MaxRetryError) as e:
+ https.request("GET", "http://%s/" % test_url)
+ assert isinstance(e.value.reason, SSLError)
+ assert "hostname 'localhost' doesn't match" in str(e.value.reason)
+
+ with pytest.raises(MaxRetryError) as e:
+ https.request("GET", "https://%s/" % test_url)
+ assert isinstance(e.value.reason, SSLError)
+ assert "hostname 'localhost' doesn't match" in str(
+ e.value.reason
+ ) or "Hostname mismatch" in str(e.value.reason)
class TestHTTPSProxyVerification:
@onlyPy3
--
2.27.0

View File

@ -0,0 +1,72 @@
From accff72ecc2f6cf5a76d9570198a93ac7c90270e Mon Sep 17 00:00:00 2001
From: Quentin Pradet <quentin.pradet@gmail.com>
Date: Mon, 17 Jun 2024 11:09:06 +0400
Subject: [PATCH] Merge pull request from GHSA-34jh-p97f-mpxf
* Strip Proxy-Authorization header on redirects
* Fix test_retry_default_remove_headers_on_redirect
* Set release date
Conflict:test/with_dummyserver/test_poolmanager.py hsa not been modified
because it has been deleted in the pre-phase of the spec file
Reference:https://github.com/urllib3/urllib3/commit/accff72ecc2f6cf5a76d9570198a93ac7c90270e
---
CHANGES.rst | 5 +++++
src/urllib3/util/retry.py | 4 +++-
test/test_retry.py | 6 +++++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index 3a0a4f0..eba0814 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,11 @@
Changes
=======
+2.2.2 (2024-06-17)
+==================
+
+- Added the ``Proxy-Authorization`` header to the list of headers to strip from requests when redirecting to a different host. As before, different headers can be set via ``Retry.remove_headers_on_redirect``.
+
1.26.18 (2023-10-17)
--------------------
diff --git a/src/urllib3/util/retry.py b/src/urllib3/util/retry.py
index 60ef6c4..9a1e90d 100644
--- a/src/urllib3/util/retry.py
+++ b/src/urllib3/util/retry.py
@@ -235,7 +235,9 @@ class Retry(object):
RETRY_AFTER_STATUS_CODES = frozenset([413, 429, 503])
#: Default headers to be used for ``remove_headers_on_redirect``
- DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset(["Cookie", "Authorization"])
+ DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset(
+ ["Cookie", "Authorization", "Proxy-Authorization"]
+ )
#: Maximum backoff time.
DEFAULT_BACKOFF_MAX = 120
diff --git a/test/test_retry.py b/test/test_retry.py
index 6475f2a..a0463e4 100644
--- a/test/test_retry.py
+++ b/test/test_retry.py
@@ -296,7 +296,11 @@ class TestRetry(object):
def test_retry_default_remove_headers_on_redirect(self):
retry = Retry()
- assert retry.remove_headers_on_redirect == {"authorization", "cookie"}
+ assert retry.remove_headers_on_redirect == {
+ "authorization",
+ "proxy-authorization",
+ "cookie",
+ }
def test_retry_set_remove_headers_on_redirect(self):
retry = Retry(remove_headers_on_redirect=["X-API-Secret"])
--
2.33.0

View File

@ -2,8 +2,8 @@
%bcond_without tests %bcond_without tests
Name: python-%{srcname} Name: python-%{srcname}
Version: 1.26.16 Version: 1.26.18
Release: 1 Release: 2
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
@ -11,7 +11,8 @@ Source0: https://github.com/urllib3/urllib3/archive/refs/tags/%{version}.
Source1: ssl_match_hostname_py3.py Source1: ssl_match_hostname_py3.py
Patch0001: remove_mock.patch Patch0001: remove_mock.patch
Patch6000: backport-CVE-2021-28363.patch
Patch6000: backport-CVE-2024-37891-Strip-Proxy-Authorization-header-on-redirects.patch
BuildArch: noarch BuildArch: noarch
@ -77,6 +78,33 @@ PYTHONPATH=%{buildroot}%{python3_sitelib}:%{python3_sitelib} %{__python3} -m pyt
%{python3_sitelib}/urllib3-*.egg-info %{python3_sitelib}/urllib3-*.egg-info
%changelog %changelog
* Tue Jun 25 2024 chengyechun <chengyechun1@huawei.com> - 1.26.18-2
- Type:CVE
- CVE:CVE-2024-37891
- SUG:NA
- DESC:fix CVE-2024-37891 Strip Proxy-Authorizatioin header on redirects
* Tue Feb 06 2024 chengyechun <chengyechun1@huawei.com> - 1.26.18-1
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:update python-urllib3 to version 1.26.18
* Tue Oct 31 2023 chengyechun <chengyechun1@huawei.com> - 1.26.17-2
- Type:CVE
- ID:CVE-2023-45803
- SUG:NA
- DESC:fix CVE-2023-45803 Made body stripped form HTTP requests
* Wed Oct 04 2023 Funda Wang <fundawang@yeah.net> - 1.26.17-1
- Update to version 1.26.17 to fix CVE-2023-43804
* Tue Aug 01 2023 chengyechun <chengyechun1@huawei.com> - 1.26.16-2
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:delete the unnecessary patch
* Mon Jul 31 2023 chengyechun <chengyechun1@huawei.com> - 1.26.16-1 * Mon Jul 31 2023 chengyechun <chengyechun1@huawei.com> - 1.26.16-1
- Type:enhancement - Type:enhancement
- CVE:NA - CVE:NA