aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/leaky.eml2
-rw-r--r--tests/test_parse.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/tests/fixtures/leaky.eml b/tests/fixtures/leaky.eml
index 840ce6d..f98d191 100644
--- a/tests/fixtures/leaky.eml
+++ b/tests/fixtures/leaky.eml
@@ -5,7 +5,7 @@ Received: from sender.example.invalid (unknown [203.0.113.42])
by mx.example.org (Postfix) with ESMTP id JJJ11
for <you@example.org>; Tue, 8 Sep 2026 16:00:01 +0200 (CEST)
Return-Path: <bounce@sender.example.invalid>
-From: "Billing at billing@innocent.example" <phish@sender.example.invalid>
+From: "Billing at you@example.org" <phish@sender.example.invalid>
To: <you@example.org>
Subject: Confirm now
Message-ID: <eee555@sender.example.invalid>
diff --git a/tests/test_parse.py b/tests/test_parse.py
index 49fc41e..de78b5a 100644
--- a/tests/test_parse.py
+++ b/tests/test_parse.py
@@ -108,6 +108,13 @@ class TestSenderDomains(unittest.TestCase):
domains = parse.sender_domains(load("simple.eml"))
self.assertNotIn("example.org", domains.values())
+ def test_the_domain_comes_from_the_address_not_the_display_name(self):
+ # A display name is attacker-controlled and sits BEFORE the angle
+ # brackets, so a regex scanning the raw header finds it first. Doing
+ # that files the report against whoever the attacker named.
+ domains = parse.sender_domains(load("leaky.eml"))
+ self.assertEqual(domains["from"], "sender.example.invalid")
+
class TestAuthResults(unittest.TestCase):
def test_verdicts_are_read_as_the_server_recorded_them(self):