ares_parse: handle ADMD-less Authentication-Results headers#192
Open
thegushi wants to merge 1 commit into
Open
ares_parse: handle ADMD-less Authentication-Results headers#192thegushi wants to merge 1 commit into
thegushi wants to merge 1 commit into
Conversation
Office 365 generates Authentication-Results headers that omit the authserv-id (ADMD), jumping straight to method=result tokens. This is non-compliant with RFC 8601 but common enough in practice that the hard parse failure causes log noise and downstream ARC chain issues. When state 1 encounters '=' instead of ';' or a version digit, the accumulated host token is actually a method name. Recover by leaving ares_host empty and continuing from the result value. See trusteddomainproject/OpenDKIM#73
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Office 365 generates
Authentication-Resultsheaders that omit the authserv-id (ADMD), jumping straight tomethod=resulttokens:RFC 8601 requires the authserv-id before the semicolon, so these are technically non-compliant. However they are common enough in practice that the current hard parse failure causes log noise on every O365-originated message and can interfere with ARC chain construction.
Fix
In state 1 of
ares_parse(), when=is seen instead of;or a version digit, the token we read as authserv-id is actually the first method name. The fix recovers gracefully:ares_hostis left empty (signalling no authserv-id present), the token is slotted as the method, and parsing continues from the result value.The same fix has been applied to OpenDKIM (trusteddomainproject/OpenDKIM#372, with a
make checkintegration test) and OpenDMARC (trusteddomainproject/OpenDMARC#329).Test plan
Authentication-Results: spf=pass smtp.mailfrom=example.comparses without error,ares_hostis empty, method isspf, result ispassAuthentication-Results: compauth=pass reason=000parses without error, method isunknown