Karta.Reports.DMARC.Forensic (Karta v1.0.0)

Reading a DMARC failure report (RFC 7489 §7.3): an Abuse Reporting Format message (RFC 5965) whose Feedback-Type is auth-failure (RFC 6591), with the fields a reporter adds for DKIM, SPF and DMARC.

parse/1 takes a parsed message (Karta.Mail.Message.parse/2) and returns the fields as plain data. The part and its bounds are Karta.Complaints.ARF's: the feedback-report part at most 65,536 bytes and 100 fields. Every value is made text and cut to 255 characters (Authentication-Results to 998), and nothing of the quoted message but its Message-ID is read: a failure report can quote mail written by a stranger, so only what the reporter says about the failure is kept. Nothing is looked up.

Nothing in a report is trusted. reported_domain is what the reporter says the failure was about; Karta.Reports.Ingest compares it with the organisation's verified domains and attributes the report only to one of those.

Summary

Functions

The failure report in a parsed message: {:ok, details}, a map with string keys ("auth_failure", "reported_domain", "source_ip", "authentication_results", "original_message_id" and the others of RFC 6591, absent when the report does not give them), or {:error, reason}: :not_a_failure_report (another Feedback-Type, or none), or what Karta.Complaints.ARF.feedback_fields/1 says.

Functions

parse(message)

@spec parse(Karta.Mail.Part.t()) :: {:ok, map()} | {:error, atom()}

The failure report in a parsed message: {:ok, details}, a map with string keys ("auth_failure", "reported_domain", "source_ip", "authentication_results", "original_message_id" and the others of RFC 6591, absent when the report does not give them), or {:error, reason}: :not_a_failure_report (another Feedback-Type, or none), or what Karta.Complaints.ARF.feedback_fields/1 says.