mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
bpo-34155: Dont parse domains containing @ (GH-13079)
Before: >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses (Address(display_name='', username='a', domain='malicious.org'),) >>> parseaddr('a@malicious.org@important.com') ('', 'a@malicious.org') After: >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses (Address(display_name='', username='', domain=''),) >>> parseaddr('a@malicious.org@important.com') ('', 'a@') https://bugs.python.org/issue34155
This commit is contained in:
parent
719a062bcb
commit
8cb65d1381
5 changed files with 37 additions and 1 deletions
|
@ -1448,6 +1448,16 @@ class TestParser(TestParserMixin, TestEmailBase):
|
|||
self.assertEqual(addr_spec.domain, 'example.com')
|
||||
self.assertEqual(addr_spec.addr_spec, 'star.a.star@example.com')
|
||||
|
||||
def test_get_addr_spec_multiple_domains(self):
|
||||
with self.assertRaises(errors.HeaderParseError):
|
||||
parser.get_addr_spec('star@a.star@example.com')
|
||||
|
||||
with self.assertRaises(errors.HeaderParseError):
|
||||
parser.get_addr_spec('star@a@example.com')
|
||||
|
||||
with self.assertRaises(errors.HeaderParseError):
|
||||
parser.get_addr_spec('star@172.17.0.1@example.com')
|
||||
|
||||
# get_obs_route
|
||||
|
||||
def test_get_obs_route_simple(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue