CycloneDX/Declarations/Claim.pm

filter: Statementstmt 63.4% 40 / 63 Branchbran 0.0% 0 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 58.8% 10 / 17 Podpod 100% 1 / 1 totaltotal 50.5% 51 / 101 CC 11 SCAR 37.3
CC
11
Cov
48%
TO_JSON
110.0
__ANON__
6.0
__ANON__
2.0
CRAP 41.8
« CycloneDX/Standard/Requirement.pm ↑ Summary CycloneDX/Declarations/Evidence.pm »
1 package SBOM::CycloneDX::Declarations::Claim;
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 SBOM::CycloneDX::BomRef;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use SBOM::CycloneDX::List;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Types::Standard qw(Str InstanceOf HashRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Types::TypeTiny qw(ArrayLike);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 extends 'SBOM::CycloneDX::Base';
18  
19 has bom_ref => (
20 is => 'rw',
21 isa => InstanceOf ['SBOM::CycloneDX::BomRef'],
22 0 ▶ coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::BomRef->new($_[0]) }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
23 1 );
24  
25 # Array of bom-ref
26 0 ▶has target => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new });
Subroutine __ANON__: not called CC=1 SCAR=1.2
27  
28 1 has predicate => (is => 'rw', isa => Str);
29  
30 # Array of bom-ref
31 0 ▶has mitigation_strategies => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new });
Subroutine __ANON__: not called CC=1 SCAR=1.2
32  
33 1 has reasoning => (is => 'rw', isa => Str);
34  
35 # Array of bom-ref
36 0 ▶has evidence => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new });
Subroutine __ANON__: not called CC=1 SCAR=1.2
37  
38 # Array of bom-ref
39 0 ▶has counter_evidence => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new });
Subroutine __ANON__: not called CC=1 SCAR=1.2
40  
41 has external_references => (
42 is => 'rw',
43 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::ExternalReferences']],
44 0 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
45 1 );
46  
47 1 has signature => (is => 'rw', isa => HashRef);
48  
49 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=10 SCAR=47.0
Pod documented
50  
51 0 my $self = shift;
52  
53 0 my $json = {};
54  
55 0 ▶ $json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
Branch: 1 branch
BranchTrueFalseTotal
if $self->bom_ref 0 0 0
56 0 ▶ $json->{target} = $self->target if @{$self->target};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->target;} 0 0 0
57 0 ▶ $json->{predicate} = $self->predicate if $self->predicate;
Branch: 1 branch
BranchTrueFalseTotal
if $self->predicate 0 0 0
58 0 ▶ $json->{mitigationStrategies} = $self->mitigation_strategies if @{$self->mitigation_strategies};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->mitigation_strategies;} 0 0 0
59 0 ▶ $json->{reasoning} = $self->reasoning if $self->reasoning;
Branch: 1 branch
BranchTrueFalseTotal
if $self->reasoning 0 0 0
60 0 ▶ $json->{evidence} = $self->evidence if @{$self->evidence};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->evidence;} 0 0 0
61 0 ▶ $json->{counterEvidence} = $self->counter_evidence if @{$self->counter_evidence};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->counter_evidence;} 0 0 0
62 0 ▶ $json->{externalReferences} = $self->external_references if @{$self->external_references};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->external_references;} 0 0 0
63 0 ▶ $json->{signature} = $self->signature if $self->signature;
Branch: 1 branch
BranchTrueFalseTotal
if $self->signature 0 0 0
64  
65 0 return $json;
66  
67 }
68  
69 1 1;
70  
71 =encoding utf-8
72  
73 =head1 NAME
74  
75 SBOM::CycloneDX::Declarations::Claim - Claim
76  
77 =head1 SYNOPSIS
78  
79 SBOM::CycloneDX::Declarations::Claim->new();
80  
81  
82 =head1 DESCRIPTION
83  
84 L<SBOM::CycloneDX::Declarations::Claim> provides the claim object.
85  
86 =head2 METHODS
87  
88 L<SBOM::CycloneDX::Declarations::Claim> inherits all methods from L<SBOM::CycloneDX::Base>
89 and implements the following new ones.
90  
91 =over
92  
93 =item SBOM::CycloneDX::Declarations::Claim->new( %PARAMS )
94  
95 Properties:
96  
97 =over
98  
99 =item * C<bom_ref>, An identifier which can be used to reference the object
100 elsewhere in the BOM. Every C<bom_ref> must be unique within the BOM.
101  
102 =item * C<counter_evidence>, The list of `bom-ref` to counterEvidence that
103 supports this claim.
104  
105 =item * C<evidence>, The list of `bom-ref` to evidence that supports this
106 claim.
107  
108 =item * C<external_references>, External references provide a way to document
109 systems, sites, and information that may be relevant but are not included
110 with the BOM. They may also establish specific relationships within or
111 external to the BOM.
112  
113 =item * C<mitigation_strategies>, The list of `bom-ref` to the evidence
114 provided describing the mitigation strategies. Each mitigation strategy
115 should include an explanation of how any weaknesses in the evidence will be
116 mitigated.
117  
118 =item * C<predicate>, The specific statement or assertion about the target.
119  
120 =item * C<reasoning>, The written explanation of why the evidence provided
121 substantiates the claim.
122  
123 =item * C<signature>, Enveloped signature in JSON Signature Format (JSF)
124 (L<https://cyberphone.github.io/doc/security/jsf.html>).
125  
126 =item * C<target>, The `bom-ref` to a target representing a specific system,
127 application, API, module, team, person, process, business unit, company,
128 etc... that this claim is being applied to.
129  
130 =back
131  
132 =item $claim->bom_ref
133  
134 =item $claim->counter_evidence
135  
136 =item $claim->evidence
137  
138 =item $claim->external_references
139  
140 =item $claim->mitigation_strategies
141  
142 =item $claim->predicate
143  
144 =item $claim->reasoning
145  
146 =item $claim->signature
147  
148 =item $claim->target
149  
150 =back
151  
152  
153 =head1 SUPPORT
154  
155 =head2 Bugs / Feature Requests
156  
157 Please report any bugs or feature requests through the issue tracker
158 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
159 You will be notified automatically of any progress on your issue.
160  
161 =head2 Source Code
162  
163 This is open source software. The code repository is available for
164 public review and contribution under the terms of the license.
165  
166 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
167  
168 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
169  
170  
171 =head1 AUTHOR
172  
173 =over 4
174  
175 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
176  
177 =back
178  
179  
180 =head1 LICENSE AND COPYRIGHT
181  
182 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
183  
184 This is free software; you can redistribute it and/or modify it under
185 the same terms as the Perl 5 programming language system itself.
186  
187 =cut
« CycloneDX/Standard/Requirement.pm ↑ Summary CycloneDX/Declarations/Evidence.pm »