import python-urllib3-1.24.2-2.el8
This commit is contained in:
parent
eb9ab3e516
commit
1182af9bec
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
SOURCES/urllib3-1.23.tar.gz
|
SOURCES/urllib3-1.24.2.tar.gz
|
||||||
|
@ -1 +1 @@
|
|||||||
8d1e5fded3c2e64132a2b01f5d7f14692dde1806 SOURCES/urllib3-1.23.tar.gz
|
02f5f10287e42a0e9d8666bbec9c51c4aec5bfc7 SOURCES/urllib3-1.24.2.tar.gz
|
||||||
|
162
SOURCES/CVE-2019-11236.patch
Normal file
162
SOURCES/CVE-2019-11236.patch
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
From 9f6aa6b5f06ecfcfea2084d88f377c6e9dba5ce2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ryan Petrello <rpetrell@redhat.com>
|
||||||
|
Date: Tue, 30 Apr 2019 12:36:48 -0400
|
||||||
|
Subject: [PATCH 1/3] prevent CVE-2019-9740 in 1.24.x
|
||||||
|
|
||||||
|
adapted from https://github.com/python/cpython/pull/12755
|
||||||
|
---
|
||||||
|
test/test_util.py | 5 +++++
|
||||||
|
src/urllib3/util/url.py | 8 ++++++++
|
||||||
|
2 files changed, 13 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/test/test_util.py b/test/test_util.py
|
||||||
|
index 73d9452..dc6ffd0 100644
|
||||||
|
--- a/test/test_util.py
|
||||||
|
+++ b/test/test_util.py
|
||||||
|
@@ -200,6 +200,11 @@ class TestUtil(object):
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
parse_url('[::1')
|
||||||
|
|
||||||
|
+ def test_parse_url_contains_control_characters(self):
|
||||||
|
+ # see CVE-2019-9740
|
||||||
|
+ with pytest.raises(LocationParseError):
|
||||||
|
+ parse_url('http://localhost:8000/ HTTP/1.1\r\nHEADER: INJECTED\r\nIgnore:')
|
||||||
|
+
|
||||||
|
def test_Url_str(self):
|
||||||
|
U = Url('http', host='google.com')
|
||||||
|
assert str(U) == U.url
|
||||||
|
diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py
|
||||||
|
index 6b6f996..e8e1bd7 100644
|
||||||
|
--- a/src/urllib3/util/url.py
|
||||||
|
+++ b/src/urllib3/util/url.py
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from collections import namedtuple
|
||||||
|
+import re
|
||||||
|
|
||||||
|
from ..exceptions import LocationParseError
|
||||||
|
|
||||||
|
@@ -10,6 +11,8 @@ url_attrs = ['scheme', 'auth', 'host', 'port', 'path', 'query', 'fragment']
|
||||||
|
# urllib3 infers URLs without a scheme (None) to be http.
|
||||||
|
NORMALIZABLE_SCHEMES = ('http', 'https', None)
|
||||||
|
|
||||||
|
+_contains_disallowed_url_pchar_re = re.compile('[\x00-\x20\x7f]')
|
||||||
|
+
|
||||||
|
|
||||||
|
class Url(namedtuple('Url', url_attrs)):
|
||||||
|
"""
|
||||||
|
@@ -155,6 +158,11 @@ def parse_url(url):
|
||||||
|
# Empty
|
||||||
|
return Url()
|
||||||
|
|
||||||
|
+ # Prevent CVE-2019-9740.
|
||||||
|
+ # adapted from https://github.com/python/cpython/pull/12755
|
||||||
|
+ if _contains_disallowed_url_pchar_re.search(url):
|
||||||
|
+ raise LocationParseError("URL can't contain control characters. {!r}".format(url))
|
||||||
|
+
|
||||||
|
scheme = None
|
||||||
|
auth = None
|
||||||
|
host = None
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
||||||
|
|
||||||
|
From ecc15bd412354ad916712113b0e426f8bc6cf52d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ryan Petrello <lists@ryanpetrello.com>
|
||||||
|
Date: Wed, 1 May 2019 16:46:44 -0400
|
||||||
|
Subject: [PATCH 2/3] avoid CVE-2019-9740 by percent-encoding invalid path
|
||||||
|
characters
|
||||||
|
|
||||||
|
this is to avoid breaking changes in downstream libraries like requests
|
||||||
|
---
|
||||||
|
test/test_util.py | 4 ++--
|
||||||
|
src/urllib3/util/url.py | 4 ++--
|
||||||
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/test/test_util.py b/test/test_util.py
|
||||||
|
index dc6ffd0..d139329 100644
|
||||||
|
--- a/test/test_util.py
|
||||||
|
+++ b/test/test_util.py
|
||||||
|
@@ -202,8 +202,8 @@ class TestUtil(object):
|
||||||
|
|
||||||
|
def test_parse_url_contains_control_characters(self):
|
||||||
|
# see CVE-2019-9740
|
||||||
|
- with pytest.raises(LocationParseError):
|
||||||
|
- parse_url('http://localhost:8000/ HTTP/1.1\r\nHEADER: INJECTED\r\nIgnore:')
|
||||||
|
+ url = parse_url('http://localhost:8000/ HTTP/1.1\r\nHEADER: INJECTED\r\nIgnore:')
|
||||||
|
+ assert url.path == '/%20HTTP/1.1%0D%0AHEADER:%20INJECTED%0D%0AIgnore:'
|
||||||
|
|
||||||
|
def test_Url_str(self):
|
||||||
|
U = Url('http', host='google.com')
|
||||||
|
diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py
|
||||||
|
index e8e1bd7..12b8d55 100644
|
||||||
|
--- a/src/urllib3/util/url.py
|
||||||
|
+++ b/src/urllib3/util/url.py
|
||||||
|
@@ -3,6 +3,7 @@ from collections import namedtuple
|
||||||
|
import re
|
||||||
|
|
||||||
|
from ..exceptions import LocationParseError
|
||||||
|
+from ..packages.six.moves.urllib.parse import quote
|
||||||
|
|
||||||
|
|
||||||
|
url_attrs = ['scheme', 'auth', 'host', 'port', 'path', 'query', 'fragment']
|
||||||
|
@@ -160,8 +161,7 @@ def parse_url(url):
|
||||||
|
|
||||||
|
# Prevent CVE-2019-9740.
|
||||||
|
# adapted from https://github.com/python/cpython/pull/12755
|
||||||
|
- if _contains_disallowed_url_pchar_re.search(url):
|
||||||
|
- raise LocationParseError("URL can't contain control characters. {!r}".format(url))
|
||||||
|
+ url = _contains_disallowed_url_pchar_re.sub(lambda match: quote(match.group()), url)
|
||||||
|
|
||||||
|
scheme = None
|
||||||
|
auth = None
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
||||||
|
|
||||||
|
From 6cda449df587fd37135ee76a9253dc8e12e53c05 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Seth Michael Larson <sethmichaellarson@gmail.com>
|
||||||
|
Date: Thu, 2 May 2019 09:02:24 -0500
|
||||||
|
Subject: [PATCH 3/3] Also test unicode and query
|
||||||
|
|
||||||
|
---
|
||||||
|
test/test_util.py | 22 +++++++++++++++++++---
|
||||||
|
1 file changed, 19 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/test/test_util.py b/test/test_util.py
|
||||||
|
index d139329..fa53aaf 100644
|
||||||
|
--- a/test/test_util.py
|
||||||
|
+++ b/test/test_util.py
|
||||||
|
@@ -200,10 +200,26 @@ class TestUtil(object):
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
parse_url('[::1')
|
||||||
|
|
||||||
|
- def test_parse_url_contains_control_characters(self):
|
||||||
|
+ @pytest.mark.parametrize('url, expected_url', [
|
||||||
|
+ (
|
||||||
|
+ 'http://localhost/ HTTP/1.1\r\nHEADER: INJECTED\r\nIgnore:',
|
||||||
|
+ Url('http', host='localhost', port=None,
|
||||||
|
+ path='/%20HTTP/1.1%0D%0AHEADER:%20INJECTED%0D%0AIgnore:')
|
||||||
|
+ ),
|
||||||
|
+ (
|
||||||
|
+ u'http://localhost/ HTTP/1.1\r\nHEADER: INJECTED\r\nIgnore:',
|
||||||
|
+ Url('http', host='localhost', port=None,
|
||||||
|
+ path='/%20HTTP/1.1%0D%0AHEADER:%20INJECTED%0D%0AIgnore:')
|
||||||
|
+ ),
|
||||||
|
+ (
|
||||||
|
+ 'http://localhost/ ?q=\r\n',
|
||||||
|
+ Url('http', host='localhost', path='/%20', query='q=%0D%0A')
|
||||||
|
+ ),
|
||||||
|
+ ])
|
||||||
|
+ def test_parse_url_contains_control_characters(self, url, expected_url):
|
||||||
|
# see CVE-2019-9740
|
||||||
|
- url = parse_url('http://localhost:8000/ HTTP/1.1\r\nHEADER: INJECTED\r\nIgnore:')
|
||||||
|
- assert url.path == '/%20HTTP/1.1%0D%0AHEADER:%20INJECTED%0D%0AIgnore:'
|
||||||
|
+ url = parse_url(url)
|
||||||
|
+ assert url == expected_url
|
||||||
|
|
||||||
|
def test_Url_str(self):
|
||||||
|
U = Url('http', host='google.com')
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
%global srcname urllib3
|
%global srcname urllib3
|
||||||
|
|
||||||
Name: python-%{srcname}
|
Name: python-%{srcname}
|
||||||
Version: 1.23
|
Version: 1.24.2
|
||||||
Release: 5%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: Python HTTP library with thread-safe connection pooling and file post
|
Summary: Python HTTP library with thread-safe connection pooling and file post
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
@ -12,6 +12,17 @@ Source0: %{url}/archive/%{version}/%{srcname}-%{version}.tar.gz
|
|||||||
Source1: ssl_match_hostname_py3.py
|
Source1: ssl_match_hostname_py3.py
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
|
# CVE-2019-11236 python-urllib3:
|
||||||
|
# - CRLF injection due to not encoding the '\r\n' sequence leading to
|
||||||
|
# possible attack on internal service.
|
||||||
|
# - Also known as CVE-2019-9740 (duplicate entry)
|
||||||
|
# Backported from:
|
||||||
|
# * https://github.com/urllib3/urllib3/pull/1591
|
||||||
|
# - Superfluous commits were omitted (flake8 checks, travis settings, macos patch)
|
||||||
|
# * https://github.com/urllib3/urllib3/pull/1593
|
||||||
|
Patch1: CVE-2019-11236.patch
|
||||||
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Python HTTP module with connection pooling and file POST abilities.
|
Python HTTP module with connection pooling and file POST abilities.
|
||||||
|
|
||||||
@ -37,6 +48,9 @@ Python3 HTTP module with connection pooling and file POST abilities.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{srcname}-%{version}
|
%setup -q -n %{srcname}-%{version}
|
||||||
|
|
||||||
|
%patch1 -p1
|
||||||
|
|
||||||
# Drop the dummyserver tests in koji.
|
# Drop the dummyserver tests in koji.
|
||||||
# These require tornado, a Web framework otherwise unused in the distro.
|
# These require tornado, a Web framework otherwise unused in the distro.
|
||||||
rm -rf test/with_dummyserver/
|
rm -rf test/with_dummyserver/
|
||||||
@ -48,6 +62,10 @@ rm -rf test/appengine/
|
|||||||
# to do with Fedora in particular. They don't fail in upstream build infrastructure
|
# to do with Fedora in particular. They don't fail in upstream build infrastructure
|
||||||
rm -rf test/contrib/
|
rm -rf test/contrib/
|
||||||
|
|
||||||
|
# Tests for Python built without SSL, but RHEL builds with SSL. These tests
|
||||||
|
# fail when combined with the unbundling of backports-ssl_match_hostname
|
||||||
|
rm -f test/test_no_ssl.py
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%py3_build
|
%py3_build
|
||||||
|
|
||||||
@ -61,17 +79,22 @@ 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/
|
||||||
ln -s ../../six.py %{buildroot}/%{python3_sitelib}/urllib3/packages/six.py
|
ln -s %{python3_sitelib}/six.py \
|
||||||
ln -s ../../../__pycache__/six.cpython-%{python3_version_nodots}.opt-1.pyc %{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/
|
%{buildroot}/%{python3_sitelib}/urllib3/packages/six.py
|
||||||
ln -s ../../../__pycache__/six.cpython-%{python3_version_nodots}.pyc %{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/
|
ln -s %{python3_sitelib}/__pycache__/six.cpython-%{python3_version_nodots}.opt-1.pyc \
|
||||||
|
%{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/
|
||||||
|
ln -s %{python3_sitelib}/__pycache__/six.cpython-%{python3_version_nodots}.pyc \
|
||||||
|
%{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/
|
||||||
# urllib3 requires Python 3.5 to use the standard library's match_hostname,
|
# urllib3 requires Python 3.5 to use the standard library's match_hostname,
|
||||||
# which we ship in Fedora 26, so we can safely replace the bundled version with
|
# which we ship in RHEL8, so we can safely replace the bundled version with
|
||||||
# this stub which imports the necessary objects.
|
# this stub which imports the necessary objects.
|
||||||
cp %{SOURCE1} %{buildroot}/%{python3_sitelib}/urllib3/packages/ssl_match_hostname.py
|
cp %{SOURCE1} %{buildroot}/%{python3_sitelib}/urllib3/packages/ssl_match_hostname.py
|
||||||
|
|
||||||
|
|
||||||
%check
|
%check
|
||||||
py.test-3
|
pushd test
|
||||||
|
PYTHONPATH=%{buildroot}%{python3_sitelib}:%{python3_sitelib} %{__python3} -m pytest -v
|
||||||
|
popd
|
||||||
|
|
||||||
|
|
||||||
%files -n python3-%{srcname}
|
%files -n python3-%{srcname}
|
||||||
@ -82,6 +105,15 @@ py.test-3
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed May 22 2019 Tomas Orsava <torsava@redhat.com> - 1.24.2-2
|
||||||
|
- Rebuilding after gating was enabled
|
||||||
|
- Resolves: rhbz#1703361 rhbz#1706026
|
||||||
|
|
||||||
|
* Fri May 03 2019 Tomas Orsava <torsava@redhat.com> - 1.24.2-1
|
||||||
|
- Rebased to 1.24.2 to fix CVE-2019-11324
|
||||||
|
- Added patches for CVE-2019-11236 (AKA CVE-2019-9740)
|
||||||
|
- Resolves: rhbz#1703361 rhbz#1706026
|
||||||
|
|
||||||
* Wed Jul 11 2018 Petr Viktorin <pviktori@redhat.com> - 1.23-5
|
* Wed Jul 11 2018 Petr Viktorin <pviktori@redhat.com> - 1.23-5
|
||||||
- Remove the Python 2 subpackage
|
- Remove the Python 2 subpackage
|
||||||
https://bugzilla.redhat.com/show_bug.cgi?id=1590400
|
https://bugzilla.redhat.com/show_bug.cgi?id=1590400
|
||||||
|
Loading…
Reference in New Issue
Block a user