Fix incorrect alignment check behavior in DMARC strict mode #268
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current implementation incorrectly allows partial domain matches in strict
alignment mode. According to RFC 7489 Section 3.1.1 and 3.1.2, strict alignment
(adkim=s or aspf=s) requires an exact match between the RFC5322.From domain
and the domain being evaluated.
The issue occurs when Public Suffix List is configured. Current behavior with
strict mode shows an incorrect match:
From: [email protected], envelope from: [email protected]
Note: When Public Suffix List is not configured, this incorrect matching
does not occur because TLD resolution returns the entire domain unchanged.
The reverse case works correctly regardless of Public Suffix List configuration:
From: [email protected], envelope from: [email protected]
The problem affects both SPF (aspf=s) and DKIM (adkim=s) alignment checks
equally, as they use the same alignment checking function.
This patch:
The changes ensure proper implementation of RFC 7489's requirement that strict
mode must only allow exact matches between domains.