Skip to content

ares_parse: handle ADMD-less Authentication-Results headers#192

Open
thegushi wants to merge 1 commit into
trusteddomainproject:masterfrom
thegushi:issue-73-admd-less-ar-headers
Open

ares_parse: handle ADMD-less Authentication-Results headers#192
thegushi wants to merge 1 commit into
trusteddomainproject:masterfrom
thegushi:issue-73-admd-less-ar-headers

Conversation

@thegushi
Copy link
Copy Markdown

Summary

Office 365 generates Authentication-Results headers that omit the authserv-id (ADMD), jumping straight to method=result tokens:

Authentication-Results: spf=pass smtp.mailfrom=example.com
Authentication-Results: compauth=pass reason=000

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_host is 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 check integration test) and OpenDMARC (trusteddomainproject/OpenDMARC#329).

Test plan

  • Authentication-Results: spf=pass smtp.mailfrom=example.com parses without error, ares_host is empty, method is spf, result is pass
  • Authentication-Results: compauth=pass reason=000 parses without error, method is unknown
  • Standard RFC-compliant headers with authserv-id are unaffected

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant