SBOM Scanning
Overview
argus scan --sbom PATH hands an SBOM (or every SBOM in a directory) to the SBOM-capable scanners: osv-scanner plus the vulnerability matcher that reads the SBOM's generator, grype or trivy (see Choosing the matcher). Filesystem scanners are skipped, since there is no source tree to scan.
argus scan --sbom image.spdx.json # osv + the matcher for this SBOM
argus scan grype --sbom image.spdx.json # one scanner, your choice
argus scan --sbom vendor-sboms/ # every SBOM under a directory
argus scan --sbom image.spdx.json --dry-run # show which matcher each SBOM gets
argus sbom inspect image.spdx.json # what the SBOM describes, no scan
Supported formats: CycloneDX (JSON, XML), SPDX (JSON, tag-value) and Syft JSON. Argus sniffs the content, so file names don't matter.
Inspecting an SBOM
Before scanning, argus sbom inspect FILE shows what the SBOM describes. It reads the file and runs no scanner.
$ argus sbom inspect image.spdx.json
SBOM: image.spdx.json
Format: SPDX JSON (SPDX-2.3)
Generator: syft 1.54.1
Subject: amazonlinux 2023.1.20230705.0 (container)
Digest: sha256:a2fe6341cfe8bdd6c189eddb77a4173cb857a20e918a954937fe6e9e807ddeb5
OS: amzn 2023 (from package purls)
Packages: 106 (103 OS)
pypi 3
rpm 103
Matcher: grype (SBOM generated by syft 1.54.1)
| Field | Where it comes from |
|---|---|
| Format | Content sniffing; the spec version from specVersion (CycloneDX), spdxVersion / SPDXVersion (SPDX), schema.version (Syft JSON) |
| Generator | See Choosing the matcher. not recorded when the SBOM doesn't say |
| Subject | CycloneDX metadata.component; the SPDX CONTAINER (or DESCRIBES) package, else the document name; Syft JSON source. The digest comes from the subject's pkg:oci purl, a recorded repo digest, or the package checksum, when the SBOM has one |
| OS | The most common distro= qualifier on the package purls, since that's what the matchers read. When no package has one: the CycloneDX operating-system component, the SPDX OPERATING-SYSTEM package, or the Syft JSON distro block |
| Packages | Package purls by type. OS packages are the ones with a distro= qualifier or an apk / deb / rpm / alpm purl. The SBOM's own subject isn't counted |
| Matcher | What argus scan --sbom FILE would run |
--format json prints the same fields as JSON (format, spec_version, generator, subject, os, packages, matcher, warnings) for scripts. The command exits 2 when the file isn't a recognized SBOM.
Choosing the matcher
trivy and grype each read only some generators' SBOMs reliably. Argus reads the generator from the SBOM itself and picks the matcher:
| Generator | Formats | Matcher | Why |
|---|---|---|---|
| syft | SPDX JSON / tag-value, CycloneDX JSON / XML, Syft JSON | grype | grype matches syft's OS packages; trivy reads the OS as none (SPDX) or as amzn, which it doesn't support (CycloneDX), and can't read Syft JSON |
| grype | CycloneDX JSON / XML | grype | Same purl and distro conventions as syft |
| trivy | SPDX JSON / tag-value, CycloneDX JSON / XML | trivy | grype can't map trivy's distro names (amazon) and skips the OS packages |
| any other tool, or none recorded | any | grype and trivy | No measured behaviour to go on. Both run and the coverage check flags whichever skipped the OS packages |
Syft JSON never goes to trivy, whoever wrote the file: trivy can't decode the format. osv-scanner runs for every SBOM either way.
Where the generator comes from:
- CycloneDX:
metadata.tools(the 1.5+componentsform and the older list form) - SPDX: the
Tool: name-x.y.zentry increationInfo.creators(Creator:lines in tag-value) - Syft JSON: the
descriptorblock
Naming a scanner (argus scan trivy --sbom FILE) always runs it. When it isn't the recommended matcher for that SBOM, Argus logs a warning, and if it skips the OS packages the result is marked incomplete. --dry-run prints the choice for each SBOM.
Incomplete results
A matcher can read an SBOM, fail to work out which operating system its packages belong to, and skip every OS package without an error. Its zero findings for those packages don't mean they're clean; they were never checked.
Argus checks for this on every SBOM-mode result. An OS package carries a distro= qualifier in its purl (for example pkg:rpm/amzn/openssl-libs@3.0.8-1.amzn2023.0.3?distro=amzn-2023). When the SBOM has OS packages and the matcher's own report shows it didn't evaluate them, the result is marked incomplete:
| Matcher | How Argus knows it skipped the OS packages |
|---|---|
| trivy | Its JSON report has no os-pkgs result |
| grype | Its JSON report names no distro grype supports, and no match is for an OS package |
An incomplete result is never a pass:
- The terminal and markdown reports show
Status: INCOMPLETEand the reason, for exampletrivy did not evaluate the SBOM's 103 OS package(s) (amzn-2023); it read the OS as 'none'. argus-results.jsonhas"passed": false,"complete": falseand"incomplete_scanners": [...]. The scanner's result carries"incomplete": trueand its metadata hasincomplete_reason.- SARIF adds an
error-leveltoolExecutionNotificationsentry (argus/incomplete-scan) to that scanner's run. JUnit adds anincompleteerror testcase. argus scanexits 2, with or without--fail-on-scanner-error. Findings at or above the severity threshold still exit 1 first.
Known cases (pinned tools)
Measured against amazonlinux:2023.1.20230705.0 with syft v1.54.1, trivy 0.76.0 and grype v0.120.1:
| SBOM | trivy | grype |
|---|---|---|
| syft SPDX JSON | incomplete (reads the OS as none) |
237 findings |
| syft CycloneDX JSON | incomplete (amzn is unsupported) |
237 findings |
| Syft JSON | fails: trivy can't read the format | 237 findings |
| trivy CycloneDX JSON | 504 findings | incomplete (can't map amazon) |
| trivy SPDX JSON | 504 findings | incomplete (can't map amazon) |
These are the cases the matcher choice above avoids. You only hit them by naming the other matcher, or with an SBOM from a generator Argus doesn't recognize.