authres_status
authres_status copied to clipboard
Wrong regex for extracting From domain
The following line uses a regular expression to attempt extracting the domain name of the From header:
https://github.com/pimlie/authres_status/blob/eba58333b1b8e3f0028796857719e77a4dfb767d/authres_status.php#L353
However this regular expression is incorrect, for several reasons:
- domain name labels (including top-level domains) may also contain hyphens;
- TLDs exist that are more than 4 characters long, e.g.
.paris
(and there are much longer TLDs on ICANN’s list).
On a closed test network where I was using domain names ending in .example
, this causes an e-mail whose sender domain is sender.example
to be labeled STATUS_THIRD
by this plugin despite SPF, DKIM and DMARC passing, all at sender.example
. Adjusting the {2,4}
to {2,7}
as a test yielded STATUS_PASS
instead.