In February we explained what an SBOM is and why governments are asking for them. This follow-up is practical: how development teams actually produce SBOMs that are accurate and useful, and how to use them day to day.
Mistake 1: generating SBOMs from the wrong thing
The most common mistake is generating an SBOM from a manifest such as package.json or requirements.txt without resolving it. A manifest lists what you asked for, often as version ranges; it does not tell you what was actually installed, including transitive dependencies.
Better sources, in order of accuracy:
- The built artefact itself: the container image, JAR or binary you ship.
- The resolved dependency graph from the build tool or lock file.
- The manifest alone, which is rarely good enough.
Generating SBOMs in the build
Most ecosystems have good tooling:
# Container image (OS packages + language dependencies) with Syft
syft registry.example.com/orders-api:2.7.0 -o cyclonedx-json > orders-api-2.7.0.cdx.json
# Node.js project from the lock file
npx @cyclonedx/cyclonedx-npm --output-file sbom.cdx.json
# Maven (aggregate across modules)
mvn org.cyclonedx:cyclonedx-maven-plugin:makeAggregateBom
# Python environment as actually installed
cyclonedx-py -e -o sbom.cdx.jsonRun generation as a pipeline step immediately after the build, against the output that will be released.
Containers: remember the base image
An application image contains two worlds of software: your application's dependencies and the operating system packages in the base image (OpenSSL, glibc, zlib and so on). An SBOM that covers only package-lock.json misses the second world entirely, and that is where many critical vulnerabilities live. Image-level tools such as Syft catalogue both.
Attach SBOMs to what you ship
An SBOM is only useful if you can find the right one later. Common approaches:
- Publish with the release: attach the SBOM file to each release in your artefact repository or release page.
- Attach to container images in the registry, so the SBOM travels with the image:
# Attach an SBOM to an image in the registry with Sigstore's cosign
cosign attach sbom --sbom orders-api-2.7.0.cdx.json registry.example.com/orders-api:2.7.0
# Or create a signed attestation, so consumers can verify who produced it
cosign attest --predicate orders-api-2.7.0.cdx.json --type cyclonedx \
--key cosign.key registry.example.com/orders-api@sha256:1f0c...Query SBOMs to answer real questions
The point of an SBOM is answering questions fast. With JSON SBOMs stored centrally, simple tools go a long way:
# Which services ship a given library, and which version?
for f in sboms/*.cdx.json; do
jq -r --arg svc "$(basename "$f" .cdx.json)" \
'.components[] | select(.name=="jackson-databind") | "\($svc)\t\(.version)"' "$f"
done
# Scan all stored SBOMs for known vulnerabilities
for f in sboms/*.cdx.json; do grype "sbom:$f" --only-fixed --fail-on critical || echo "ACTION: $f"; doneFor larger estates, platforms such as OWASP Dependency-Track ingest SBOMs, track components across projects and alert when new vulnerabilities affect them.
flowchart LR CI[CI builds] -->|SBOM per release| DT[(SBOM store /<br/>Dependency-Track)] REG[Image registry] -->|attached SBOMs| DT CVE[New CVE published] --> DT DT -->|affected projects & versions| T[Tickets to owners] DT -->|"are we affected?"| Q[Answer in minutes]
Keep SBOMs accurate
- Commit lock files and build reproducibly, so the SBOM reflects what will run.
- Regenerate for every release, including patch releases and base image rebuilds.
- Include versions and package URLs (purls) so matching against vulnerability databases is precise.
- Watch for vendored or copied code, such as libraries pasted into a repository. SBOM tools may not detect them; declare them explicitly.
- Validate the output occasionally by comparing an SBOM against what is actually in a running container.
Use SBOMs in development, not just for compliance
- Pull request checks: diff the SBOM between the base branch and the PR to highlight new or changed dependencies for review.
- Licence checks: flag licences your organisation does not allow.
- Upgrade planning: see which services still use an old framework version.
The bottom line
An SBOM is only as good as the process that produces it. Generate it from the real artefact, include the base image, attach it to what you ship, and store it where you can query it. Then the next time a critical vulnerability lands in a popular library, "are we affected?" is a query that returns in seconds, not a hunt that takes weeks.
Our secure code review and application security testing teams help development organisations build SBOM generation and dependency management into their pipelines.