python: add a fix for CVE-2019-9948 and CVE-2019-9636
PATCH 1/1 python: add a fix for CVE-2019-9948 and CVE-2019-9636
Signed-off-by Martin Jansa <[email protected]>
--- .../python/bpo-35907-cve-2019-9948-fix.patch | 55 +++++++++ .../python/bpo-35907-cve-2019-9948.patch | 55 +++++++++ .../python/bpo-36216-cve-2019-9636-fix.patch | 28 +++++ .../python/bpo-36216-cve-2019-9636.patch | 111 ++++++++++++++++++ meta/recipes-devtools/python/python_2.7.16.bb | 6 +- 5 files changed, 254 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/python/python/bpo-35907-cve-2019-9948-fix.patch create mode 100644 meta/recipes-devtools/python/python/bpo-35907-cve-2019-9948.patch create mode 100644 meta/recipes-devtools/python/python/bpo-36216-cve-2019-9636-fix.patch create mode 100644 meta/recipes-devtools/python/python/bpo-36216-cve-2019-9636.patch
meta/recipes-devtools/python/python/bpo-35907-cve-2019-9948-fix.patch new file +55 -0
@@ -0,0 +1,55 @@ +From 179a5f75f1121dab271fe8f90eb35145f9dcbbda Mon Sep 17 00:00:00 2001 +From: Sihoon Lee <[email protected]> +Date: Fri, 17 May 2019 02:41:06 +0900 +Subject: [PATCH] Update test_urllib.py and urllib.py\nchange assertEqual into + assertRasies in DummyURLopener test, and simplify mitigation + +Upstream-Status: Submitted https://github.com/python/cpython/pull/11842 + +CVE: CVE-2019-9948 + +Signed-off-by: Martin Jansa <[email protected]> +--- + Lib/test/test_urllib.py | 11 +++-------- + Lib/urllib.py | 4 ++-- + 2 files changed, 5 insertions(+), 10 deletions(-) + +diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py +index e5f210e62a18..1e23dfb0bb16 100644 +--- a/Lib/test/test_urllib.py ++++ b/Lib/test/test_urllib.py +@@ -1027,14 +1027,9 @@ def test_local_file_open(self): + class DummyURLopener(urllib.URLopener): + def open_local_file(self, url): + return url +- self.assertEqual(DummyURLopener().open( +- 'local-file://example'), '//example') +- self.assertEqual(DummyURLopener().open( +- 'local_file://example'), '//example') +- self.assertRaises(IOError, urllib.urlopen, +- 'local-file://example') +- self.assertRaises(IOError, urllib.urlopen, +- 'local_file://example') ++ for url in ('local_file://example', 'local-file://example'): ++ self.assertRaises(IOError, DummyURLopener().open, url) ++ self.assertRaises(IOError, urllib.urlopen, url) + + # Just commented them out. + # Can't really tell why keep failing in windows and sparc. +diff --git a/Lib/urllib.py b/Lib/urllib.py +index a24e9a5c68fb..39b834054e9e 100644 +--- a/Lib/urllib.py ++++ b/Lib/urllib.py +@@ -203,10 +203,10 @@ def open(self, fullurl, data=None): + name = 'open_' + urltype + self.type = urltype + name = name.replace('-', '_') +- ++ + # bpo-35907: # disallow the file reading with the type not allowed + if not hasattr(self, name) or \ +- (self == _urlopener and name == 'open_local_file'): ++ getattr(self, name) == self.open_local_file: + if proxy: + return self.open_unknown_proxy(proxy, fullurl, data) + else:
meta/recipes-devtools/python/python/bpo-35907-cve-2019-9948.patch new file +55 -0
55 lines not on this page · raw message
meta/recipes-devtools/python/python/bpo-36216-cve-2019-9636-fix.patch new file +28 -0
@@ -0,0 +1,28 @@ +From 06b5ee585d6e76bdbb4002f642d864d860cbbd2b Mon Sep 17 00:00:00 2001 +From: Steve Dower <[email protected]> +Date: Tue, 12 Mar 2019 08:23:33 -0700 +Subject: [PATCH] bpo-36216: Only print test messages when verbose + +CVE: CVE-2019-9636 + +Upstream-Status: Backport https://github.com/python/cpython/pull/12291/commits/06b5ee585d6e76bdbb4002f642d864d860cbbd2b + +Signed-off-by: Martin Jansa <[email protected]> +--- + Lib/test/test_urlparse.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py +index 73b0228ea8e3..1830d0b28688 100644 +--- a/Lib/test/test_urlparse.py ++++ b/Lib/test/test_urlparse.py +@@ -644,7 +644,8 @@ def test_urlsplit_normalization(self): + for scheme in [u"http", u"https", u"ftp"]: + for c in denorm_chars: + url = u"{}://netloc{}false.netloc/path".format(scheme, c) +- print "Checking %r" % url ++ if test_support.verbose: ++ print "Checking %r" % url + with self.assertRaises(ValueError): + urlparse.urlsplit(url) +
meta/recipes-devtools/python/python/bpo-36216-cve-2019-9636.patch new file +111 -0
111 lines not on this page · raw message
meta/recipes-devtools/python/python_2.7.16.bb +5 -1
@@ -30,7 +30,11 @@ SRC_URI += " \ file://support_SOURCE_DATE_EPOCH_in_py_compile_2.7.patch \ file://float-endian.patch \ file://0001-python2-use-cc_basename-to-replace-CC-for-checking-c.patch \ - " + file://bpo-35907-cve-2019-9948.patch \ + file://bpo-35907-cve-2019-9948-fix.patch \ + file://bpo-36216-cve-2019-9636.patch \ + file://bpo-36216-cve-2019-9636-fix.patch \ +" S = "${WORKDIR}/Python-${PV}"
Signature · 1 line
2.17.1