Skip to content

ares_parse: handle ADMD-less Authentication-Results headers (closes #73)#372

Merged
thegushi merged 4 commits into
trusteddomainproject:developfrom
thegushi:issue-73-admd-less-ar-headers
May 26, 2026
Merged

ares_parse: handle ADMD-less Authentication-Results headers (closes #73)#372
thegushi merged 4 commits into
trusteddomainproject:developfrom
thegushi:issue-73-admd-less-ar-headers

Conversation

@thegushi
Copy link
Copy Markdown
Collaborator

@thegushi thegushi commented May 26, 2026

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 downstream propagation to OpenDMARC which can interpret the unparsed header as an authentication failure.

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 OpenDMARC (see trusteddomainproject/OpenDMARC#329) and should be applied to OpenARC as well.

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
  • make check passes

thegushi added 3 commits May 26, 2026 12:50
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, 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. ares_host will
be empty, signalling no authserv-id was present.

Closes trusteddomainproject#73
@thegushi thegushi merged commit b8c7ff6 into trusteddomainproject:develop May 26, 2026
1 check passed
thegushi added a commit to thegushi/OpenDKIM that referenced this pull request May 26, 2026
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