@bobfrankston/mailx-types 0.1.55 → 0.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +25 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -479,9 +479,32 @@ export function displayNameClaimsOtherAddress(name, address) {
|
|
|
479
479
|
const m = n.match(/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g);
|
|
480
480
|
if (!m)
|
|
481
481
|
return null;
|
|
482
|
+
const realDomain = real.split("@").pop() || "";
|
|
482
483
|
for (const claimed of m) {
|
|
483
|
-
if (claimed.toLowerCase()
|
|
484
|
-
|
|
484
|
+
if (claimed.toLowerCase() === real)
|
|
485
|
+
continue;
|
|
486
|
+
// Same organisation is not impersonation. Plenty of legitimate senders
|
|
487
|
+
// put a contact address in the display name that differs from the
|
|
488
|
+
// envelope address at the same org — IEEE Xplore alerts arrive as
|
|
489
|
+
// `"Content-Alert@ieee.org" <no-reply@xplore.ieee.org>`, which the
|
|
490
|
+
// first cut flagged in danger red and read as a spam marker
|
|
491
|
+
// (Bob 2026-08-20: "marked as spam but is a valid message"; that
|
|
492
|
+
// message passes SPF, DKIM and DMARC and SpamAssassin scores it -2.0).
|
|
493
|
+
//
|
|
494
|
+
// Sub/parent-domain rather than "same registrable domain" on purpose:
|
|
495
|
+
// comparing the last two labels would treat paypal.co.uk and
|
|
496
|
+
// evil.co.uk as related, which is exactly the case that must stay
|
|
497
|
+
// flagged. A subdomain relationship cannot be forged across orgs.
|
|
498
|
+
const claimedDomain = claimed.toLowerCase().split("@").pop() || "";
|
|
499
|
+
if (claimedDomain && realDomain) {
|
|
500
|
+
if (claimedDomain === realDomain)
|
|
501
|
+
continue;
|
|
502
|
+
if (claimedDomain.endsWith("." + realDomain))
|
|
503
|
+
continue;
|
|
504
|
+
if (realDomain.endsWith("." + claimedDomain))
|
|
505
|
+
continue;
|
|
506
|
+
}
|
|
507
|
+
return claimed;
|
|
485
508
|
}
|
|
486
509
|
return null;
|
|
487
510
|
}
|