Skip to content

Commit

Permalink
Fix DMARC fo parser to allow multiple values.
Browse files Browse the repository at this point in the history
The DMARC parser for the forensic reporting options tag (`fo`) did
not support multiple values, in violation of the specification.
This commit fixes the parser so that tokens such as "fo=0:1:s:d"
are correctly recognized as valid.
  • Loading branch information
rhymeswithmogul committed Dec 7, 2023
1 parent b8741be commit 74266f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# MailPolicyExplainer Change Log

## Version 1.3.1 (Wednesday, December 9, 2023)
- **FIX** The DMARC `fo` token is now parsed correctly when multiple values are present.
- **FIX** The DMARC `rf` token is now parsed correctly.

## Version 1.3.0 (Tuesday, November 7, 2023)
Expand Down
4 changes: 3 additions & 1 deletion MailPolicyExplainer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ PrivateData = @{
IconUri = 'https://raw.githubusercontent.com/rhymeswithmogul/MailPolicyExplainer/main/icon/PSGallery.png'

# ReleaseNotes of this module
ReleaseNotes = '- The DMARC "rf" token is now parsed correctly.'
ReleaseNotes = 'This release fixes many bugs:
- The DMARC `fo` token is now parsed correctly when multiple values are present.
- The DMARC `rf` token is now parsed correctly.'

} # End of PSData hashtable

Expand Down
2 changes: 1 addition & 1 deletion src/MailPolicyExplainer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ Function Test-DmarcRecord
}
ElseIf ($token -Like 'fo=*') {
If ($DmarcRecord -Match 'ruf=') {
Switch ($token -Replace 'fo=') {
Switch ($token.Substring(3) -Split ':') {
0 { Write-Informational 'DMARC: Generate a forensic report if SPF and DKIM both fail (default).' }
1 { Write-Informational 'DMARC: Generate a forensic report if either SPF or DKIM fail.'}
'd' { Write-Informational 'DMARC: Generate a forensic report if DKIM fails, even if DMARC passes.' }
Expand Down

0 comments on commit 74266f2

Please sign in to comment.