Skip to content

fix(parser): accumulate Authentication-Results headers into a list#225

Open
romsahel wants to merge 2 commits intoDockYard:masterfrom
romsahel:fix-multiple-authentication-results
Open

fix(parser): accumulate Authentication-Results headers into a list#225
romsahel wants to merge 2 commits intoDockYard:masterfrom
romsahel:fix-multiple-authentication-results

Conversation

@romsahel
Copy link
Copy Markdown
Contributor

@romsahel romsahel commented Mar 5, 2026

Problem

RFC 8601 §2.1 explicitly allows multiple Authentication-Results headers (one per MTA hop). Previously, all but the last (least trusted) were silently dropped via Map.put/3.

The same issue affects other headers that legitimately appear multiple times:

  • ARC-Authentication-Results (RFC 8617 §4.1.1) — one per ARC hop
  • ARC-Seal (RFC 8617 §4.1.3) — one per ARC hop
  • ARC-Message-Signature (RFC 8617 §4.1.2) — one per ARC hop
  • DKIM-Signature (RFC 6376 §3.7) — one per signing domain

Solution

Introduce a @multi_value_headers module attribute and a single put_header/3 guard clause, replacing the previous per-header clauses for "received" and "authentication-results" and extending accumulation to the four new headers.

The resulting lists order entries bottom-most first (index 0) and top-most last, so List.last/1 returns the most trusted header per RFC 8601 §4.1.

Breaking change: the values at headers["authentication-results"], headers["dkim-signature"], headers["arc-authentication-results"], headers["arc-seal"], and headers["arc-message-signature"] change from binary to [binary].

romsahel added 2 commits March 5, 2026 14:59
RFC 8601 §2.1 explicitly allows multiple `Authentication-Results` headers (one per MTA hop).
Previously, all but the last (least trusted) were silently dropped via `Map.put/3`.

Add a dedicated `put_header/3` clause matching the existing `"received"` accumulation pattern.
The resulting list orders entries bottom-most first (index 0) and top-most last, so `List.last/1` returns the most trusted header per RFC 8601 §4.1.

Breaking change: the value at headers["authentication-results"] changes from binary to [binary].
…ders into lists

Refactor put_header/3 to use @multi_value_headers module attribute and extend accumulation to ARC/DKIM headers.
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