fix(parser): accumulate Authentication-Results headers into a list#225
Open
romsahel wants to merge 2 commits intoDockYard:masterfrom
Open
fix(parser): accumulate Authentication-Results headers into a list#225romsahel wants to merge 2 commits intoDockYard:masterfrom
romsahel wants to merge 2 commits intoDockYard:masterfrom
Conversation
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.
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.
Problem
RFC 8601 §2.1 explicitly allows multiple
Authentication-Resultsheaders (one per MTA hop). Previously, all but the last (least trusted) were silently dropped viaMap.put/3.The same issue affects other headers that legitimately appear multiple times:
Solution
Introduce a
@multi_value_headersmodule attribute and a singleput_header/3guard 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"], andheaders["arc-message-signature"]change frombinaryto[binary].