Branch Coverage

blib/lib/Authen/WebAuthn.pm
Criterion Covered Total %
branch 106 176 60.2


line true false branch
83 0 18 if ($@)
88 0 18 unless ($client_data->{'type'} eq "webauthn.create")
94 0 18 unless ($challenge_b64)
98 1 17 unless ($challenge_b64 eq $client_data->{'challenge'})
107 0 17 unless ($client_data->{'origin'})
111 1 16 unless ($client_data->{'origin'} eq $self->origin)
138 0 16 unless ($authenticator_data)
142 0 16 unless ($authenticator_data->{'attestedCredentialData'})
149 1 15 unless ($authenticator_data->{'rpIdHash'} eq $hash_rp_id)
158 0 15 unless ($authenticator_data->{'flags'}{'userPresent'} == 1)
165 1 14 if ($requested_uv eq "required" and $authenticator_data->{'flags'}{'userVerified'} != 1)
187 2 12 unless (ref $attestation_function eq "CODE")
188 1 1 if ($allow_unknown_attestation_format) { }
211 0 13 if $@
213 0 13 unless ($attestation_result->{'success'} == 1)
222 0 13 if (defined $trust_anchors and ref $trust_anchors eq 'SUB') { }
0 22 elsif (defined $trust_anchors and ref $trust_anchors ne 'ARRAY') { }
232 0 0 if (ref $trust_anchors ne "ARRAY")
288 0 17 if $@
302 1 16 if ($@)
307 0 16 unless ($client_data->{'type'} eq "webauthn.get")
313 0 16 unless ($challenge_b64)
317 1 15 unless ($challenge_b64 eq $client_data->{'challenge'})
325 0 15 unless ($client_data->{'origin'})
329 1 14 unless ($client_data->{'origin'} eq $self->origin)
351 0 12 if ($extension_results->{'appid'}) { }
358 1 11 unless ($authenticator_data->{'rpIdHash'} eq $hash_rp_id)
367 0 11 unless ($authenticator_data->{'flags'}{'userPresent'} == 1)
374 1 10 if ($requested_uv eq "required" and $authenticator_data->{'flags'}{'userVerified'} != 1)
393 2 8 unless (&$credential_verifier($signature, $to_sign))
402 5 3 if ($signature_count > 0 or $stored_sign_count > 0)
403 2 3 if ($signature_count <= $stored_sign_count)
416 0 22 unless ($key->{'curve_name'} eq "secp256r1")
460 27 3 if (ref $client_data_token_binding ne "HASH")
466 3 0 if ($token_binding_status eq 'present') { }
471 3 0 if ($client_data_cbid_b64) { }
472 1 2 if ($client_data_cbid_b64 eq $connection_tbid_b64) { }
500 3 8 if (ref $allowed_attestation_types eq "ARRAY" and @$allowed_attestation_types)
503 3 0 if (not grep({lc $_ eq lc $attestation_type;} @$allowed_attestation_types))
516 0 13 if $attestation_result->{'type'} eq "Self"
517 6 7 if $attestation_result->{'type'} eq "None"
526 0 7 unless ($attn_cert)
533 1 6 if ($self->matchCertificateInList($attn_cert, $trust_anchors))
541 2 4 if ($verify_result->{'result'} == 1) { }
548 2 2 if (not $allow_untrusted_attestation) { }
569 3 4 if ref $trust_anchors ne "ARRAY"
576 0 4 unless $candidate_x509
577 1 3 if ($attn_cert eq $candidate_x509->as_string(1))
593 0 1 unless $$COSE_ALG{$cose_key->{'3'}}{'name'} eq "ES256"
609 0 17 unless ($curve_name)
675 0 23 unless ($alg_config)
681 0 23 unless ($key_type_config)
687 0 23 unless (ref $key_function eq "CODE")
693 0 23 unless ($public_key)
728 16 0 if ($alg) { }
739 16 0 if (length $aaguid == 16) { }
780 0 49 if ($len < $expected_len)
796 16 17 if ($res->{'flags'}{'atIncluded'})
805 0 33 if ($res->{'flags'}{'edIncluded'}) { }
808 0 0 if ($ext)
814 0 33 if length $ad > 37 + $attestedCredentialDataLength
867 0 6 unless $attestation_statement->{'alg'}
870 0 6 unless $attestation_statement->{'sig'}
875 6 0 if ($attestation_statement->{'x5c'}) { }
901 0 6 if $@
907 0 6 if $@
912 0 6 if $@
918 6 0 if ($aaguid_ext)
921 0 6 unless $cert_aaguid =~ /^#0410.{32}$/
929 0 6 if $ad_aaguid ne $cert_aaguid
941 6 0 if (&$attestation_verifier($sig, $signed_value)) { }
962 0 6 unless $version eq "02"
965 0 6 unless $x5c->subject_name->get_entry_by_type("C")
966 0 6 unless $x5c->subject_name->get_entry_by_type("O")
967 0 6 unless $x5c->subject_name->get_entry_by_type("CN")
969 0 6 unless $x5c->subject_name->get_entry_by_type("OU")
971 0 6 unless $x5c->subject_name->get_entry_by_type("OU")->value eq "Authenticator Attestation"
977 0 6 if $isCa
995 0 0 unless $sign_alg
998 0 0 unless ($sign_alg eq $cose_alg)
1007 0 0 if $@
1011 0 0 if (&$credential_verifier($sig, $signed_value)) { }
1033 0 1 unless $attestation_statement->{'sig'}
1042 0 1 unless ($attestation_statement->{'x5c'} and ref $attestation_statement->{'x5c'} eq "ARRAY" and $attestation_statement->{'x5c'}[0])
1057 0 1 if $@
1059 0 1 if ($attestation_key->key2hash->{'curve_name'} ne "secp256r1")
1076 0 1 if $@
1086 1 0 if ($attestation_key->verify_message($sig, $verification_data, 'SHA256')) { }