SSVC/Supplier.pm

filter: Statementstmt 79.1% 57 / 72 Branchbran 50.0% 6 / 12 Conditioncond 33.3% 5 / 15 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 61.9% 13 / 21 Podpod 100% 10 / 10 totaltotal 65.0% 91 / 140 CC 12 SCAR 22.2
CC
12
Cov
69%
new
22.3
exploitation
2.0
automatable
2.0
CRAP 9.2
« SSVC.pm ↑ Summary SSVC/Deployer.pm »
1 package SSVC::Supplier;
2  
3 2 ▶use feature ':5.10';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use parent 'SSVC::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 ▶use constant METADATA => +{
Subroutine BEGIN: called CC=1 SCAR=0.0
13 key => 'supplier',
14 name => 'Supplier',
15 description =>
16 'Decision about the priority with which a supplier should develop and release a patch or other remediation for a vulnerability.',
17 url => 'https://certcc.github.io/SSVC/',
18 2 };
19  
20 #<<<
21 2 ▶use constant DECISION_POINTS => +{
Subroutine BEGIN: called CC=1 SCAR=0.0
22 exploitation => {
23 vector_name => 'E',
24 label => 'Exploitation',
25 definition => 'The present state of exploitation of the vulnerability.',
26 values => [N => 'none', P => 'public_poc', A => 'active'],
27 },
28  
29 automatable => {
30 vector_name => 'A',
31 label => 'Automatable',
32 definition => 'Can an attacker reliably automate creating exploitation events for this vulnerability?',
33 values => [N => 'no', Y => 'yes'],
34 },
35  
36 value_density => {
37 vector_name => 'VD',
38 label => 'Value Density',
39 definition => 'The concentration of value in the target.',
40 values => [D => 'diffuse', C => 'concentrated'],
41 },
42  
43 utility => {
44 vector_name => 'U',
45 label => 'Utility',
46 definition => 'The usefulness of the exploit to the adversary, computed from Automatable and Value Density.',
47 values => [L => 'laborious', E => 'efficient', S => 'super_effective'],
48 },
49  
50 technical_impact => {
51 vector_name => 'TI',
52 label => 'Technical Impact',
53 definition => 'The technical impact of the vulnerability.',
54 values => [P => 'partial', T => 'total'],
55 },
56  
57 safety_impact => {
58 vector_name => 'SI',
59 label => 'Safety Impact',
60 definition => 'The safety impact of the vulnerability.',
61 values => [N => 'negligible', M => 'marginal', R => 'critical', C => 'catastrophic'],
62 },
63  
64 public_safety_impact => {
65 vector_name => 'PSI',
66 label => 'Public Safety Impact',
67 definition => 'A coarse-grained representation of impact to public safety, computed from Safety Impact.',
68 values => [M => 'minimal', S => 'significant'],
69 },
70  
71 decision => {
72 vector_name => 'DSOI',
73 label => 'Defer, Scheduled, Out-of-Cycle, Immediate',
74 definition => 'The priority with which a supplier should develop and release a patch or other remediation.',
75 values => [D => 'defer', S => 'scheduled', O => 'out_of_cycle', I => 'immediate'],
76 },
77 2 };
78 #>>>
79  
80 2 ▶use constant DECISION_PATH => [qw(E U TI PSI)];
Subroutine BEGIN: called CC=1 SCAR=0.0
81 2 ▶use constant VECTOR => [qw(E A VD U TI SI PSI DSOI)];
Subroutine BEGIN: called CC=1 SCAR=0.0
82  
83 # https://certcc.github.io/SSVC/reference/decision_points/utility/ (Automatable x Value Density -> Utility)
84 # A VD => U
85 2 my %A_VD_to_U = (N => {D => 'L', C => 'E'}, Y => {D => 'E', C => 'S'},);
86  
87 # https://certcc.github.io/SSVC/reference/decision_points/public_safety_impact/ (Safety Impact -> Public Safety Impact)
88 # SI => PSI
89 2 my %SI_to_PSI = (N => 'M', M => 'S', R => 'S', C => 'S');
90  
91 # https://certcc.github.io/SSVC/howto/supplier_tree/ (Exploitation x Utility x Technical Impact x Public Safety Impact -> Decision)
92 # E U TI PSI => DSOI
93 #<<<
94 2 ▶use constant DECISION_TREE => +{
Subroutine BEGIN: called CC=1 SCAR=0.0
95 'N:L:P:M' => 'D', 'N:L:P:S' => 'S', 'N:L:T:M' => 'S', 'N:L:T:S' => 'O',
96 'N:E:P:M' => 'S', 'N:E:P:S' => 'O', 'N:E:T:M' => 'S', 'N:E:T:S' => 'O',
97 'N:S:P:M' => 'S', 'N:S:P:S' => 'O', 'N:S:T:M' => 'O', 'N:S:T:S' => 'O',
98 'P:L:P:M' => 'S', 'P:L:P:S' => 'O', 'P:L:T:M' => 'S', 'P:L:T:S' => 'I',
99 'P:E:P:M' => 'S', 'P:E:P:S' => 'I', 'P:E:T:M' => 'O', 'P:E:T:S' => 'I',
100 'P:S:P:M' => 'O', 'P:S:P:S' => 'I', 'P:S:T:M' => 'O', 'P:S:T:S' => 'I',
101 'A:L:P:M' => 'O', 'A:L:P:S' => 'I', 'A:L:T:M' => 'O', 'A:L:T:S' => 'I',
102 'A:E:P:M' => 'O', 'A:E:P:S' => 'I', 'A:E:T:M' => 'O', 'A:E:T:S' => 'I',
103 'A:S:P:M' => 'I', 'A:S:P:S' => 'I', 'A:S:T:M' => 'I', 'A:S:T:S' => 'I',
104 2 };
105 #>>>
106  
107 36 ▶sub new {
Subroutine new: called CC=12 SCAR=31.0
Pod documented
108  
109 36 my ($class, %params) = @_;
110  
111 36 my $self = $class->SUPER::new(%params);
112  
113 36 ▶ unless ($self->vector_value('A') && $self->vector_value('VD')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->vector_value("A") and $self->vector_value("VD")) 0 36 36
Condition33%1/3
$self->vector_value("A") and $self->vector_value("VD")
!ll&&!rl&&r
0036
MC/DC0%0/2
$self->vector_value("A") and $self->vector_value("VD")
$self->vector_value("A") $self->vector_value("VD")
Truth table33%1/3
A and B
A= $self->vector_value("A")B= $self->vector_value("VD")
ABresult
0X0
100
111
114 0 Carp::croak "Cannot compute 'utility': need 'automatable' and 'value_density'";
115 }
116  
117 36 my $computed_U = $A_VD_to_U{$self->vector_value('A')}->{$self->vector_value('VD')};
118  
119 36 ▶ if ($self->vector_value('U') && $self->vector_value('U') ne $computed_U) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->vector_value("U") and $self->vector_value("U") ne $computed_U) 0 36 36
Condition33%1/3
$self->vector_value("U") and $self->vector_value("U") ne $computed_U
!ll&&!rl&&r
3600
MC/DC0%0/2
$self->vector_value("U") and $self->vector_value("U") ne $computed_U
$self->vector_value("U") $self->vector_value("U") ne $computed_U
Truth table33%1/3
A and B
A= $self->vector_value("U")B= $self->vector_value("U") ne $computed_U
ABresult
0X0
100
111
120 0 Carp::croak sprintf "Inconsistent 'utility' (got: %s, expected: %s)", $self->vector_value('U'), $computed_U;
121 }
122  
123 36 $self->{vector}->{U} = $computed_U;
124 36 $self->{decision_points}->{utility} = $class->decision_point_labels('utility')->{$computed_U};
125  
126 36 ▶ unless ($self->vector_value('SI')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->vector_value("SI")) 0 36 36
127 0 Carp::croak "Cannot compute 'public_safety_impact': need 'safety_impact'";
128 }
129  
130 36 my $computed_PSI = $SI_to_PSI{$self->vector_value('SI')};
131  
132 36 ▶ if ($self->vector_value('PSI') && $self->vector_value('PSI') ne $computed_PSI) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->vector_value("PSI") and $self->vector_value("PSI") ne $computed_PSI) 0 36 36
Condition33%1/3
$self->vector_value("PSI") and $self->vector_value("PSI") ne $computed_PSI
!ll&&!rl&&r
3600
MC/DC0%0/2
$self->vector_value("PSI") and $self->vector_value("PSI") ne $computed_PSI
$self->vector_value("PSI") $self->vector_value("PSI") ne $computed_PSI
Truth table33%1/3
A and B
A= $self->vector_value("PSI")B= $self->vector_value("PSI") ne $computed_PSI
ABresult
0X0
100
111
133 0 Carp::croak sprintf "Inconsistent 'public_safety_impact' (got: %s, expected: %s)", $self->vector_value('PSI'),
134 $computed_PSI;
135 }
136  
137 36 $self->{vector}->{PSI} = $computed_PSI;
138 $self->{decision_points}->{public_safety_impact}
139 36 = $class->decision_point_labels('public_safety_impact')->{$computed_PSI};
140  
141 36 ▶ unless ($self->vector_value('E') && $self->vector_value('TI')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->vector_value("E") and $self->vector_value("TI")) 0 36 36
Condition33%1/3
$self->vector_value("E") and $self->vector_value("TI")
!ll&&!rl&&r
0036
MC/DC0%0/2
$self->vector_value("E") and $self->vector_value("TI")
$self->vector_value("E") $self->vector_value("TI")
Truth table33%1/3
A and B
A= $self->vector_value("E")B= $self->vector_value("TI")
ABresult
0X0
100
111
142 0 Carp::croak "Cannot compute 'decision': need 'exploitation' and 'technical_impact'";
143 }
144  
145 36 my $computed_D = $class->DECISION_TREE->{join ':', map { $self->vector_value($_) } @{$class->DECISION_PATH}};
146  
147 36 ▶ if ($self->vector_value('DSOI') && $self->vector_value('DSOI') ne $computed_D) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->vector_value("DSOI") and $self->vector_value("DSOI") ne $computed_D) 0 36 36
Condition33%1/3
$self->vector_value("DSOI") and $self->vector_value("DSOI") ne $computed_D
!ll&&!rl&&r
3600
MC/DC0%0/2
$self->vector_value("DSOI") and $self->vector_value("DSOI") ne $computed_D
$self->vector_value("DSOI") $self->vector_value("DSOI") ne $computed_D
Truth table33%1/3
A and B
A= $self->vector_value("DSOI")B= $self->vector_value("DSOI") ne $computed_D
ABresult
0X0
100
111
148 0 Carp::croak sprintf "Inconsistent 'decision' (got: %s, expected: %s)", $self->vector_value('DSOI'), $computed_D;
149 }
150  
151 36 $self->{vector}->{DSOI} = $computed_D;
152 36 $self->{decision} = $class->decision_point_labels('decision')->{$computed_D};
153  
154 36 return $self;
155  
156 }
157  
158 0 ▶sub exploitation { shift->{decision_points}->{exploitation} }
Subroutine exploitation: not called CC=1 SCAR=6.9
Pod documented
159 0 ▶sub automatable { shift->{decision_points}->{automatable} }
Subroutine automatable: not called CC=1 SCAR=6.9
Pod documented
160 0 ▶sub value_density { shift->{decision_points}->{value_density} }
Subroutine value_density: not called CC=1 SCAR=6.9
Pod documented
161 0 ▶sub utility { shift->{decision_points}->{utility} }
Subroutine utility: not called CC=1 SCAR=6.9
Pod documented
162 0 ▶sub technical_impact { shift->{decision_points}->{technical_impact} }
Subroutine technical_impact: not called CC=1 SCAR=6.9
Pod documented
163 0 ▶sub safety_impact { shift->{decision_points}->{safety_impact} }
Subroutine safety_impact: not called CC=1 SCAR=6.9
Pod documented
164 0 ▶sub public_safety_impact { shift->{decision_points}->{public_safety_impact} }
Subroutine public_safety_impact: not called CC=1 SCAR=6.9
Pod documented
165 36 ▶sub decision { shift->{decision} }
Subroutine decision: called CC=1 SCAR=0.0
Pod documented
166  
167 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=1 SCAR=6.9
Pod documented
168  
169 0 my $self = shift;
170  
171 return {
172 0 exploitation => $self->exploitation,
173 automatable => $self->automatable,
174 value_density => $self->value_density,
175 utility => $self->utility,
176 technical_impact => $self->technical_impact,
177 safety_impact => $self->safety_impact,
178 public_safety_impact => $self->public_safety_impact,
179 decision => $self->decision,
180 };
181  
182 }
183  
184 2 1;
185  
186  
187 __END__
« SSVC.pm ↑ Summary SSVC/Deployer.pm »