Modules a Go build requires that never reach the binary
Go command whose go.mod requires four modules and whose binary contains two
The application and how it is built
A small Go command. Its go.mod requires four modules. The main package imports two of them, google/uuid and golang.org/x/text. A third, yaml.v3, is imported only by the tests. The fourth, jwt-go, is imported only by a file that is compiled when the build is given the debug tag, which the release build is not. The result is one static binary, shipped alone in an image built from scratch.
What gets hidden, and how
This case runs the other way from the rest: nothing is hidden from the dependency list, and the list says too much. go.mod must require every module any file in the module imports, under any build tag and in any test. The linker then includes only the packages the release build reaches. The Go toolchain also compiles its standard library into the binary, at its own version, and no dependency file mentions that.
| Component | Mechanism | In the artefact? | What happens to it |
|---|---|---|---|
| stdlib@1.27.4 | toolchain | ships | the Go standard library, compiled into every Go binary at the version of the toolchain that built it (GO_VERSION in tools/versions.env; update this line when that changes) |
| gopkg.in/yaml.v3@v3.0.0 | test-only | does not ship | imported only by main_test.go; go.mod has to require it, the binary never contains it |
| github.com/dgrijalva/jwt-go@v3.2.0+incompatible | build-tag | does not ship | imported only by debug.go, which is compiled only with -tags debug; the release build leaves it out |
| golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e | graph-only | does not ship | required by golang.org/x/text's own go.mod; no package of it is imported, so it is in the module graph and nowhere else |
What a true SBOM would say
4 components ship, 1 of them transformed on the way in. 4 are known not to ship (1 build-tag, 2 graph-only, 1 test). Those influence the build or run during it; a tool may list them, as long as it marks them.
The list was written by hand from the build files, the lockfiles and the listing of the built archive, and the project's own proof-check.sh asserts what ends up in the artefact. It is in expected.json, and the full list of what ships is at the foot of this page.
What the tools reported
- stdlib@1.27.4: named by 0 of 6 tools at the source stage, 3 of 4 tools at the artefact stage, 3 of 4 tools at the image stage.
- gopkg.in/yaml.v3@v3.0.0: named by 4 of 6 tools at the source stage, 0 of 4 tools at the artefact stage, 0 of 4 tools at the image stage.
- github.com/dgrijalva/jwt-go@v3.2.0+incompatible: named by 4 of 6 tools at the source stage, 0 of 4 tools at the artefact stage, 0 of 4 tools at the image stage.
- golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e: named by 0 of 6 tools at the source stage, 0 of 4 tools at the artefact stage, 0 of 4 tools at the image stage.
Shipped components found, by stage
Out of 4 that ship. Only the tools that scan all three stages are drawn; the table below has every tool.
Component by component
Ships: Y exact version, v wrong version, p wrong group or namespace, n not named. Does not ship: L listed and marked, X listed unmarked, · not listed. A tool appears under a stage only if it was run there, so an empty column never stands for a miss. Select a cell to see what is behind it.
Select a cell.
| source | artefact | image | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Component | bom | cdxgen | cyclonedx-gomod (whole module graph) | cyclonedx-gomod | sbom-tool | syft | trivy | bom | cyclonedx-gomod | syft | trivy | cdxgen | docker-scout | syft | trivy |
| Ships. In the artefact, including components that were shaded or bundled on the way in. | |||||||||||||||
| example.com/trace/go-unlinked@* | |||||||||||||||
| github.com/google/uuid@v1.6.0 | |||||||||||||||
| golang.org/x/text@v0.3.7 | |||||||||||||||
| stdlib@1.27.4 toolchain | |||||||||||||||
| Present in the build, absent from the artefact. Plugins and their payloads, imported BOMs, and dependencies the build file requires but the artefact never contains. Listing one is right when it is marked as not shipping. | |||||||||||||||
| gopkg.in/yaml.v3@v3.0.0 test-only | |||||||||||||||
| github.com/dgrijalva/jwt-go@v3.2.0+incompatible build-tag | |||||||||||||||
| golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e graph-only | |||||||||||||||
Every document
| Content accuracy | Baseline conformance | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Tool | Format | Comps | In scope | Shipped found | Wrong ver | Wrong purl | Leaked | Labelled | Hashes ok | NTIA 2021 | NTIA/CISA 2026 | BSI v2.1 |
| source | ||||||||||||
| bom 0.8.0 | spdx | 6 | 6 | 3/4 | 1 | 0 | 2 | 0 | 0/0 | 8.5 | 5.6 | 4.6 |
| cdxgen 11.3.2 | cyclonedx | 3 | 3 | 3/4 | 0 | 0 | 0 | 0 | 0/0 | 8.6 | 7.0 | 4.1 |
| cyclonedx-gomod-mod 1.12.0 | cyclonedx | 4 | 4 | 3/4 | 0 | 0 | 1 | 0 | 0/0 | 8.8 | 6.8 | 4.4 |
| cyclonedx-gomod 1.12.0 | cyclonedx | 3 | 3 | 3/4 | 0 | 0 | 0 | 0 | 0/0 | 8.9 | 6.7 | 4.5 |
| sbom-tool 4.1.13 | spdx | 4 | 4 | 2/4 | 0 | 0 | 2 | 0 | 0/0 | 10.0 | 5.1 | 3.7 |
| syft 1.51.0 | cyclonedx | 6 | 6 | 3/4 | 0 | 0 | 3 | 0 | 0/0 | 6.9 | 4.9 | 3.8 |
| trivy 0.74.0 | cyclonedx | 8 | 7 | 3/4 | 0 | 0 | 3 | 0 | 0/0 | 6.9 | 4.0 | 3.5 |
| artefact | ||||||||||||
| bom 0.8.0 | spdx | 4 | 4 | 4/4 | 0 | 0 | 0 | 0 | 0/0 | 8.5 | 5.0 | 4.2 |
| cyclonedx-gomod 1.12.0 | cyclonedx | 3 | 3 | 3/4 | 0 | 0 | 0 | 0 | 0/0 | 8.6 | 6.3 | 4.4 |
| syft 1.51.0 | cyclonedx | 4 | 4 | 4/4 | 0 | 0 | 0 | 0 | 0/0 | 6.6 | 4.7 | 3.8 |
| trivy 0.74.0 | cyclonedx | 6 | 5 | 4/4 | 0 | 0 | 0 | 0 | 0/0 | 6.4 | 3.9 | 3.5 |
| image | ||||||||||||
| cdxgen 11.3.2 | cyclonedx | 2 | 2 | 2/4 | 0 | 0 | 0 | 0 | 0/0 | 8.9 | 6.0 | 4.4 |
| docker-scout 1.24.0 | spdx | 5 | 4 | 4/4 | 0 | 0 | 0 | 0 | 0/0 | 9.8 | 5.8 | 3.7 |
| syft 1.51.0 | cyclonedx | 4 | 4 | 4/4 | 0 | 0 | 0 | 0 | 0/0 | 6.6 | 4.7 | 3.8 |
| trivy 0.74.0 | cyclonedx | 5 | 4 | 4/4 | 0 | 0 | 0 | 0 | 0/0 | 7.2 | 4.1 | 3.5 |
- In scope: package components whose purl type is one of the test case's ecosystems (OS packages in images are ignored).
- Shipped found: recall against what is really in the artefact, at the exact version.
- Wrong ver: named, but at a version that does not ship. Wrong purl: right name and version under the wrong group, so no advisory database will match it.
- Leaked: things that do not ship (test, dev, build tooling,
provided, BOM imports) listed with nothing a consumer could filter on. - Labelled: the same things listed with a scope or property that marks them, which is correct.
+Ncounts further labelled components outside the known list. - Hashes ok: hashes that match the real digest of the jar inside the built artefact, over hashes the tool emitted for those jars.
- NTIA 2021, NTIA/CISA 2026, BSI v2.1:
sbomqs compliancetotals out of 10. They measure whether the fields are present, not whether the inventory is right.
Details
- source / bom leaked unlabelled: github.com/dgrijalva/jwt-go@v3.2.0+incompatible, gopkg.in/yaml.v3@v3.0.0
- source / bom wrong version: stdlib@1.27.4 reported as 1.21
- source / cyclonedx-gomod-mod leaked unlabelled: github.com/dgrijalva/jwt-go@v3.2.0+incompatible
- source / sbom-tool leaked unlabelled: github.com/dgrijalva/jwt-go@v3.2.0+incompatible, gopkg.in/yaml.v3@v3.0.0
- source / syft leaked unlabelled: github.com/dgrijalva/jwt-go@v3.2.0+incompatible, gopkg.in/check.v1@v0.0.0-20161208181325-20d25e280405, gopkg.in/yaml.v3@v3.0.0
- source / trivy leaked unlabelled: github.com/dgrijalva/jwt-go@v3.2.0+incompatible, gopkg.in/check.v1@v0.0.0-20161208181325-20d25e280405, gopkg.in/yaml.v3@v3.0.0
Reading the result
A tool that reads go.mod reports what the module requires, and a tool that reads the binary reports what was linked; both are answering correctly, to different questions. The difference matters most for security. The unlinked modules here are old versions with published advisories, so an SBOM built from go.mod raises alarms about code that is not in the product, while one built from the binary does not. The standard library is the opposite risk: it is in every Go binary, and a source-stage SBOM usually cannot name the version that will be compiled in.
This is our interpretation. The counts above are what the run recorded; why a tool found or missed something is inferred from how the tool works, not established by the data. Limits of the benchmark.
Evidence
- The project.
- Ground truth (
expected.json). - Every SBOM generated for this test case at the source and artefact stages.
- The scores for every document, machine-readable.
Ground truth: what ships
| Component | Note |
|---|---|
pkg:golang/example.com/trace/go-unlinked@* | primary component; a development build has no version of its own, so any version is accepted |
pkg:golang/github.com/google/uuid@v1.6.0 | imported by main.go; linked |
pkg:golang/golang.org/x/text@v0.3.7 | imported by main.go; linked. An old version with known advisories, chosen so that the security view has something real to find |
pkg:golang/stdlib@1.27.4 | the Go standard library, compiled into every Go binary at the version of the toolchain that built it (GO_VERSION in tools/versions.env; update this line when that changes) |