Skip to content

Commit

Permalink
Fix DMARC reporting format parser.
Browse files Browse the repository at this point in the history
The DMARC "rf" (reporting format) tag was not parsed correctly.  The
token name and equals sign was not stripped before breaking the value
down into a colon-separated list.  This quick fix corrects it.

Thanks to Chris for making me scan a domain of his, which showed me
this bug in action.
  • Loading branch information
rhymeswithmogul committed Dec 7, 2023
1 parent 01bb64d commit b8741be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# MailPolicyExplainer Change Log

## Version 1.3.1 (Wednesday, December 9, 2023)
- **FIX** The DMARC `rf` token is now parsed correctly.

## Version 1.3.0 (Tuesday, November 7, 2023)
- **NEW** `Test-SpfRecord` can now recursively evaluate SPF records to count how many DNS lookups are performed when evaluating `redirect=` modifiers and `include:` tokens. Use either `Test-SpfRecord -CountDnsLookups`, `Test-SpfRecord -Recurse`, or `Test-MailPolicy -CountSpfDnsLookups` to use this new mode. Note that this overrides the new behavior introduced in version 1.2.0.
- **FIX** Fixed grammar in some `Test-SpfRecord` messages.
Expand Down
6 changes: 2 additions & 4 deletions MailPolicyExplainer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'src/MailPolicyExplainer.psm1'

# Version number of this module.
ModuleVersion = '1.3.0'
ModuleVersion = '1.3.1'

# Supported PSEditions
CompatiblePSEditions = @('Core', 'Desktop')
Expand Down Expand Up @@ -167,9 +167,7 @@ PrivateData = @{
IconUri = 'https://raw.githubusercontent.com/rhymeswithmogul/MailPolicyExplainer/main/icon/PSGallery.png'

# ReleaseNotes of this module
ReleaseNotes = '- Test-SpfRecord can now recursively evaluate SPF records to count how many DNS lookups are performed when evaluating `redirect=` modifiers and `include:` tokens. Use either `Test-SpfRecord -CountDnsLookups`, `Test-SpfRecord -Recurse`, or `Test-MailPolicy -CountSpfDnsLookups` to use this new mode.
- Fixed grammar in some `Test-SpfRecord` messages.
- RFC documents were supposed to be made available as conceptual help, but were not. This has been corrected.'
ReleaseNotes = '- The DMARC "rf" token is now parsed correctly.'

} # End of PSData hashtable

Expand Down
4 changes: 2 additions & 2 deletions src/MailPolicyExplainer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -538,14 +538,14 @@ Function Test-DmarcRecord
}
}
ElseIf ($token -Like 'rf=*') {
$formats = $token -Split ':'
$formats = $token.Substring(3) -Split ':'
ForEach ($format in $formats) {
$format = $format.Trim()
If ($format -eq 'afrf') {
Write-Informational 'DMARC: Failure reports can be sent in AFRF format (default).'
}
Else {
Write-BadNews "DMARC: Failure reports can be sent in the unknown $format format. Mail receivers may ignore the entire DMARC record."
Write-BadNews "DMARC: The reporting format $format is not an allowed format. Mail receivers may ignore the entire DMARC record."
}
}
}
Expand Down

0 comments on commit b8741be

Please sign in to comment.