You need to sign in or sign up before continuing.
Create SBOM report parser
Why are we doing this work
In order to ingest SBoM reports, we need to create a new CI report parser to parse CycloneDX SBoMs.
Relevant links
Implementation references:
Non-functional requirements
-
Documentation: -
Feature flag: -
Performance: -
Report parsing does not negatively impact the performance of GitLab -
Have someone from groupmemory review the implementation
-
-
Testing:
Implementation plan
- Add a CycloneDX JSON schema to
app/validators/json_schemas/cyclonedx.json
- Create
Gitlab::Ci::Reports::Sbom::Reports
.Reports
holds apipeline
,sources
, and a set ofreports
-
reports
will be a set ofGitlab::Ci::Reports::Sbom::Report
objects - Each report tracks
components
,warnings
(schema validation), anderrors
(schema validation) - The relationship between a component and a source needs to be preserved. We can do this by creating a
Gitlab::Ci::Reports::Sbom::Component
class, and having it store a reference to (not a copy of) the source as an attribute. -
Gitlab::Ci::Reports::Sbom::Source
will be created. It will collect the dependency file and package manager data, and also calculate the source fingerprint.
-
- Create
Gitlab::Ci::Parsers::Sbom::Cyclonedx
. This will receive a set of job artifacts plus aReports
instance and:- Parse the artifact JSON
- If the report is invalid, it will add
warnings
/errors
and move to the next report - Collect source information from the report and add the source object to
Reports
. - Iterate through
.components
and add each one toReports
(with associated source data)
- On
ee/app/models/ci/pipeline.rb
, add ansbom_reports
method which will turn job artifacts into reports and return them. See other implementations.
That's it. The Reports
object will be retrieved via the pipeline method and passed to the ingestion service to be stored in the DB.
Verification steps
Edited by Brian Williams