Reading a software bill of materials: CycloneDX and SPDX in practice

An SBOM lists the components inside a build. How to generate one with Syft, read the fields that matter (name, version, purl, license, hashes), and answer “are we affected?” within minutes of a new advisory.

Lesson 14 of 26 · 12 min read · practice only with authorization

Diagram

From image to answer

Follow the path. One example at a time.

Step 1 of 4

Generate

Create an SBOM from an image or directory.

Illustration: Generate
$ syft registry.example.test/shop/api:1.42.0 -o cyclonedx-json > api.cdx.json
$ jq '.components | length' api.cdx.json
412
What changes the outcome
Question

Grep every repo and image

Time

Days

Coverage

Unknown

The example on the open step is one illustration, or the fix you can paste into an application you own.

What this page is made of

3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.

  1. Package URLs

    What fails
    The purl identifies ecosystem, namespace, name, and version in one string.
    Who is affected
    Teams matching advisories to components.
    What you would notice
    SBOMs without purls or with only file names.
    What you change
    Use generators that emit purls and keep them.
  2. Transitive dependencies

    What fails
    Most components arrive as dependencies of dependencies.
    Who is affected
    Services that never chose those packages directly.
    What you would notice
    A vulnerable library absent from the manifest but present in the SBOM.
    What you change
    Generate SBOMs from built artifacts, not only manifests.
  3. Storage and lookup

    What fails
    An SBOM nobody can query does not help on advisory day.
    Who is affected
    Incident responders.
    What you would notice
    SBOMs left as build artifacts that expire.
    What you change
    Store them centrally, for example in Dependency-Track, keyed by release.

CycloneDX and SPDX

Both are standard formats. CycloneDX (OWASP) is common in security tooling and supports vulnerability and service data; SPDX (Linux Foundation, ISO/IEC 5962) has deep license expression support. Most tools read both, so pick one and generate it for every release.

VEX: affected or not

A Vulnerability Exploitability eXchange document records whether a listed vulnerability actually affects a product, for example because the vulnerable function is never called. It turns a long scanner list into decisions others can reuse.

{"vulnerability":{"id":"CVE-2024-0000"},
 "analysis":{"state":"not_affected","justification":"code_not_reachable"},
 "affects":[{"ref":"pkg:npm/example-lib@3.1.0"}]}

Check yourself

Recognition and the fix. Nothing here is a procedure.

1 / 3

A library is not in package.json but appears in the SBOM. Why?

Sibling techniques

Pages at the same depth, plus a lab and a glossary card for this one.

  1. MapSecret scanning in git and in pipelinesSecrets belong in a manager, not in a repository.
  1. 01Secrets printed in CI logs: masking, scanning, and rotatingBuild logs are widely readable and kept for months, so a printed token is a leaked token.

Practice

  1. LabControl benchA failure is described. Choose the control that changes the outcome.

Glossary

  1. CardSecrets printed in CI logsA job echoes a token into a log that many people, and often the internet, can read.