Skip to contents

combine_sbom() puts several SBOMs under one new root component, for a single document that covers more than one app, project or package. Each SBOM's root becomes a component that the new root depends on, and every component, relationship and issue of each SBOM comes along. sbom(c(path1, path2), name = ...) builds an SBOM for each path and combines them with this function.

Usage

combine_sbom(
  ...,
  name,
  version = NULL,
  author = getOption("sbom.author"),
  organization = getOption("sbom.organization"),
  regid = getOption("sbom.regid"),
  timestamp = NULL,
  overrides = NULL,
  advisories = FALSE,
  advisories_on_error = c("error", "continue")
)

Arguments

...

<sbom> objects, or a single list of them, as made by sbom(), the other builders or read_sbom().

name

The name of the new root component, such as the name of the system or the release that the SBOMs make up together. Its ref is combined/<name>.

version

The version of the new root, or NULL for none, which adds a version-missing issue.

author, organization

Who made the SBOM, recorded in its metadata. author may name several people; NA and empty names are dropped. Without either, an issue is recorded.

regid

The registration id of organization: the domain name, or URL, of the organization, under which it registers SWID tags (ISO/IEC 19770-2). A SWID tag names the organization as its creator with this regid. It must be a single string, from which leading and trailing white space is dropped. NULL, NA and an empty or blank string mean none; then the tag uses the placeholder http://invalid.unavailable, and when an organization was given, an issue is recorded. The default is the sbom.regid option, as author and organization read sbom.author and sbom.organization.

timestamp

The creation time, as a date-time or as seconds since 1970-01-01 UTC. An explicit timestamp wins. Without one, the SOURCE_DATE_EPOCH environment variable is used when it is set, so that builds are reproducible, and a note records that the timestamp came from it; otherwise it is the current time. Nix sets SOURCE_DATE_EPOCH to 1980-01-01 in every nix-shell, and when the timestamp is that value a note says it is a placeholder.

overrides

Values to assert where sbom found none, or found something different. NULL, a data frame or the path to a CSV file, with the character columns component (the name or ref of one component, as sbom built it, before any row moves it; embedded and system components only by ref), field, value, asserted_by and reason. field is one of "version", "license_spdx", "supplier_name", "supplier_url", "maintainer", "purl" and "download_location". Rows are applied in order, and each is recorded with who asserted it and why. An override that contradicts a found value wins and adds an override-conflict issue. Asserting "version" makes it the exact version, and moves the component's package URL to it unless a row asserts the "purl": a package URL at the old version takes the new one, and one without a version gains it when its type is cran, github, gitlab or bitbucket. A package file named for the old version is renamed for the new one, and any other is dropped, as are the checksums of the version found. An asserted version of R is also the version of the base packages, each with a record of the assertion. Asserting a CRAN "purl" (pkg:cran) makes the component a CRAN package, or a Bioconductor package when its repository_url names bioconductor.org. When a component's ref is its package URL, the ref follows the package URL that the overrides leave, and every reference to it moves too; a ref that another component already has is an error. Any other ref, such as unknown/<name>, stays as it is. An asserted field removes the component's issues that it answers, such as version-missing or purl-inferred. An issue that also states a fact that stays true is reworded instead, as info: that a package came from a git repository, once its package URL is asserted; that a dependency is missing, once its version and package URL are both asserted; and that a LinkingTo package is not installed, once its version is. The issues that name the components without a version, such as system-version-unknown, name only those still without one, and go when none is left. A blank value, an unknown component or field, or a missing column, is an error.

advisories

Whether to list the OSV security advisories for the SBOM's packages, from the R Consortium advisory database that OSV publishes; see sbom_advisories(). Only exact versions are compared, of the packages whose package URL is a CRAN one (pkg:cran), packages from CRAN-like repositories among them, matched by name. A package with a CRAN package URL and a minimum version, or none, is named in an advisories-no-exact-version issue. An R package that is not known to come from CRAN, because sbom could not tell where it came from (as for a package that is not installed), or because it was installed from a local source or from GitHub, GitLab, Bitbucket or git, is named in an advisories-not-cran issue. Bioconductor packages are not compared: OSV does not cover them yet, and when the SBOM holds one a note states that the advisory database leaves them out. Matching is local, with the versions and package URLs after overrides, so no package name leaves the machine.

FALSE, the default, lists none, makes no network request and adds a note that no advisory data was on hand. TRUE downloads OSV's CRAN export, https://osv-vulnerabilities.storage.googleapis.com/CRAN/all.zip, and looks up the CVSS ratings of the upstream records it names at https://api.osv.dev, sending only their public ids. On a machine without network access, download that all.zip elsewhere and pass its path: it is read where it is, without the network and without ratings.

The SBOM lists what OSV says about these exact versions: a package without an advisory is not shown to be free of flaws, and an upstream CVSS rating describes the upstream flaw, not how exposed the R package is.

advisories_on_error

What happens when the advisory data cannot be downloaded or read, as when the download fails or the zip is damaged: "error", the default, is an error of class sbom_advisories_error that names the problem; "continue" builds the SBOM without advisories, with an R warning of class sbom_advisories_unavailable, a warning issue and a note that no advisory data was on hand. A download larger than 50 MB is refused as an error too. A CVSS rating that cannot be looked up never fails the call: it is left out, with an issue. The lookups stop at the first that times out or fails at the connection, and take at most two minutes in all.

Value

An <sbom> object whose root is a component of type application called name.

Details

A component that is in more than one SBOM, with the same ref, name, version, kind of version (exact or minimum), type, ecosystem and package URL, is listed once. Two versions of a package are both listed. When two SBOMs use the same ref for components that differ, such as R at two versions or two project folders with the same name, the later one gets a ref of its own: the ref followed by @<version>, or by ~2, ~3 and so on when that is taken too or there is no version. Its relationships, issues, advisories and nested components follow. The SBOMs' roots are never merged.

The combined SBOM states its own author, organization, regid and timestamp, so the issues and notes about those of each SBOM are left out. Overrides already applied to an SBOM stay, with who asserted each, and overrides applies more, to the combined SBOM.

Advisories are kept when every SBOM lists them from the same advisory data. Otherwise the combined SBOM lists none, with an advisories-not-combined issue, unless advisories asks for them: then they are looked up again for every component.

Examples

ts <- as.POSIXct("2026-01-01", tz = "UTC")
study <- file.path(sbom_example("study"), "renv.lock")
analysis <- file.path(sbom_example("analysis"), "renv.lock")
x <- combine_sbom(
  sbom_renv(study, system = FALSE, timestamp = ts),
  sbom_renv(analysis, system = FALSE, timestamp = ts),
  name = "research", version = "2026.1", timestamp = ts
)
sbom_tree(x, max_depth = 2)
#> research 2026.1
#> ├─analysis
#> │ ├─cli 3.6.5
#> │ └─jsonlite 2.0.0
#> └─study
#>   └─inhouse 0.3.0