Class: MailAuth::Arc::Validation

Inherits:
Object
  • Object
show all
Defined in:
lib/mailauth/arc.rb

Overview

The validator of §5.2, in its order. Every failure is permanent, DNS included (§5.2.1), so a chain is only ever pass, fail, or none — the reason a hop failed survives on that set rather than in the status.

Instance Method Summary collapse

Constructor Details

#initialize(message, resolver:) ⇒ Validation

Returns a new instance of Validation.



64
65
66
67
68
69
# File 'lib/mailauth/arc.rb', line 64

def initialize(message, resolver:)
  @message, @resolver = message, resolver
  @chain = Chain.new(message)
  @seals = {}
  @signatures = {}
end

Instance Method Details

#resultObject



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/mailauth/arc.rb', line 71

def result
  if @chain.empty?
    result_of Status::NONE, comment: "no ARC sets"
  elsif @chain.oversized?
    result_of Status::FAIL, comment: "more than #{MAXIMUM_SETS} ARC sets"
  elsif sealed_as_failed?
    result_of Status::FAIL, comment: "sealed cv=fail at i=#{@chain.newest.instance}"
  elsif error = @chain.structural_error
    result_of Status::FAIL, comment: error
  elsif !newest_signature_verifies?
    result_of Status::FAIL, comment: "ARC-Message-Signature i=#{@chain.newest.instance} did not verify"
  elsif broken = broken_seal
    result_of Status::FAIL, comment: "ARC-Seal i=#{broken.instance} did not verify"
  else
    result_of Status::PASS
  end
end