| 1 | package CSAF::Type::CVSS3; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.010001; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | extends 'CSAF::Type::Base'; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | # TODO Parse vector string and set single metrics | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | has version => ( | ||||||||||||||||||||||||||||
| 17 | is => 'ro', | ||||||||||||||||||||||||||||
| 18 | default => '3.1', | ||||||||||||||||||||||||||||
| 19 | 2 | ▶ | isa => sub { Carp::croak "CVSS3 version must be 3.0 or 3.1" unless ($_[0] eq '3.0' || $_[0] eq '3.1') } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=14.2
Branch: 1 branch
Condition33%1/3
$_[0] eq "3.0" or $_[0] eq "3.1"
MC/DC0%0/2
$_[0] eq "3.0" or $_[0] eq "3.1"
$_[0] eq "3.0"
$_[0] eq "3.1"
Truth table33%1/3
A or B
A= $_[0] eq "3.0"B= $_[0] eq "3.1"
| |||||||||||||||||||||||||||||
| 20 | 1 | ); | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | ▶ | has vectorString => (is => 'rw', coerce => sub { uc $_[0] }); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | has baseScore => (is => 'rw', coerce => sub { ($_[0] + 0) }); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | has baseSeverity => (is => 'rw', coerce => sub { uc $_[0] }); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | has [qw( | ||||||||||||||||||||||||||||
| 27 | attackVector | ||||||||||||||||||||||||||||
| 28 | attackComplexity | ||||||||||||||||||||||||||||
| 29 | privilegesRequired | ||||||||||||||||||||||||||||
| 30 | userInteraction | ||||||||||||||||||||||||||||
| 31 | scope | ||||||||||||||||||||||||||||
| 32 | confidentialityImpact | ||||||||||||||||||||||||||||
| 33 | integrityImpact | ||||||||||||||||||||||||||||
| 34 | availabilityImpact | ||||||||||||||||||||||||||||
| 35 | exploitCodeMaturity | ||||||||||||||||||||||||||||
| 36 | remediationLevel | ||||||||||||||||||||||||||||
| 37 | reportConfidence | ||||||||||||||||||||||||||||
| 38 | temporalScore | ||||||||||||||||||||||||||||
| 39 | temporalSeverity | ||||||||||||||||||||||||||||
| 40 | confidentialityRequirement | ||||||||||||||||||||||||||||
| 41 | integrityRequirement | ||||||||||||||||||||||||||||
| 42 | availabilityRequirement | ||||||||||||||||||||||||||||
| 43 | modifiedAttackVector | ||||||||||||||||||||||||||||
| 44 | modifiedAttackComplexity | ||||||||||||||||||||||||||||
| 45 | modifiedPrivilegesRequired | ||||||||||||||||||||||||||||
| 46 | modifiedUserInteraction | ||||||||||||||||||||||||||||
| 47 | modifiedScope | ||||||||||||||||||||||||||||
| 48 | modifiedConfidentialityImpact | ||||||||||||||||||||||||||||
| 49 | modifiedIntegrityImpact | ||||||||||||||||||||||||||||
| 50 | modifiedAvailabilityImpact | ||||||||||||||||||||||||||||
| 51 | environmentalScore | ||||||||||||||||||||||||||||
| 52 | environmentalSeverity | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | )] => (is => 'rw', coerce => sub { uc $_[0] }); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub TO_CSAF { | ||||||||||||||||||||||||||
|
Subroutine
TO_CSAF: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 0 | my $output = { | |||||||||||||||||||||||||||
| 60 | version => $self->version, | ||||||||||||||||||||||||||||
| 61 | vectorString => $self->vectorString, | ||||||||||||||||||||||||||||
| 62 | baseScore => $self->baseScore, | ||||||||||||||||||||||||||||
| 63 | baseSeverity => $self->baseSeverity | ||||||||||||||||||||||||||||
| 64 | }; | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | my @attributes = qw( | |||||||||||||||||||||||||||
| 68 | attackVector | ||||||||||||||||||||||||||||
| 69 | attackComplexity | ||||||||||||||||||||||||||||
| 70 | privilegesRequired | ||||||||||||||||||||||||||||
| 71 | userInteraction | ||||||||||||||||||||||||||||
| 72 | scope | ||||||||||||||||||||||||||||
| 73 | confidentialityImpact | ||||||||||||||||||||||||||||
| 74 | integrityImpact | ||||||||||||||||||||||||||||
| 75 | availabilityImpact | ||||||||||||||||||||||||||||
| 76 | exploitCodeMaturity | ||||||||||||||||||||||||||||
| 77 | remediationLevel | ||||||||||||||||||||||||||||
| 78 | reportConfidence | ||||||||||||||||||||||||||||
| 79 | temporalScore | ||||||||||||||||||||||||||||
| 80 | temporalSeverity | ||||||||||||||||||||||||||||
| 81 | confidentialityRequirement | ||||||||||||||||||||||||||||
| 82 | integrityRequirement | ||||||||||||||||||||||||||||
| 83 | availabilityRequirement | ||||||||||||||||||||||||||||
| 84 | modifiedAttackVector | ||||||||||||||||||||||||||||
| 85 | modifiedAttackComplexity | ||||||||||||||||||||||||||||
| 86 | modifiedPrivilegesRequired | ||||||||||||||||||||||||||||
| 87 | modifiedUserInteraction | ||||||||||||||||||||||||||||
| 88 | modifiedScope | ||||||||||||||||||||||||||||
| 89 | modifiedConfidentialityImpact | ||||||||||||||||||||||||||||
| 90 | modifiedIntegrityImpact | ||||||||||||||||||||||||||||
| 91 | modifiedAvailabilityImpact | ||||||||||||||||||||||||||||
| 92 | environmentalScore | ||||||||||||||||||||||||||||
| 93 | environmentalSeverity | ||||||||||||||||||||||||||||
| 94 | ); | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | for my $attribute (@attributes) { | |||||||||||||||||||||||||||
| 97 | 0 | ▶ | $output->{$attribute} = $self->$attribute if ($self->$attribute); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 0 | return $output; | |||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 0 | ▶ | sub TO_JSON { shift->TO_CSAF } | ||||||||||||||||||||||||||
|
Subroutine
TO_JSON: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 1 | 1; | |||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | __END__ | ||||||||||||||||||||||||||||