| 1 | package SSVC::CISA; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use feature ':5.10'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use parent 'SSVC::Base'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Time::Piece; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use overload '""' => 'to_vector_string', fallback => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | use constant EXPLOITATION => [qw(none poc active)]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | ▶ | use constant AUTOMATABLE => [qw(yes no)]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | ▶ | use constant TECHNICAL_IMPACT => [qw(partial total)]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | use constant MISSION_PREVALENCE => [qw(minimal support essential)]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use constant PUBLIC_WELL_BEING_IMPACT => [qw(minimal material irreversible)]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | ▶ | use constant MISSION_WELL_BEING_IMPACT => [qw(low medium high)]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | ▶ | use constant DECISION => [qw(track track* attend act)]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 3 | my $VECTOR_STRING_REGEX = qr{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | SSVCv2/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | E:(?<E>[NPA])/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | A:(?<A>[YN])/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | T:(?<T>[PT])/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | P:(?<P>[MSE])/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | B:(?<B>[MAI])/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | M:(?<M>[LMH])/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | D:(?<D>[TRAC]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | }x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 3 | ▶ | use constant METADATA => +{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | key => 'cisa', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | name => 'CISA SSVC', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | description => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 'CISA Stakeholder-Specific Vulnerability Categorization decision tree for prioritizing vulnerability response.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | url => 'https://www.cisa.gov/sites/default/files/publications/cisa-ssvc-guide%20508c.pdf', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | #<<< | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 3 | ▶ | use constant DECISION_POINTS => +{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | exploitation => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | vector_name => 'E', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | label => 'Exploitation', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | definition => 'The present state of exploitation of the vulnerability.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | values => [N => 'none', P => 'poc', A => 'active'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | automatable => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | vector_name => 'A', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | label => 'Automatable', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | definition => 'Can an attacker reliably automate creating exploitation events for this vulnerability?', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | values => [Y => 'yes', N => 'no'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | technical_impact => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | vector_name => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | label => 'Technical Impact', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | definition => 'The technical impact of the vulnerability.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | values => [P => 'partial', T => 'total'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | mission_prevalence => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | vector_name => 'P', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | label => 'Mission Prevalence', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | definition => 'Prevalence of the mission essential functions.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | values => [M => 'minimal', S => 'support', E => 'essential'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | public_well_being_impact => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | vector_name => 'B', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | label => 'Public Well-Being Impact', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | definition => 'A coarse-grained representation of impact to public well-being.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | values => [M => 'minimal', A => 'material', I => 'irreversible'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | mission_well_being_impact => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | vector_name => 'M', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | label => 'Mission and Well-Being Impact', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | definition => 'Mission and Well-Being Impact is a combination of Mission Prevalence and Public Well-Being Impact.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | values => [L => 'low', M => 'medium', H => 'high'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | decision => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | vector_name => 'D', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | label => 'Decision', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | definition => 'The vulnerability scoring decision (Track, Track*, Attend, Act).', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | values => [T => 'track', R => 'track*', A => 'attend', C => 'act'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | #>>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 3 | ▶ | use constant DECISION_PATH => [qw(E A T M)]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # https://www.cisa.gov/sites/default/files/publications/cisa-ssvc-guide%20508c.pdf (Figure 1 - Table 9) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # E A T M => D | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 3 | ▶ | use constant DECISION_TREE => +{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 'N:N:P:L' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 'N:N:P:M' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 'N:N:P:H' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 'N:N:T:L' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 'N:N:T:M' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 'N:N:T:H' => 'R', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 'N:Y:P:L' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 'N:Y:P:M' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 'N:Y:P:H' => 'A', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 'N:Y:T:L' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 'N:Y:T:M' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 'N:Y:T:H' => 'A', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 'P:N:P:L' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 'P:N:P:M' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 'P:N:P:H' => 'R', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 'P:N:T:L' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 'P:N:T:M' => 'R', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 'P:N:T:H' => 'A', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 'P:Y:P:L' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 'P:Y:P:M' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 'P:Y:P:H' => 'A', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 'P:Y:T:L' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 'P:Y:T:M' => 'R', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 'P:Y:T:H' => 'A', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 'A:N:P:L' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 'A:N:P:M' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 'A:N:P:H' => 'A', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 'A:N:T:L' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 'A:N:T:M' => 'A', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 'A:N:T:H' => 'C', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 'A:Y:P:L' => 'A', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 'A:Y:P:M' => 'A', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 'A:Y:P:H' => 'C', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 'A:Y:T:L' => 'A', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 'A:Y:T:M' => 'C', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 'A:Y:T:H' => 'C', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # https://www.cisa.gov/sites/default/files/publications/cisa-ssvc-guide%20508c.pdf (Table 8) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 3 | my %PB_to_M = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # - | M | A | I | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # --|---|---|-- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # M | L | M | H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # S | M | M | H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | # E | H | H | H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # B = minimal material irreversible | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | M => {M => 'L', A => 'M', I => 'H'}, # P = minimal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | S => {M => 'M', A => 'M', I => 'H'}, # P = support | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | E => {M => 'H', A => 'H', I => 'H'}, # P = essential | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 144 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=11 SCAR=29.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 144 | my ($class, %params) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 144 | my $self = $class->SUPER::new(%params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 144 | ▶ | unless ($self->vector_value('P') && $self->vector_value('B')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->vector_value("P") and $self->vector_value("B")
MC/DC0%0/2
$self->vector_value("P") and $self->vector_value("B")
$self->vector_value("P")
$self->vector_value("B")
Truth table33%1/3
A and B
A= $self->vector_value("P")B= $self->vector_value("B")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | Carp::croak "Cannot compute 'mission_well_being_impact'" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | . ": need 'mission_prevalence' and 'public_well_being_impact'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 144 | my $computed_M = $PB_to_M{$self->vector_value('P')}->{$self->vector_value('B')}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 144 | ▶ | if ($self->vector_value('M') && $self->vector_value('M') ne $computed_M) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->vector_value("M") and $self->vector_value("M") ne $computed_M
MC/DC0%0/2
$self->vector_value("M") and $self->vector_value("M") ne $computed_M
$self->vector_value("M")
$self->vector_value("M") ne $computed_M
Truth table66%2/3
A and B
A= $self->vector_value("M")B= $self->vector_value("M") ne $computed_M
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | Carp::croak sprintf "Inconsistent 'mission_well_being_impact' (got: %s, expected: %s)", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | $self->vector_value('M'), $computed_M; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 144 | $self->{vector}->{M} = $computed_M; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | $self->{decision_points}->{mission_well_being_impact} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 144 | = $class->decision_point_labels('mission_well_being_impact')->{$computed_M}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 144 | ▶ | unless ($self->vector_value('E') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$self->vector_value("E") and $self->vector_value("A") and $self->vector_value("T") and $self->vector_value("M")
$self->vector_value("E") and $self->vector_value("A") and $self->vector_value("T")
$self->vector_value("E") and $self->vector_value("A")
MC/DC0%0/4
$self->vector_value("E") and $self->vector_value("A") and $self->vector_value("T") and $self->vector_value("M")
$self->vector_value("E")
$self->vector_value("A")
$self->vector_value("T")
$self->vector_value("M")
Truth table20%1/5
A and B and C and D
A= $self->vector_value("E")B= $self->vector_value("A")C= $self->vector_value("T")D= $self->vector_value("M")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | && $self->vector_value('A') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | && $self->vector_value('T') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | && $self->vector_value('M')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | Carp::croak "Cannot compute 'decision'" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | . ": need 'exploitation', 'automatable', 'technical_impact' and 'mission_well_being_impact'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 144 | my $computed_D = $class->DECISION_TREE->{join ':', map { $self->vector_value($_) } qw(E A T M)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 144 | ▶ | if ($self->vector_value('D') && $self->vector_value('D') ne $computed_D) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->vector_value("D") and $self->vector_value("D") ne $computed_D
MC/DC0%0/2
$self->vector_value("D") and $self->vector_value("D") ne $computed_D
$self->vector_value("D")
$self->vector_value("D") ne $computed_D
Truth table66%2/3
A and B
A= $self->vector_value("D")B= $self->vector_value("D") ne $computed_D
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | Carp::croak sprintf "Inconsistent 'decision' (got: %s, expected: %s)", $self->vector_value('D'), $computed_D; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 144 | $self->{vector}->{D} = $computed_D; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 144 | $self->{decision} = $class->decision_point_labels('decision')->{$self->vector_value('D')}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 144 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 108 | ▶ | sub from_vector_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from_vector_string: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 108 | my ($class, $vector_string) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 108 | ▶ | if ($vector_string =~ /$VECTOR_STRING_REGEX/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 108 | my %metrics = %+; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 108 | my %params = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 108 | my @decision_points = (qw[ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | exploitation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | automatable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | technical_impact | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | mission_prevalence | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | public_well_being_impact | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | mission_well_being_impact | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | decision | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | ]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 108 | foreach (@decision_points) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 756 | my $decision_point = $class->DECISION_POINTS->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 756 | $params{$_} = $class->decision_point_labels($_)->{$metrics{$decision_point->{vector_name}}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 108 | return __PACKAGE__->new(%params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | Carp::croak "Malformed CISA SSVCv2 vector string"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | sub exploitation { shift->{decision_points}->{exploitation} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exploitation: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | sub automatable { shift->{decision_points}->{automatable} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
automatable: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | sub technical_impact { shift->{decision_points}->{technical_impact} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
technical_impact: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | sub mission_prevalence { shift->{decision_points}->{mission_prevalence} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mission_prevalence: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | sub public_well_being_impact { shift->{decision_points}->{public_well_being_impact} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
public_well_being_impact: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | sub mission_well_being_impact { shift->{decision_points}->{mission_well_being_impact} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mission_well_being_impact: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 36 | ▶ | sub decision { shift->{decision} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decision: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 108 | ▶ | sub to_vector_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_vector_string: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 108 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 108 | my $now = Time::Piece->gmtime->datetime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 108 | ▶ | my @vectors = (map { join ':', $_, $self->{vector}->{$_} || Carp::croak 'Missing metric' } qw[E A T P B M D]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'vector'}{$_} || Carp::croak('Missing metric')
MC/DC0%0/1
$self->{'vector'}{$_} || Carp::croak('Missing metric')
$self->{'vector'}{$_}
Truth table50%1/2
A
A= $self->{'vector'}{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 108 | return join '/', 'SSVCv2', @vectors, "${now}.000Z"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | sub TO_JSON { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TO_JSON: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | exploitation => $self->exploitation, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | automatable => $self->automatable, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | technical_impact => $self->technical_impact, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | mission_prevalence => $self->mission_prevalence, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | public_well_being_impact => $self->public_well_being_impact, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | mission_well_being_impact => $self->mission_well_being_impact, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | decision => $self->decision, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||