Skip to content

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

Merged
thegushi merged 1 commit into
trusteddomainproject:developfrom
thegushi:issue-73-admd-less-ar-headers
May 27, 2026
Merged

ares_parse: handle ADMD-less Authentication-Results headers#329
thegushi merged 1 commit into
trusteddomainproject:developfrom
thegushi:issue-73-admd-less-ar-headers

Conversation

@thegushi
Copy link
Copy Markdown
Collaborator

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 has real consequences: log noise on every O365-originated message, and OpenDMARC interpreting the unparsed header as an authentication failure for otherwise valid mail.

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 (see trusteddomainproject/OpenDKIM#372).

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 can cause OpenDMARC to report
authentication failures for otherwise valid mail.

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