mirror of
https://github.com/domainaware/parsedmarc.git
synced 2026-10-28 21:35:41 +00:00
Land 10.0.3 changes on master (#785)
PR #784 was stacked on the #783 branch and its base was never retargeted to master, so it merged into fix/mailsuite-2.2.1-empty-address instead of master. master therefore has 10.0.2 (#783's squash) but is missing the 10.0.3 changes. This re-lands exactly that delta — the Reply-To/Delivered-To parser fix, the ES/OS Reply-To header flattening, and the Splunk/OpenSearch/Grafana failure dashboard fixes, with the version bumped to 10.0.3. No mailsuite re-bump (the >=2.2.1 floor is already on master from 10.0.2). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
2c8b2c0f14
commit
e104f1118c
12 files changed
+185
-9
No files matched your search
@@ -579,6 +579,46 @@ Body text"""
|
||||
self.assertEqual(result["subject"], "Test")
|
||||
self.assertEqual(result["reply_to"], [])
|
||||
|
||||
def testReplyToHeaderIsParsed(self):
|
||||
"""A Reply-To header populates reply_to with every address.
|
||||
|
||||
Regression: parse_email read mailparser's underscored
|
||||
``reply_to`` key, but mail_json names the header ``reply-to``,
|
||||
so the lookup always missed and every Reply-To address was
|
||||
silently dropped (reply_to was always []).
|
||||
"""
|
||||
email_str = (
|
||||
"From: Sender <sender@example.com>\r\n"
|
||||
"Reply-To: Real One <real@phish.example>,"
|
||||
" Second <two@phish.example>\r\n"
|
||||
"To: victim@example.org\r\n"
|
||||
"Subject: Hi\r\n\r\nBody\r\n"
|
||||
)
|
||||
result = parsedmarc.utils.parse_email(email_str)
|
||||
self.assertEqual(
|
||||
[a["address"] for a in result["reply_to"]],
|
||||
["real@phish.example", "two@phish.example"],
|
||||
)
|
||||
self.assertEqual(result["reply_to"][0]["display_name"], "Real One")
|
||||
|
||||
def testDeliveredToHeaderIsParsed(self):
|
||||
"""A Delivered-To header populates delivered_to.
|
||||
|
||||
Same hyphen/underscore key mismatch as reply_to: mail_json
|
||||
names the header ``delivered-to``, so reading ``delivered_to``
|
||||
dropped it.
|
||||
"""
|
||||
email_str = (
|
||||
"From: Sender <sender@example.com>\r\n"
|
||||
"Delivered-To: box@example.org\r\n"
|
||||
"To: box@example.org\r\n"
|
||||
"Subject: Hi\r\n\r\nBody\r\n"
|
||||
)
|
||||
result = parsedmarc.utils.parse_email(email_str)
|
||||
self.assertEqual(
|
||||
[a["address"] for a in result["delivered_to"]], ["box@example.org"]
|
||||
)
|
||||
|
||||
def testEmailWithNoSubject(self):
|
||||
"""parse_email defaults subject to None when missing"""
|
||||
email_str = """From: test@example.com
|
||||
|
||||
Reference in new issue
Block a user