TExcelTAD

What an SBOM Is (and Isn't)

A Software Bill of Materials is a machine-readable inventory of the components in a piece of software: each package, its version, a precise identifier, often its license and hashes, and how the components depend on each other. The name comes from manufacturing, where a bill of materials lists every part in a product.

When the Log4Shell vulnerability (CVE-2021-44228) was published in December 2021, organisations with SBOMs answered "where do we run log4j-core 2.x?" with a query. Everyone else spent days grepping file systems and asking vendors. That week turned SBOMs from a niche idea into a requirement: the US Executive Order 14028 (May 2021) had already asked for them, and the EU Cyber Resilience Act requires manufacturers to draw one up for products with digital elements.

What goes in one

The US NTIA published the "minimum elements" in 2021; every format covers them:

Element Meaning Example
Supplier who makes the component Apache Software Foundation
Component name log4j-core
Version 2.14.1
Unique identifier a purl or CPE pkg:maven/org.apache.logging.log4j/log4j-core@2.14.1
Dependency relationship what includes what legacy-service depends on log4j-core
Author of the SBOM data the tool or team that produced it syft 1.55.0
Timestamp when it was produced 2026-01-01T00:00:00Z

Package URLs (purl)

A purl names a package independently of where it's hosted: pkg:<type>/<namespace>/<name>@<version>?<qualifiers>. It is the key that connects an SBOM to vulnerability databases, so getting it exactly right matters.

Ecosystem purl
npm pkg:npm/lodash@4.17.15, scoped: pkg:npm/%40types/node@24.0.0
PyPI pkg:pypi/jinja2@2.11.2 (name normalised to lowercase)
Maven pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.9.10
Go pkg:golang/golang.org/x/text@v0.3.5
Alpine package pkg:apk/alpine/busybox@1.36.0-r9?arch=x86_64&distro=alpine-3.18.0
OCI image pkg:oci/alpine@sha256%3Ac0669e…?repository_url=index.docker.io/library/alpine

A CPE (cpe:2.3:a:lodash:lodash:4.17.15:*:*:*:*:node.js:*:*) is the older NVD identifier, built from vendor and product names. Tools guess CPEs from package names, and wrong guesses are a classic source of false positives (Why Scanners Disagree).

A model: an SBOM from a manifest

The core of an SBOM generator is small: read what the package manager resolved, turn each entry into a component with a purl, and record the dependency edges. This model builds a minimal CycloneDX 1.6 document from a lockfile-like manifest. Real tools add licenses, file hashes, the tool's own name and much more, but the shape is the same.

python · try it yourself
import json, uuid

manifest = {
    "name": "shop-api", "version": "2.3.0",
    "packages": {                      # what the resolver picked, with direct deps first
        "flask":        {"version": "3.1.0",  "deps": ["werkzeug", "jinja2"], "sha256": "5f87…"},
        "werkzeug":     {"version": "3.1.3",  "deps": ["markupsafe"],          "sha256": "54b7…"},
        "jinja2":       {"version": "3.1.6",  "deps": ["markupsafe"],          "sha256": "0137…"},
        "markupsafe":   {"version": "3.0.2",  "deps": [],                      "sha256": "ee55…"},
    },
    "direct": ["flask"],
}

def purl(name, version):
    return f"pkg:pypi/{name.lower()}@{version}"

def build_cyclonedx(m):
    root = purl(m["name"], m["version"])
    comps = [{"type": "library", "bom-ref": purl(n, p["version"]), "name": n,
              "version": p["version"], "purl": purl(n, p["version"]),
              "hashes": [{"alg": "SHA-256", "content": p["sha256"]}]}
             for n, p in sorted(m["packages"].items())]
    deps = [{"ref": root, "dependsOn": [purl(n, m["packages"][n]["version"]) for n in m["direct"]]}]
    deps += [{"ref": purl(n, p["version"]),
              "dependsOn": [purl(d, m["packages"][d]["version"]) for d in p["deps"]]}
             for n, p in sorted(m["packages"].items())]
    # A stable serial number: derived from the content, so the same input gives the same SBOM.
    serial = uuid.uuid5(uuid.NAMESPACE_URL, root + json.dumps(comps, sort_keys=True))
    return {
        "bomFormat": "CycloneDX", "specVersion": "1.6", "serialNumber": f"urn:uuid:{serial}", "version": 1,
        "metadata": {"timestamp": "2026-01-01T00:00:00Z",
                     "component": {"type": "application", "bom-ref": root, "name": m["name"],
                                   "version": m["version"], "purl": root}},
        "components": comps, "dependencies": deps,
    }

bom = build_cyclonedx(manifest)
print(json.dumps(bom["components"][0], indent=2, ensure_ascii=False))
print(len(bom["components"]), "components,", sum(len(d["dependsOn"]) for d in bom["dependencies"]), "dependency edges")
for d in bom["dependencies"]:
    print(d["ref"].split("/")[1], "->", ", ".join(x.split("/")[1] for x in d["dependsOn"]) or "(none)")
{
  "type": "library",
  "bom-ref": "pkg:pypi/flask@3.1.0",
  "name": "flask",
  "version": "3.1.0",
  "purl": "pkg:pypi/flask@3.1.0",
  "hashes": [
    {
      "alg": "SHA-256",
      "content": "5f87…"
    }
  ]
}
4 components, 5 dependency edges
shop-api@2.3.0 -> flask@3.1.0
flask@3.1.0 -> werkzeug@3.1.3, jinja2@3.1.6
jinja2@3.1.6 -> markupsafe@3.0.2
markupsafe@3.0.2 -> (none)
werkzeug@3.1.3 -> markupsafe@3.0.2

Two design choices to notice:

  • bom-ref is the document-local id that dependencies points to. Using the purl makes it readable; Syft appends a package-id to keep it unique when the same purl appears twice (two copies of a library in different paths).
  • The serial number is a UUID derived from the content here. Syft uses a fresh UUID per run (that's why the course's sessions never print it), which means two SBOMs of the same artifact are never byte-identical. If you want to diff SBOMs, compare components, not files.

What an SBOM isn't

  • Not a vulnerability report. It lists components; a scanner joins it with a vulnerability database. The SBOM stays valid for the life of the release, the vulnerability list changes every day.
  • Not proof of anything by itself. An unsigned SBOM is a claim. Attach it to the artifact as a signed attestation so consumers know it describes that digest and who produced it.
  • Not complete by default. Generators find what package managers recorded. A binary copied into an image with curl, a vendored C library or a statically linked Go dependency may be missing or only partly identified. Know your generator's blind spots.
  • Not useful unless stored. An SBOM generated in CI and thrown away answers nothing when the next Log4Shell lands (Field Notes).

Test yourself

Which identifier does pkg:npm/%40types/node@24.0.0 represent?

  1. A CPE
  2. A purl for the scoped npm package @types/node
  3. An OCI digest
  4. A CVE

In CycloneDX, what does the dependencies section refer to components by?

  1. Their names
  2. Their bom-ref
  3. Their hashes
  4. Their CPE

Why should you not compare two SBOM files byte for byte to see whether a release changed?

  1. SBOMs are compressed
  2. They contain per-run values such as serial numbers and timestamps
  3. SBOMs are binary
  4. SBOM files are always identical