| 1 | package Mail::DKIM::ARC::Verifier; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 5 | our $VERSION = '1.20261116'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # ABSTRACT: verifies an ARC-Sealed message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Copyright 2017 FastMail Pty Ltd. All Rights Reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # Bron Gondwana <brong@fastmailteam.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # This program is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 5 | ▶ | use base 'Mail::DKIM::Common'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 5 | ▶ | use Mail::DKIM::ARC::MessageSignature; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 5 | ▶ | use Mail::DKIM::ARC::Seal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 5 | ▶ | use Mail::DKIM::Canonicalization::seal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 5 | ▶ | use Mail::Address; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 5 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 5 | our $MAX_SIGNATURES_TO_PROCESS = 50; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 193 | ▶ | sub init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 193 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 193 | $self->SUPER::init; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 193 | $self->{signatures} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 193 | $self->{result} = undef; # we're done once this is set | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # @{$arc->{signatures}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # array of L<Mail::DKIM::ARC::{Signature|Seal}> objects, representing all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # parseable message signatures and seals found in the header, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # ordered from the top of the header to the bottom. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # $arc->{signature_reject_reason} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # simple string listing a reason, if any, for not using a signature. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # This may be a helpful diagnostic if there is a signature in the header, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # but was found not to be valid. It will be ambiguous if there are more | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # than one signatures that could not be used. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # @{$arc->{headers}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # array of strings, each member is one header, in its original format. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # $arc->{algorithms} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | # array of algorithms, one for each signature being verified. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # $arc->{result} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # string; the result of the verification (see the result() method) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 2722 | ▶ | sub handle_header { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handle_header: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 2722 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 2722 | my ( $field_name, $contents, $line ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 2722 | $self->SUPER::handle_header( $field_name, $contents ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 2722 | ▶ | if ( lc($field_name) eq 'arc-message-signature' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 272 | local $SIG{__DIE__}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 272 | my $signature = Mail::DKIM::ARC::MessageSignature->parse($line); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 270 | $self->add_signature($signature); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 269 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 272 | ▶ | } || do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # the only reason an error should be thrown is if the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # signature really is unparse-able | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # otherwise, invalid signatures are caught in finish_header() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 3 | chomp( my $E = $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 3 | $self->{signature_reject_reason} = $E; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 2722 | ▶ | if ( lc($field_name) eq 'arc-seal' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 274 | local $SIG{__DIE__}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 274 | my $signature = Mail::DKIM::ARC::Seal->parse($line); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 273 | $self->add_signature($signature); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 272 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 274 | ▶ | } || do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # the only reason an error should be thrown is if the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # signature really is unparse-able | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # otherwise, invalid signatures are caught in finish_header() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 2 | chomp( my $E = $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 2 | $self->{signature_reject_reason} = $E; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 543 | ▶ | sub add_signature { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_signature: called CC=26 SCAR=33.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 543 | my ( $self, $signature ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 543 | ▶ | croak 'wrong number of arguments' unless ( @_ == 2 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 543 | ▶ | return if $self->{result}; # already failed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # Set verification time if we have one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 531 | ▶ | if ($self->{verify_time}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $signature->set_verify_time($self->{verify_time}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 531 | push @{ $self->{signatures} }, $signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 531 | ▶ | unless ( $self->check_signature($signature) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 14 | $signature->result( 'invalid', $self->{signature_reject_reason} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 14 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | # check for bogus tags (should be done much earlier but better late than never) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # tagkeys is uniq'd via a hash, rawtaglen counts all the tags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 517 | my @tagkeys = keys %{ $signature->{tags_by_name} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 517 | my $rawtaglen = $#{ $signature->{tags} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | # crock: ignore empty clause after trailing semicolon | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | $rawtaglen-- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 517 | ▶ | if $signature->{tags}->[ $#{ $signature->{tags} } ]->{raw} =~ /^\s*$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # duplicate tags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 517 | ▶ | if ( $rawtaglen != $#tagkeys ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 5 | $self->{result} = 'fail'; # bogus | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 5 | $self->{details} = 'Duplicate tag in signature'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 5 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # invalid tag name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 512 | ▶ | if ( grep { !m{[a-z][a-z0-9_]*}i } @tagkeys ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 2 | $self->{result} = 'fail'; # bogus | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 2 | $self->{details} = 'Invalid tag in signature'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # the instance this signature will be saved at, once it has been set up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 510 | my ( $set, $instance ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 510 | ▶ | if ( $signature->isa('Mail::DKIM::ARC::Seal') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 261 | ▶ | $instance = $signature->instance() || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$signature->instance || ''
MC/DC100%1/1
$signature->instance || ''
$signature->instance
Truth table100%2/2
A
A= $signature->instance
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 261 | ▶ | if ( $instance !~ m{^\d+$} or $instance < 1 or $instance > $MAX_SIGNATURES_TO_PROCESS ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
not $instance =~ /^\d+$/ or $instance < 1 or $instance > $Mail::DKIM::ARC::Verifier::MAX_SIGNATURES_TO_PROCESS
not $instance =~ /^\d+$/ or $instance < 1
MC/DC66%2/3
not $instance =~ /^\d+$/ or $instance < 1 or $instance > $Mail::DKIM::ARC::Verifier::MAX_SIGNATURES_TO_PROCESS
not $instance =~ /^\d+$/
$instance < 1
$instance > $Mail::DKIM::ARC::Verifier::MAX_SIGNATURES_TO_PROCESS
Truth table75%3/4
not(A) or B or C
A= not $instance =~ /^\d+$/B= $instance < 1C= $instance > $Mail::DKIM::ARC::Verifier::MAX_SIGNATURES_TO_PROCESS
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 6 | $self->{result} = 'fail'; # bogus | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 6 | $self->{details} = sprintf "Invalid ARC-Seal instance '%s'", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | $instance; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 6 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 255 | ▶ | if ( $self->{seals}[$instance] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 3 | $self->{result} = 'fail'; # dup | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 3 | ▶ | if ( $signature eq $self->{seals}[$instance] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $self->{details} = sprintf 'Duplicate ARC-Seal %d', $instance; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 3 | $self->{details} = sprintf 'Redundant ARC-Seal %d', $instance; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 252 | $set = 'seals'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | elsif ( $signature->isa('Mail::DKIM::ARC::MessageSignature') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 249 | ▶ | $instance = $signature->instance() || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$signature->instance || ''
MC/DC100%1/1
$signature->instance || ''
$signature->instance
Truth table100%2/2
A
A= $signature->instance
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 249 | ▶ | if ( $instance !~ m{^\d+$} or $instance < 1 or $instance > $MAX_SIGNATURES_TO_PROCESS ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
not $instance =~ /^\d+$/ or $instance < 1 or $instance > $Mail::DKIM::ARC::Verifier::MAX_SIGNATURES_TO_PROCESS
not $instance =~ /^\d+$/ or $instance < 1
MC/DC33%1/3
not $instance =~ /^\d+$/ or $instance < 1 or $instance > $Mail::DKIM::ARC::Verifier::MAX_SIGNATURES_TO_PROCESS
not $instance =~ /^\d+$/
$instance < 1
$instance > $Mail::DKIM::ARC::Verifier::MAX_SIGNATURES_TO_PROCESS
Truth table50%2/4
not(A) or B or C
A= not $instance =~ /^\d+$/B= $instance < 1C= $instance > $Mail::DKIM::ARC::Verifier::MAX_SIGNATURES_TO_PROCESS
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 4 | $self->{result} = 'fail'; # bogus | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | $self->{details} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 4 | sprintf "Invalid ARC-Message-Signature instance '%s'", $instance; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 245 | ▶ | if ( $self->{messages}[$instance] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 3 | $self->{result} = 'fail'; # dup | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 3 | ▶ | if ( $signature->as_string() eq | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | $self->{messages}[$instance]->as_string() ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $self->{details} = sprintf 'Duplicate ARC-Message-Signature %d', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | $instance; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 3 | $self->{details} = sprintf 'Redundant ARC-Message-Signature %d', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | $instance; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 242 | $set = 'messages'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # signature looks ok, go ahead and query for the public key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | # (only now that the tags and instance number have been checked, so a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | # bogus signature costs neither a DNS query nor a canonicalization) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 494 | $signature->fetch_public_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | # create a canonicalization filter and algorithm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 492 | my $algorithm_class = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | $signature->get_algorithm_class( $signature->algorithm ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | my $algorithm = $algorithm_class->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | Signature => $signature, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | Debug_Canonicalization => $signature->isa('Mail::DKIM::ARC::Seal') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | ? $self->{AS_Canonicalization} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | : $self->{AMS_Canonicalization}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 492 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | # an algorithm that wants the headers prior to the signature header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | # canonicalizes the whole header from finish_header(), so only the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | # others need each header field as it is parsed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | push @{ $self->{header_algorithms} }, $algorithm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | unless $algorithm->wants_pre_signature_headers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | # save the algorithm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 492 | ▶ | $self->{algorithms} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"algorithms"} ||= []
MC/DC100%1/1
$self->{"algorithms"} ||= []
$self->{"algorithms"}
Truth table100%2/2
A
A= $self->{"algorithms"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 492 | push @{ $self->{algorithms} }, $algorithm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # fetch_public_key dies on an unusable selector or domain, so only now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # save the signature for the chain checks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 492 | ▶ | $self->{$set}[$instance] = $signature if $set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 531 | ▶ | sub check_signature { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_signature: called CC=17 SCAR=31.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 531 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 531 | ▶ | croak 'wrong number of arguments' unless ( @_ == 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 531 | my ($signature) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 531 | ▶ | unless ( $signature->check_version ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | # unsupported version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | if ( defined $signature->version ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | $self->{signature_reject_reason} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | 'unsupported version ' . $signature->version; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | $self->{signature_reject_reason} = 'missing v tag'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 531 | ▶ | unless ( $signature->algorithm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$signature->algorithm and $signature->get_algorithm_class($signature->algorithm) and !$self->{"Strict"} || $signature->algorithm ne "rsa-sha1"
$signature->algorithm and $signature->get_algorithm_class($signature->algorithm)
not $self->{"Strict"} or $signature->algorithm ne "rsa-sha1"
MC/DC50%2/4
$signature->algorithm and $signature->get_algorithm_class($signature->algorithm) and !$self->{"Strict"} || $signature->algorithm ne "rsa-sha1"
$signature->algorithm
$signature->get_algorithm_class($signature->algorithm)
not $self->{"Strict"}
$signature->algorithm ne "rsa-sha1"
Truth table80%4/5
A and B and not(C) or D
A= $signature->algorithmB= $signature->get_algorithm_class($signature->algorithm)C= not $self->{"Strict"}D= $signature->algorithm ne "rsa-sha1"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | && $signature->get_algorithm_class( $signature->algorithm ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | && ( !$self->{Strict} || $signature->algorithm ne 'rsa-sha1' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | ) # no more SHA1 for us in strict mode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | # unsupported algorithm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 6 | $self->{signature_reject_reason} = 'unsupported algorithm'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 6 | ▶ | if ( defined $signature->algorithm ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 4 | $self->{signature_reject_reason} .= ' ' . $signature->algorithm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 6 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 525 | ▶ | unless ( $signature->check_canonicalization ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | # unsupported canonicalization method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 1 | $self->{signature_reject_reason} = 'unsupported canonicalization'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 1 | ▶ | if ( defined $signature->canonicalization ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | $self->{signature_reject_reason} .= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 1 | ' ' . $signature->canonicalization; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 524 | ▶ | unless ( $signature->check_protocol ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | # unsupported query protocol | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | $self->{signature_reject_reason} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | !defined( $signature->protocol ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | ? 'missing q tag' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | : 'unsupported query protocol, q=' . $signature->protocol; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 524 | ▶ | unless ( $signature->check_expiration ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | # signature has expired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | $self->{signature_reject_reason} = 'signature is expired'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 524 | ▶ | unless ( defined $signature->domain ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | # no domain specified | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 2 | $self->{signature_reject_reason} = 'missing d tag'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 2 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 522 | ▶ | if ( $signature->domain eq '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | # blank domain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 2 | $self->{signature_reject_reason} = 'invalid domain in d tag'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 2 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 520 | ▶ | unless ( defined $signature->selector ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | # no selector specified | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 3 | $self->{signature_reject_reason} = 'missing s tag'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 3 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 517 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 285 | ▶ | sub check_public_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_public_key: called CC=5 SCAR=17.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 285 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 285 | ▶ | croak 'wrong number of arguments' unless ( @_ == 2 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 285 | my ( $signature, $public_key ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 285 | my $result = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 285 | local $SIG{__DIE__}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 285 | $@ = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | # HACK- I'm indecisive here about whether I want the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | # check_foo functions to return false or to "die" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | # on failure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | # check public key's allowed hash algorithms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 285 | $result = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | $public_key->check_hash_algorithm( $signature->hash_algorithm ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # HACK- DomainKeys signatures are allowed to have an empty g= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # tag in the public key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | # my $empty_g_means_wildcard = $signature->isa('Mail::DKIM::DkSignature'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | # check public key's granularity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 285 | ▶ | $result &&= $public_key->check_granularity( $signature->domain, 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$result &&= $public_key->check_granularity($signature->domain, 0)
MC/DC0%0/2
$result &&= $public_key->check_granularity($signature->domain, 0)
$result
$public_key->check_granularity($signature->domain, 0)
Truth table33%1/3
A &&= B
A= $resultB= $public_key->check_granularity($signature->domain, 0)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | # $signature->instance, $empty_g_means_wildcard); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 285 | ▶ | die $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 285 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 285 | ▶ | } || do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my $E = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | chomp $E; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | $self->{signature_reject_reason} = "public key: $E"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 285 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # called when the verifier has received the last of the message headers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | # (body is still to come) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 192 | ▶ | sub finish_header { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finish_header: called CC=16 SCAR=29.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 192 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | # Signatures we found and were successfully parsed are stored in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | # $self->{signatures}. If none were found, our result is "none". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 192 | ▶ | if ( @{ $self->{signatures} } == 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@{$self->{"signatures"};} == 0 and not defined $self->{"signature_reject_reason"}
MC/DC50%1/2
@{$self->{"signatures"};} == 0 and not defined $self->{"signature_reject_reason"}
@{$self->{"signatures"};} == 0
not defined $self->{"signature_reject_reason"}
Truth table66%2/3
A and not(B)
A= @{$self->{"signatures"};} == 0B= not defined $self->{"signature_reject_reason"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | && !defined( $self->{signature_reject_reason} ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 5 | $self->{result} = 'none'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 5 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | # already failed in add_signature: drop the algorithms, since a seal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # canonicalization loops up to its signature's i= value, which may be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | # the bad instance number that failed the chain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 187 | ▶ | if ( $self->{result} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 23 | $self->{algorithms} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 23 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | # check the AAR headers: each must have an instance the seal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | # canonicalization finds, since one it doesn't is covered by no seal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | # but may still be read as part of the chain (e.g. "i = 1", which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | # RFC 8617 allows), and there must be no duplicates (dup AS and AMS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | # checked in add_signature) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 164 | my %aars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 164 | foreach my $hdr ( @{ $self->{headers} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 2218 | ▶ | next unless $hdr =~ m{^ARC-Authentication-Results\s*:}i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 241 | my $i = Mail::DKIM::Canonicalization::seal::_aar_instance($hdr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 241 | ▶ | if ( !defined $i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 14 | $self->{result} = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 14 | $self->{details} = 'Unparseable ARC-Authentication-Results header'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 14 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 227 | ▶ | if ( $i < 1 or $i > $MAX_SIGNATURES_TO_PROCESS ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$i < 1 or $i > $Mail::DKIM::ARC::Verifier::MAX_SIGNATURES_TO_PROCESS
MC/DC100%2/2
$i < 1 or $i > $Mail::DKIM::ARC::Verifier::MAX_SIGNATURES_TO_PROCESS
$i < 1
$i > $Mail::DKIM::ARC::Verifier::MAX_SIGNATURES_TO_PROCESS
Truth table100%3/3
A or B
A= $i < 1B= $i > $Mail::DKIM::ARC::Verifier::MAX_SIGNATURES_TO_PROCESS
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 4 | $self->{result} = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | $self->{details} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 4 | "Invalid ARC-Authentication-Results instance '$i'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 223 | ▶ | if ( defined $aars{$i} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 4 | $self->{result} = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | $self->{details} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 4 | "Duplicate ARC-Authentication-Results header $i"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 219 | $aars{$i} = $hdr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 142 | $self->{aars} = \%aars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | # share the header indexes between the signatures | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 142 | my $index = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 142 | foreach my $algorithm ( @{ $self->{algorithms} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | $algorithm->finish_header( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | Headers => $self->{headers}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 409 | HeaderIndex => $index, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | Chain => 'pass' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | # stop processing signatures that are already known to be invalid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 142 | @{ $self->{algorithms} } = grep { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 409 | my $sig = $_->signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 409 | ▶ | !( $sig->result && $sig->result eq 'invalid' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$sig->result && $sig->result eq 'invalid'
MC/DC0%0/2
$sig->result && $sig->result eq 'invalid'
$sig->result
$sig->result eq 'invalid'
Truth table33%1/3
A && B
A= $sig->resultB= $sig->result eq 'invalid'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 142 | } @{ $self->{algorithms} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 142 | ▶ | if ( @{ $self->{algorithms} } == 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@{$self->{"algorithms"};} == 0 and @{$self->{"signatures"};} > 0
MC/DC0%0/2
@{$self->{"algorithms"};} == 0 and @{$self->{"signatures"};} > 0
@{$self->{"algorithms"};} == 0
@{$self->{"signatures"};} > 0
Truth table33%1/3
A and B
A= @{$self->{"algorithms"};} == 0B= @{$self->{"signatures"};} > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | && @{ $self->{signatures} } > 0 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | $self->{result} = $self->{signatures}->[0]->result || 'invalid'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'signatures'}[0]->result || 'invalid'
MC/DC0%0/1
$self->{'signatures'}[0]->result || 'invalid'
$self->{'signatures'}[0]->result
Truth table0%0/2
A
A= $self->{'signatures'}[0]->result
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | $self->{details} = $self->{signatures}->[0]->{verify_details} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | || $self->{signature_reject_reason}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'signatures'}[0]{'verify_details'} || $self->{'signature_reject_reason'}
MC/DC0%0/2
$self->{'signatures'}[0]{'verify_details'} || $self->{'signature_reject_reason'}
$self->{'signatures'}[0]{'verify_details'}
$self->{'signature_reject_reason'}
Truth table0%0/3
A || B
A= $self->{'signatures'}[0]{'verify_details'}B= $self->{'signature_reject_reason'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 409 | ▶ | sub _check_and_verify_signature { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_and_verify_signature: called CC=16 SCAR=28.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 409 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 409 | my ($algorithm) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | # check signature | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 409 | my $signature = $algorithm->signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 409 | ▶ | if ( not $signature->get_tag('d') ) { # All sigs must have a D tag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | $self->{signature_reject_reason} = 'missing D tag'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | return ( 'fail', $self->{signature_reject_reason} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 409 | ▶ | if ( not $signature->get_tag('b') ) { # All sigs must have a B tag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 4 | $self->{signature_reject_reason} = 'missing B tag'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 4 | return ( 'fail', $self->{signature_reject_reason} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 405 | ▶ | if ( not $signature->isa('Mail::DKIM::ARC::Seal') ) { # AMS tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 202 | ▶ | unless ( $signature->get_tag('bh') ) { # AMS must have a BH tag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 2 | $self->{signature_reject_reason} = 'missing BH tag'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 2 | return ( 'fail', $self->{signature_reject_reason} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | # an empty or missing h= is accepted, unlike in a DKIM-Signature, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | # as the ARC test suite expects; see "ARC-Message-Signature h= tag" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 200 | ▶ | if ( ( $signature->get_tag('h') || '' ) =~ /arc-seal/i ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$signature->get_tag('h') || ''
MC/DC100%1/1
$signature->get_tag('h') || ''
$signature->get_tag('h')
Truth table100%2/2
A
A= $signature->get_tag('h')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | { # cannot cover AS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | $self->{signature_reject_reason} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 1 | 'Arc-Message-Signature covers Arc-Seal'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 1 | return ( 'fail', $self->{signature_reject_reason} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | # AMS signature must not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | # get public key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 402 | my $pkey; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 402 | local $SIG{__DIE__}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 402 | $pkey = $signature->get_public_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 285 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 402 | ▶ | } || do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 117 | my $E = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 117 | chomp $E; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 117 | $self->{signature_reject_reason} = "public key: $E"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 117 | return ( 'invalid', $self->{signature_reject_reason} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 285 | ▶ | unless ( $self->check_public_key( $signature, $pkey ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | return ( 'invalid', $self->{signature_reject_reason} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | # make sure key is big enough | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 285 | my $keysize = $pkey->cork->size * 8; # in bits | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 285 | ▶ | if ( $keysize < 1024 && $self->{Strict} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$keysize < 1024 and $self->{"Strict"}
MC/DC50%1/2
$keysize < 1024 and $self->{"Strict"}
$keysize < 1024
$self->{"Strict"}
Truth table66%2/3
A and B
A= $keysize < 1024B= $self->{"Strict"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 2 | $self->{signature_reject_reason} = "Key length $keysize too short"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 2 | return ( 'fail', $self->{signature_reject_reason} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | # verify signature | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 283 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | my $details; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 283 | local $@ = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 283 | local $SIG{__DIE__}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 283 | ▶ | $result = $algorithm->verify() ? 'pass' : 'fail'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 277 | ▶ | $details = $algorithm->{verification_details} || $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$algorithm->{'verification_details'} || $@
MC/DC100%2/2
$algorithm->{'verification_details'} || $@
$algorithm->{'verification_details'}
$@
Truth table100%3/3
A || B
A= $algorithm->{'verification_details'}B= $@
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 277 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 283 | ▶ | } || do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | # see also add_signature | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 6 | chomp( my $E = $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 6 | ▶ | if ( $E =~ /(OpenSSL error: .*?) at / ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 6 | $E = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | elsif ( $E =~ /^(panic:.*?) at / ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | $E = "OpenSSL $1"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 6 | $result = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 6 | $details = $E; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 283 | return ( $result, $details ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 193 | ▶ | sub finish_body { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finish_body: called CC=26 SCAR=33.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 193 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 193 | ▶ | return if $self->{result}; # already failed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 143 | foreach my $algorithm ( @{ $self->{algorithms} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | # finish canonicalizing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 409 | $algorithm->finish_body; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 409 | my ( $result, $details ) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | $self->_check_and_verify_signature($algorithm); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | # save the results of this signature verification | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 409 | $algorithm->{result} = $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 409 | $algorithm->{details} = $details; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 409 | ▶ | $self->{signature} ||= $algorithm->signature; # something if we fail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"signature"} ||= $algorithm->signature
MC/DC0%0/2
$self->{"signature"} ||= $algorithm->signature
$self->{"signature"}
$algorithm->signature
Truth table66%2/3
A ||= B
A= $self->{"signature"}B= $algorithm->signature
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 409 | $algorithm->signature->result( $result, $details ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 143 | ▶ | my $seals = $self->{seals} || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'seals'} || []
MC/DC100%1/1
$self->{'seals'} || []
$self->{'seals'}
Truth table100%2/2
A
A= $self->{'seals'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 143 | ▶ | my $messages = $self->{messages} || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'messages'} || []
MC/DC100%1/1
$self->{'messages'} || []
$self->{'messages'}
Truth table100%2/2
A
A= $self->{'messages'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 143 | ▶ | my $aars = $self->{aars} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'aars'} || {}
MC/DC0%0/1
$self->{'aars'} || {}
$self->{'aars'}
Truth table50%1/2
A
A= $self->{'aars'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 143 | ▶ | unless ( @$seals or @$messages ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$seals or @$messages
MC/DC0%0/2
@$seals or @$messages
@$seals
@$messages
Truth table66%2/3
A or B
A= @$sealsB= @$messages
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | $self->{result} = 'none'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | $self->{details} = 'no ARC headers found'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | # determine if it's valid: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | # 5.1.1.5. Determining the 'cv' Tag Value for ARC-Seal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | # In order for a series of ARC sets to be considered valid, the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | # following statements MUST be satisfied: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | # 1. The chain of ARC sets must have structural integrity (no sets or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # set component header fields missing, no duplicates, excessive | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | # hops (cf. Section 5.1.1.1.1), etc.); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 143 | ▶ | if ( $#$seals == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | $self->{result} = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | $self->{details} = 'missing ARC-Seal 1'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 143 | ▶ | if ( $#$messages == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | $self->{result} = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | $self->{details} = 'missing ARC-Message-Signature 1'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 143 | ▶ | if ( $#$messages > $#$seals ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 11 | $self->{result} = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 11 | $self->{details} = 'missing Arc-Seal ' . $#$messages; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 11 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 132 | my ($max_aar) = sort { $b <=> $a } keys %$aars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 132 | ▶ | if ( defined $max_aar and $max_aar > $#$seals ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $max_aar and $max_aar > $seals->$#*
MC/DC100%2/2
defined $max_aar and $max_aar > $seals->$#*
defined $max_aar
$max_aar > $seals->$#*
Truth table100%3/3
A and B
A= defined $max_aarB= $max_aar > $seals->$#*
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 2 | $self->{result} = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 2 | $self->{details} = 'missing Arc-Seal ' . $max_aar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 130 | foreach my $i ( 1 .. $#$seals ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | # XXX - we should error if it's already present, but that's done above if at all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 204 | ▶ | if ( !$seals->[$i] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 1 | $self->{result} = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 1 | $self->{details} = "missing ARC-Seal $i"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 203 | ▶ | if ( !$messages->[$i] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 13 | $self->{result} = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 13 | $self->{details} = "missing ARC-Message-Signature $i"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 13 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 190 | ▶ | if ( !$aars->{$i} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 4 | $self->{result} = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 4 | $self->{details} = "missing ARC-Authentication-Results $i"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | # 2. All ARC-Seal header fields MUST validate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 112 | foreach my $i ( 1 .. $#$seals ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 134 | my $result = $seals->[$i]->result(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 134 | ▶ | if ( $result ne 'pass' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 32 | $self->{signature} = $seals->[$i]->signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 32 | $self->{result} = $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 32 | $self->{details} = $seals->[$i]->result_detail(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 32 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | # 3. All ARC-Seal header fields MUST have a chain value (cv=) status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | # of "pass" (except the first which MUST be "none"); and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 80 | my $cv = $seals->[1]->get_tag('cv'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 80 | ▶ | if ( !defined $cv or $cv ne 'none' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $cv or $cv ne "none"
MC/DC100%2/2
not defined $cv or $cv ne "none"
not defined $cv
$cv ne "none"
Truth table100%3/3
not(A) or B
A= not defined $cvB= $cv ne "none"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 7 | $self->{signature} = $seals->[1]->signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 7 | $self->{result} = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 7 | $self->{details} = 'first ARC-Seal must be cv=none'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 7 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 73 | foreach my $i ( 2 .. $#$seals ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 18 | my $cv = $seals->[$i]->get_tag('cv'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 18 | ▶ | if ( !defined $cv or $cv ne 'pass' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $cv or $cv ne "pass"
MC/DC100%2/2
not defined $cv or $cv ne "pass"
not defined $cv
$cv ne "pass"
Truth table100%3/3
not(A) or B
A= not defined $cvB= $cv ne "pass"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 3 | $self->{signature} = $seals->[$i]->signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 3 | $self->{result} = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 3 | $self->{details} = "wrong cv for ARC-Seal i=$i"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | # 4. The newest (highest instance number (i=)) AMS header field MUST | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | # validate. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 70 | my $result = $messages->[$#$seals]->result(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 70 | ▶ | if ( $result ne 'pass' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 16 | $self->{signature} = $messages->[$#$seals]->signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 16 | $self->{result} = $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 16 | $self->{details} = $messages->[$#$seals]->result_detail(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 16 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | # Success! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 54 | $self->{signature} = $seals->[$#$seals]->signature(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 54 | $self->{result} = 'pass'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 54 | $self->{details} = $seals->[$#$seals]->result_detail(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 168 | ▶ | sub result_detail { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_detail: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 168 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 168 | ▶ | return 'none' if $self->{result} eq 'none'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 163 | my @items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 163 | foreach my $signature ( @{ $self->{signatures} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 364 | ▶ | my $type = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | ref($signature) eq 'Mail::DKIM::ARC::Seal' ? 'as' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | : ref($signature) eq 'Mail::DKIM::ARC::MessageSignature' ? 'ams' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | : ref($signature); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 364 | ▶ | push @items, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
$signature->instance || ''
$signature->domain || '(none)'
$signature->result_detail || '?'
MC/DC100%1/1
$signature->instance || ''
$signature->instance
MC/DC100%1/1
$signature->domain || '(none)'
$signature->domain
MC/DC100%1/1
$signature->result_detail || '?'
$signature->result_detail
Truth table100%2/2
A
A= $signature->instance
Truth table100%2/2
A
A= $signature->domain
Truth table100%2/2
A
A= $signature->result_detail
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | "$type." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | . ( $signature->instance() || '' ) . '.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | . ( $signature->domain() || '(none)' ) . '=' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | . ( $signature->result_detail() || '?' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 163 | return $self->{result} . ' (' . join( ', ', @items ) . ')'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | ▶ | sub signatures { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
signatures: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | ▶ | croak 'unexpected argument' if @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | return @{ $self->{signatures} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||