Skip to content

Commit cf70504

Browse files
committed
SBOM::CycloneDX 1.7
1 parent f0acdea commit cf70504

File tree

5 files changed

+66
-19
lines changed

5 files changed

+66
-19
lines changed

.github/workflows/perltest.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
# This is a basic workflow to help you get started with Actions
2-
31
name: CI
42

5-
# Controls when the action will run. Triggers the workflow on push or pull request
6-
# events but only for the main branch
73
on:
84
push:
95
branches: [ 'main', 'develop' ]
106
pull_request:
117
branches: [ 'main' ]
128
workflow_dispatch:
139

14-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1510
jobs:
1611
build:
1712
runs-on: ${{ matrix.os }}
@@ -30,7 +25,6 @@ jobs:
3025
- run: cpanm Module::Install
3126
- run: cpanm -n --installdeps .
3227
- run: prove -lv t
33-
3428
coverage:
3529
runs-on: ubuntu-latest
3630
container: davorg/perl-coveralls:latest

Changes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Change history for SBOM::CycloneDX
22

3-
1.0? 2026-01-??
3+
1.07 2026-01-21
44
- Improved support for CycloneDX 1.7 (https://cyclonedx.org/docs/1.7/json/)
55
- Improved documentations
66
- Improved ENUM classes

lib/SBOM/CycloneDX.pm

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use constant JSON_SCHEMA_1_5 => 'http://cyclonedx.org/schema/bom-1.5.schema.json
3030
use constant JSON_SCHEMA_1_6 => 'http://cyclonedx.org/schema/bom-1.6.schema.json';
3131
use constant JSON_SCHEMA_1_7 => 'http://cyclonedx.org/schema/bom-1.7.schema.json';
3232

33-
our $VERSION = 1.06_2;
33+
our $VERSION = 1.07;
3434

3535
our %JSON_SCHEMA = (
3636
'1.2' => JSON_SCHEMA_1_2,
@@ -327,15 +327,15 @@ SBOM::CycloneDX - CycloneDX Perl Library
327327
328328
=head1 DESCRIPTION
329329
330-
L<SBOM::CycloneDX> is a library for generate valid CycloneDX BOM file.
330+
L<SBOM::CycloneDX> is a library for generate valid OWASP CycloneDX BOM file.
331331
332-
CycloneDX (ECMA-424) is a modern standard for the software supply chain. At its core,
333-
CycloneDX is a general-purpose Bill of Materials (BOM) standard capable of
334-
representing software, hardware, services, and other types of inventory.
335-
The CycloneDX standard began in 2017 in the Open Worldwide Application Security
336-
Project (OWASP) community. CycloneDX is an OWASP flagship project, has a formal
337-
standardization process and governance model, and is supported by the global
338-
information security community.
332+
OWASP CycloneDX (ECMA-424) is a modern standard for the software supply chain.
333+
At its core, CycloneDX is a general-purpose Bill of Materials (BOM) standard
334+
capable of representing software, hardware, services, and other types of
335+
inventory. The CycloneDX standard began in 2017 in the Open Worldwide
336+
Application Security Project (OWASP) community. CycloneDX is an OWASP flagship
337+
project, has a formal standardization process and governance model, and is
338+
supported by the global information security community.
339339
340340
CycloneDX far exceeds the L<Minimum Elements for Software Bill of Materials|https://www.ntia.gov/files/ntia/publications/sbom_minimum_elements_report.pdf>
341341
as defined by the L<National Telecommunications and Information Administration (NTIA)|https://www.ntia.gov/>
@@ -661,6 +661,8 @@ This is the class hierarchy of the L<SBOM::CycloneDX> distribution.
661661
662662
=item * L<SBOM::CycloneDX::List>
663663
664+
=item * L<SBOM::CycloneDX::Lite>
665+
664666
=item * L<SBOM::CycloneDX::Timestamp>
665667
666668
=item * L<SBOM::CycloneDX::Util>
@@ -676,6 +678,26 @@ and implements the following new ones.
676678
677679
=item SBOM::CycloneDX->new( %PARAMS )
678680
681+
Create new CycloneDX instance.
682+
683+
my $bom = SBOM::CycloneDX->new(
684+
spec_version => '1.5',
685+
version => 1,
686+
serial_number => $serial_number
687+
);
688+
689+
$bom->components->add($component);
690+
691+
say $bom;
692+
693+
=item $bom->spec_version
694+
695+
The version of the CycloneDX specification the BOM conforms to.
696+
697+
Default version is B<1.7>.
698+
699+
$bom->spec_version('1.5');
700+
679701
=item $bom->version
680702
681703
Whenever an existing BOM is modified, either manually or through
@@ -684,6 +706,15 @@ incremented by 1. When a system is presented with multiple BOMs
684706
with identical serial numbers, the system SHOULD use the most
685707
recent version of the BOM. The default version is '1'.
686708
709+
=item $bom->serial_number
710+
711+
Every BOM generated SHOULD have a unique serial number, even if the contents of
712+
the BOM have not changed over time. If specified, the serial number must
713+
conform to L<RFC 4122|https://www.ietf.org/rfc/rfc4122.html>. Use of serial
714+
numbers is recommended.
715+
716+
$bom->serial_number('urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79');
717+
687718
=item $bom->metadata
688719
689720
Provides additional information about a BOM.
@@ -857,7 +888,7 @@ Return L<SBOM::CycloneDX::List> with a list of vulnerabilities with the same C<b
857888
858889
Return L<SBOM::CycloneDX::List> with a list of components affected with the same C<cve_id>.
859890
860-
say $_->bom_ref for($bom->get_affected_components_by_cve('CVE-2025-1234')->list);
891+
say $_->bom_ref for($bom->get_affected_components_by_cve('CVE-2025-12345')->list);
861892
862893
=item $bom->validate
863894
@@ -882,6 +913,12 @@ Encode in JSON.
882913
883914
say "$bom";
884915
916+
=item $bom->to_hash
917+
918+
Convert BOM object in HASH.
919+
920+
my $hashref = $bom->to_hash;
921+
885922
=item $bom->TO_JSON
886923
887924
Encode in JSON.

lib/SBOM/CycloneDX/Base.pm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ sub to_string {
2525
sub to_hash {
2626

2727
my $self = shift;
28+
2829
my $json = $self->to_string;
29-
return Cpanel::JSON::XS->new->decode($json);
30+
my $hash = Cpanel::JSON::XS->new->decode($json);
31+
32+
return $hash;
3033

3134
}
3235

lib/SBOM/CycloneDX/Enum.pm

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,26 @@ SBOM::CycloneDX::Enum - Enumeration
129129
130130
use SBOM::CycloneDX::Enum;
131131
132-
say $_ for (@{SBOM::CycloneDX::Enum->SPDX_LICENSES})
132+
say $_ for (@{ SBOM::CycloneDX::Enum->SPDX_LICENSES });
133+
134+
135+
say $_ for (@{ SBOM::CycloneDX::Enum->values('EXTERNAL_REFERENCE_TYPE') });
133136
134137
=head1 DESCRIPTION
135138
136139
L<SBOM::CycloneDX::Enum> is internal class used by L<SBOM::CycloneDX>.
137140
138141
142+
=head1 METHODS
143+
144+
=over
145+
146+
=item SBOM::CycloneDX::Enum->values( $CONSTANT )
147+
148+
Return the provided C<CONSTANT> Enum values.
149+
150+
=back
151+
139152
=head1 CONSTANTS
140153
141154
=over

0 commit comments

Comments
 (0)