summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2019-11-05 23:38:13 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-18 14:42:13 +0000
commitd865ce715400479129047d4426f9d78fb8873280 (patch)
tree27924e4f9eddcb9e07adbf5cc6137807a6239122
parent66f4295cbfe506e873e79d48aeb1d7bf6a78c4d1 (diff)
downloadpoky-d865ce715400479129047d4426f9d78fb8873280.tar.gz
python3: Upgrade 3.7.4 -> 3.7.5
Backported patch removed. 3.7.5 also includes the fix for CVE-2019-16935. (From OE-Core rev: deabbb60b98418bd4fcf97adc3293b65d3ff306e) Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch2
-rw-r--r--meta/recipes-devtools/python/python3/0001-bpo-34155-Dont-parse-domains-containing-GH-13079.patch132
-rw-r--r--meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch2
-rw-r--r--meta/recipes-devtools/python/python3_3.7.5.bb (renamed from meta/recipes-devtools/python/python3_3.7.4.bb)5
4 files changed, 4 insertions, 137 deletions
diff --git a/meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch b/meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch
index 661f52d01f..ea75262c4f 100644
--- a/meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch
+++ b/meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch
@@ -70,7 +70,7 @@ index 6e81b2f..671a20e 100644
70 70
71 Programs/python.o: $(srcdir)/Programs/python.c 71 Programs/python.o: $(srcdir)/Programs/python.c
72@@ -856,7 +857,7 @@ regen-opcode: 72@@ -856,7 +857,7 @@ regen-opcode:
73 Python/compile.o Python/symtable.o Python/ast_unparse.o Python/ast.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h 73 Python/compile.o Python/symtable.o Python/ast_unparse.o Python/ast.o Python/future.o Parser/parsetok.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h
74 74
75 Python/getplatform.o: $(srcdir)/Python/getplatform.c 75 Python/getplatform.o: $(srcdir)/Python/getplatform.c
76- $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c 76- $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
diff --git a/meta/recipes-devtools/python/python3/0001-bpo-34155-Dont-parse-domains-containing-GH-13079.patch b/meta/recipes-devtools/python/python3/0001-bpo-34155-Dont-parse-domains-containing-GH-13079.patch
deleted file mode 100644
index 319e7ed07e..0000000000
--- a/meta/recipes-devtools/python/python3/0001-bpo-34155-Dont-parse-domains-containing-GH-13079.patch
+++ /dev/null
@@ -1,132 +0,0 @@
1From 90d56127ae15b1e452755e62c77dc475dedf7161 Mon Sep 17 00:00:00 2001
2From: jpic <jpic@users.noreply.github.com>
3Date: Wed, 17 Jul 2019 23:54:25 +0200
4Subject: [PATCH] bpo-34155: Dont parse domains containing @ (GH-13079)
5
6Before:
7
8 >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses
9 (Address(display_name='', username='a', domain='malicious.org'),)
10
11 >>> parseaddr('a@malicious.org@important.com')
12 ('', 'a@malicious.org')
13
14 After:
15
16 >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses
17 (Address(display_name='', username='', domain=''),)
18
19 >>> parseaddr('a@malicious.org@important.com')
20 ('', 'a@')
21
22https://bugs.python.org/issue34155
23
24Upstream-Status: Backport [https://github.com/python/cpython/commit/8cb65d1381b027f0b09ee36bfed7f35bb4dec9a9]
25
26CVE: CVE-2019-16056
27
28Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
29---
30 Lib/email/_header_value_parser.py | 2 ++
31 Lib/email/_parseaddr.py | 11 ++++++++++-
32 Lib/test/test_email/test__header_value_parser.py | 10 ++++++++++
33 Lib/test/test_email/test_email.py | 14 ++++++++++++++
34 .../2019-05-04-13-33-37.bpo-34155.MJll68.rst | 1 +
35 5 files changed, 37 insertions(+), 1 deletion(-)
36 create mode 100644 Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst
37
38diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
39index fc00b4a098..bbc026ec71 100644
40--- a/Lib/email/_header_value_parser.py
41+++ b/Lib/email/_header_value_parser.py
42@@ -1582,6 +1582,8 @@ def get_domain(value):
43 token, value = get_dot_atom(value)
44 except errors.HeaderParseError:
45 token, value = get_atom(value)
46+ if value and value[0] == '@':
47+ raise errors.HeaderParseError('Invalid Domain')
48 if leader is not None:
49 token[:0] = [leader]
50 domain.append(token)
51diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py
52index cdfa3729ad..41ff6f8c00 100644
53--- a/Lib/email/_parseaddr.py
54+++ b/Lib/email/_parseaddr.py
55@@ -379,7 +379,12 @@ class AddrlistClass:
56 aslist.append('@')
57 self.pos += 1
58 self.gotonext()
59- return EMPTYSTRING.join(aslist) + self.getdomain()
60+ domain = self.getdomain()
61+ if not domain:
62+ # Invalid domain, return an empty address instead of returning a
63+ # local part to denote failed parsing.
64+ return EMPTYSTRING
65+ return EMPTYSTRING.join(aslist) + domain
66
67 def getdomain(self):
68 """Get the complete domain name from an address."""
69@@ -394,6 +399,10 @@ class AddrlistClass:
70 elif self.field[self.pos] == '.':
71 self.pos += 1
72 sdlist.append('.')
73+ elif self.field[self.pos] == '@':
74+ # bpo-34155: Don't parse domains with two `@` like
75+ # `a@malicious.org@important.com`.
76+ return EMPTYSTRING
77 elif self.field[self.pos] in self.atomends:
78 break
79 else:
80diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py
81index 693487bc96..7dc4de1b7b 100644
82--- a/Lib/test/test_email/test__header_value_parser.py
83+++ b/Lib/test/test_email/test__header_value_parser.py
84@@ -1438,6 +1438,16 @@ class TestParser(TestParserMixin, TestEmailBase):
85 self.assertEqual(addr_spec.domain, 'example.com')
86 self.assertEqual(addr_spec.addr_spec, 'star.a.star@example.com')
87
88+ def test_get_addr_spec_multiple_domains(self):
89+ with self.assertRaises(errors.HeaderParseError):
90+ parser.get_addr_spec('star@a.star@example.com')
91+
92+ with self.assertRaises(errors.HeaderParseError):
93+ parser.get_addr_spec('star@a@example.com')
94+
95+ with self.assertRaises(errors.HeaderParseError):
96+ parser.get_addr_spec('star@172.17.0.1@example.com')
97+
98 # get_obs_route
99
100 def test_get_obs_route_simple(self):
101diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
102index c29cc56203..aa775881c5 100644
103--- a/Lib/test/test_email/test_email.py
104+++ b/Lib/test/test_email/test_email.py
105@@ -3041,6 +3041,20 @@ class TestMiscellaneous(TestEmailBase):
106 self.assertEqual(utils.parseaddr('<>'), ('', ''))
107 self.assertEqual(utils.formataddr(utils.parseaddr('<>')), '')
108
109+ def test_parseaddr_multiple_domains(self):
110+ self.assertEqual(
111+ utils.parseaddr('a@b@c'),
112+ ('', '')
113+ )
114+ self.assertEqual(
115+ utils.parseaddr('a@b.c@c'),
116+ ('', '')
117+ )
118+ self.assertEqual(
119+ utils.parseaddr('a@172.17.0.1@c'),
120+ ('', '')
121+ )
122+
123 def test_noquote_dump(self):
124 self.assertEqual(
125 utils.formataddr(('A Silly Person', 'person@dom.ain')),
126diff --git a/Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst b/Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst
127new file mode 100644
128index 0000000000..50292e29ed
129--- /dev/null
130+++ b/Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst
131@@ -0,0 +1 @@
132+Fix parsing of invalid email addresses with more than one ``@`` (e.g. a@b@c.com.) to not return the part before 2nd ``@`` as valid email address. Patch by maxking & jpic.
diff --git a/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch b/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch
index 5735954628..a0ea897f4e 100644
--- a/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch
+++ b/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch
@@ -63,7 +63,7 @@ index a7de901..4a3681f 100644
63+ case $cc_basename in 63+ case $cc_basename in
64 *clang*) 64 *clang*)
65 AC_SUBST(LLVM_AR) 65 AC_SUBST(LLVM_AR)
66 AC_PATH_TARGET_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path}) 66 AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path})
67@@ -1426,7 +1427,7 @@ then 67@@ -1426,7 +1427,7 @@ then
68 fi 68 fi
69 fi 69 fi
diff --git a/meta/recipes-devtools/python/python3_3.7.4.bb b/meta/recipes-devtools/python/python3_3.7.5.bb
index ce1a462791..c560c4a29d 100644
--- a/meta/recipes-devtools/python/python3_3.7.4.bb
+++ b/meta/recipes-devtools/python/python3_3.7.5.bb
@@ -28,7 +28,6 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
28 file://reformat_sysconfig.py \ 28 file://reformat_sysconfig.py \
29 file://0001-Use-FLAG_REF-always-for-interned-strings.patch \ 29 file://0001-Use-FLAG_REF-always-for-interned-strings.patch \
30 file://0001-test_locale.py-correct-the-test-output-format.patch \ 30 file://0001-test_locale.py-correct-the-test-output-format.patch \
31 file://0001-bpo-34155-Dont-parse-domains-containing-GH-13079.patch \
32 " 31 "
33 32
34SRC_URI_append_class-native = " \ 33SRC_URI_append_class-native = " \
@@ -39,8 +38,8 @@ SRC_URI_append_class-nativesdk = " \
39 file://0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch \ 38 file://0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch \
40 " 39 "
41 40
42SRC_URI[md5sum] = "d33e4aae66097051c2eca45ee3604803" 41SRC_URI[md5sum] = "08ed8030b1183107c48f2092e79a87e2"
43SRC_URI[sha256sum] = "fb799134b868199930b75f26678f18932214042639cd52b16da7fd134cd9b13f" 42SRC_URI[sha256sum] = "e85a76ea9f3d6c485ec1780fca4e500725a4a7bbc63c78ebc44170de9b619d94"
44 43
45# exclude pre-releases for both python 2.x and 3.x 44# exclude pre-releases for both python 2.x and 3.x
46UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar" 45UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"