Ingest third-party SBOMs that span several locations
What does this MR do and why?
This MR splits a report of a third-party SBOM that lists packages at several locations into one report for each location, at the start of ingestion.
The GitLab DS analyzer writes one SBOM for each manifest, and ingestion reads one input file for each report. SBOMs from other generators are split in the same way, so each package shows at its own file. Each new report for a path gets a dependency_scanning source that names its file.
This MR also adds the wip feature flag third_party_sbom_support, disabled by default. It gates the handling of SBOMs from analyzers other than GitLab. Each report carries whether the flag is enabled for its project, which the parser in the next MR reads.
Component#pathis writable, so that the parser can set the file of each package in the later MRs.Report#split_by_pathreturns the report itself when no component has a path set. Otherwise it returns one new report for each path, and one more for the components without a path. Each new report shares the dependency graph and metadata of the report and copies its errors and attributes. Giving each new report the edges and the root of its own path is done in the MRs of Ingest the dependency graph of third-party Cycl... (#633166).Sbom::Ingestion::IngestReportsServicesplits the valid reports that carry third-party SBOM support and ingests the others as they are.
This MR is the first of 8 in a stack. The next one is Read SBOMs of other generators at the default l... (!264251 - merged) • Igor Frenkel • 19.6.
Example
A Maven project with two modules:
- Maven project (trimmed)
core/pom.xml:commons-io2.4,commons-text1.8foo/pom.xml:jackson-databind2.9.10
- Trivy SBOM (trimmed): one SBOM
- components:
commons-io,commons-text,jackson-databind - manifest components, no package URL:
core/pom.xml,foo/pom.xml - graph:
core/pom.xml→commons-io,commons-text - graph:
foo/pom.xml→jackson-databind
- components:
- GitLab DS analyzer: one SBOM for each manifest
core/pom.xml:commons-io,commons-textfoo/pom.xml:jackson-databind
- Split by this MR: one report for each manifest, like GitLab's
- report
core/pom.xml:commons-io,commons-text - report
foo/pom.xml:jackson-databind
- report
No component has a path yet in this MR, so no row changes here. The later MRs set the path of each Trivy component.
References
- Related to Ingest components of third-party CycloneDX SBOMs (#633165)
- Related to Ingest the dependency graph of third-party Cycl... (#633166)
Screenshots or screen recordings
No UI change.
How to set up and validate locally
No user-visible change. The specs in the diff cover it.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.