Lk
Lab notes

Case study

The SBOM That Took Three Weeks to Generate

A client needed a Software Bill of Materials for EU Cyber Resilience Act compliance. Generating one for a mature codebase revealed dependency chaos we didn't know existed.

A client called me in October. "We need an SBOM," the engineering director said. "Our legal team says the EU Cyber Resilience Act requires it. Can you generate one? Should be straightforward."

It was not straightforward.

For anyone who hasn't been following the regulatory side: the EU Cyber Resilience Act now requires that software products sold in the EU ship with a Software Bill of Materials — a machine-readable inventory of every component in your software. Think of it as a nutrition label, but for dependencies. The vulnerability reporting obligations kicked in earlier, but the SBOM requirements are what finally got this client's attention.

The client runs a B2B analytics platform. About forty engineers, a dozen services, a mix of TypeScript, Python, and Go. Not a complicated architecture. I estimated three days to generate the SBOMs across their services and hand them a repeatable process.

It took three weeks.

The first tool worked great, then didn't

I started with Syft, which is the standard choice for container-based SBOM generation. Point it at a container image, get a CycloneDX or SPDX document out. Simple.

syft packages registry.internal/analytics-api:latest -o cyclonedx-json > sbom.json

The analytics API service produced a clean SBOM in about forty seconds. 847 packages. I could cross-reference it against known vulnerabilities with Grype, pipe the output into their security dashboard, and call it done.

Then I ran it against the data pipeline service.

Syft found the Python packages installed in the container. It did not find the vendored C libraries that one of their data processing packages compiled from source during the Docker build. It didn't find the statically linked Rust binary that another team had copied into the image. And it completely missed the three JavaScript packages that were curled directly into the container as part of a build step someone wrote two years ago.

# "temporary workaround" from 2024
RUN curl -sL https://cdn.example.com/parser-v2.1.0.min.js -o /app/lib/parser.js

That comment was doing a lot of heavy lifting.

You can't inventory what you can't see

This is the core problem with SBOM generation, and it's one that most teams don't appreciate until they try it on a real codebase. Tools like Syft, Trivy, and cdxgen work well when your dependencies come from package managers. npm has a lockfile. pip has requirements.txt or a poetry lock. Go has go.sum. The tools know how to parse these.

But real production systems accumulate dependencies that don't live in any manifest. Vendored libraries. Git submodules nobody remembers adding. Binaries downloaded during CI. Shared base images that themselves contain unlisted packages. Font files with their own licenses. A WASM module compiled from a fork of a fork.

The data pipeline service had all of these.

I spent two days just cataloging the non-standard dependencies. I grepped Dockerfiles for curl, wget, ADD, and COPY --from. I read CI pipeline definitions looking for download steps. I checked for vendored directories that weren't tracked by any package manager.

Warning

If your Docker build downloads anything that isn't managed by a package manager, most SBOM tools will miss it entirely. Audit your Dockerfiles before you trust the output.

The Go service had a different problem

The Go service's SBOM generation looked complete at first glance. Go modules are well-structured, and Syft picked up everything in go.sum. But when I diffed the SBOM against the actual binary using go version -m, I found eight packages in the binary that weren't in the SBOM.

The culprit was replace directives in go.mod. Several dependencies pointed to internal forks via replace statements, and the SBOM tool recorded the original module path — not the forked version that actually got compiled. So the SBOM said the service used github.com/lib/pq v1.10.9, but the binary actually contained a patched fork at a different commit that fixed a connection pooling issue a year ago.

Technically the SBOM wasn't wrong. Practically, it was useless for vulnerability tracking, because scanning the listed version would miss any vulnerabilities specific to the fork's changes.

Three services, three different realities

By the end of the first week, I had a pattern:

The TypeScript services were the cleanest. npm's lockfile is verbose but comprehensive, and the ecosystem has largely converged on declaring everything. The SBOMs were accurate and complete.

The Python services were the worst. Poetry lockfiles helped, but two services still used raw pip install with unpinned ranges in their Docker builds. One service's SBOM showed 312 packages; running pip freeze inside the container showed 340. The gap was transitive dependencies pulled in at build time that weren't in the lockfile because there wasn't one.

The Go services were deceptively clean. The SBOMs looked right until you checked the binaries. The replace directives, CGO dependencies, and one embedded SQLite build all needed manual annotation.

What actually took three weeks

Generating the SBOMs took a day. Discovering they were incomplete took another day. Fixing the gaps took the rest.

Here's what the work actually involved: rewriting three Dockerfiles to eliminate curl-based dependency installation and use proper package management instead. Creating a manual supplement file for the vendored C libraries that couldn't be automatically detected. Setting up a CI step that generates SBOMs on every build and diffs them against the previous version, so new untracked dependencies get flagged immediately. And writing documentation — because someone needs to understand why a sbom-supplement.cdx.json file exists and what happens when it gets out of date.

The client now has a working SBOM pipeline. Every merge to main generates fresh SBOMs for all twelve services, stores them as build artifacts, and runs vulnerability scans against them. When a new CVE drops, they can answer "are we affected?" in minutes instead of hours.

The uncomfortable takeaway

Most teams I talk to think of SBOMs as a compliance checkbox. Generate the file, hand it to legal, move on. And for simple applications with clean dependency management, that's roughly true.

But if your codebase has been in production for more than a couple of years, your SBOM is probably lying to you. Not because the tools are bad — they're genuinely good at what they do — but because the tools can only see what's visible to package managers, and production systems accumulate invisible dependencies the way old houses accumulate extension cords.

The regulation is pushing teams to do something they should have been doing anyway: actually knowing what's in their software. That's a harder problem than it sounds, and it starts well before you pick an SBOM tool.

If you're staring down CRA compliance, start by auditing your Dockerfiles and CI pipelines. The package manager dependencies will take care of themselves. It's the rest that'll eat your timeline.