Skip to content
Compliance engineering: CRA and AI Act on Kubernetes · Chapter 3 of 20 Day 2: The parts list – SBOM with Syft, comparison with Trivy, finding gaps

Day 2: The parts list – SBOM with Syft, comparison with Trivy, finding gaps

Goal: generate a machine-readable software bill of materials (SBOM) for the Bewerbungslotse and the bought-in Ollama image, read it with jq, cross-check it with a second tool, name its gaps and put it under version control next to the code · Duration: about 100 min · Prerequisite: Day 1 completed

State before this chapter

Since Day 1, ~/lotse is a Git repository with a product profile. Check:

# on werk1
git -C ~/lotse log --oneline --decorate

Expected (your commit number differs):

64fd9fd (HEAD -> main, tag: v1.0.0) Bewerbungslotse 1.0.0 mit Produktsteckbrief

In the profile, the very first item under “Offene Punkte” (open points) is “Stückliste (SBOM) fehlt” (parts list missing). You change that today.

Introduction

When a brake manufacturer reports a design defect, a car factory has to know within hours: Which models contain this brake, in which variant, since which model year? Without a parts list, a search begins that takes days, and at the end you are not sure you have found everything.

Software is no different. If a hole in urllib3 or OpenSSL becomes known tomorrow, you want to be able to say within a minute whether the Bewerbungslotse is affected. At the end of Day 1 you counted the parts by hand. That is not enough: the CRA requires a software bill of materials in a commonly used and machine-readable format – a file that programs can read, search and match against vulnerability lists. That is exactly what you do from Day 3 on.

Today you generate this file from the image, read it with jq, let a second tool do the same work and compare. You will see: no parts list is complete. What matters is that you know what is missing and write it down.

Today you will learn:

  • to install Syft and Trivy with a verified checksum,
  • to generate an SBOM directly from the image in the registry, in CycloneDX and SPDX,
  • to query an SBOM with jq: How many parts, which licence, which package address (purl)?
  • to compare two tools and explain the differences,
  • to recognise gaps in an SBOM – Windows programs in a Linux image, a missing version, a missing model,
  • why an SBOM from the source folder is not enough.

Background

The picture of the day: the parts list in the car factory

Every vehicle has a parts list: every part with part number, variant and supplier. The parts list is not copied from the design drawing but from what was actually installed – because sometimes assembly installs a substitute type, and the drawing knows nothing about it.

  • Parts list = SBOM (software bill of materials).
  • Part number = purl (package URL), for example pkg:pypi/[email protected] – a uniform address that names the type, name and version of a part.
  • Supplier = open-source project or base image.
  • Built vehicle instead of design drawing = image instead of source folder. The source folder only knows your requirements.txt; the image knows everything that is really inside.
  • A supplier’s assembly with its own parts list = supplier image (Ollama).
  • Second inspector = second tool. Two inspectors find more than one – and where they contradict each other, you learn the most.

The terms

Term Meaning In the picture
SBOM / software bill of materials formal record of the components and their supply chain relationships (Article 3, point 39 CRA) parts list
CycloneDX SBOM format of OWASP, as JSON or XML one form of the parts list
SPDX SBOM format of the Linux Foundation, ISO/IEC 5962 another form
component one entry of the SBOM: package, program, operating system, file a part
purl package address pkg:<type>/<name>@<version> part number
CPE older product designation of the NVD, often guessed old catalogue number
cataloger the part of Syft that recognises one kind of package (deb, python, binary …) inspector for one group of parts
layer one part of the image, created from one line in the Containerfile assembly step

Remember: The parts list comes from the built vehicle, not from the drawing. What is in the image counts – including what you never ordered.

What the law requires

Article 3, point 39 CRA defines the software bill of materials as “a formal record containing details and supply chain relationships of components included in the software elements of a product with digital elements”.

The obligation is in Annex I, Part II, point 1. Manufacturers shall

identify and document vulnerabilities and components contained in products with digital elements, including by drawing up a software bill of materials in a commonly used and machine-readable format covering at the very least the top-level dependencies of the products;

Three things about it are important:

  1. “commonly used and machine-readable format” – CycloneDX and SPDX are the two common ones. The Commission may specify by implementing act under Article 13(24) exactly which elements belong in it. Check whether one already exists for your product.
  2. “at the very least the top-level dependencies” – the minimum is the parts you install directly. A tool like Syft delivers everything it finds in the image anyway.
  3. You don’t have to publish it. Recital 77: “Manufacturers should not be obliged to make the SBOM public.” However, under Annex VII, point 2(b), the technical documentation describes the vulnerability handling processes “including the software bill of materials”, and under Annex VII, point 8, the market surveillance authority can request the parts list itself on a reasoned request.

Drill 1: The tools

Where you are: on werk1.

What you have afterwards: Syft 1.57.2 and Trivy 0.77.0 in /usr/local/bin, both from the official releases and with a verified checksum.

Syft generates parts lists; Trivy can generate parts lists and, from Day 3, search for vulnerabilities. You download both from GitHub. Before you install a downloaded program with sudo, you check whether it is what the publisher released.

Step 1 – which architecture?

# on werk1
dpkg --print-architecture

Expected:

amd64

If yours says arm64, replace amd64 with arm64 (Syft) and 64bit with ARM64 (Trivy) in the file names of the next steps.

Step 2 – a folder for downloads.

# on werk1
mkdir -p ~/werkzeuge
# on werk1
cd ~/werkzeuge

Step 3 – download Syft and its checksum list.

# on werk1
curl -sSLO https://github.com/anchore/syft/releases/download/v1.57.2/syft_1.57.2_linux_amd64.tar.gz
Option Meaning
-s silent, no progress bar
-S show errors anyway
-L follow redirects – GitHub redirects downloads to another server
-O save under the file name from the address
# on werk1
curl -sSLO https://github.com/anchore/syft/releases/download/v1.57.2/syft_1.57.2_checksums.txt

Neither command prints anything.

Step 4 – compare the checksum.

# on werk1
sha256sum --check --ignore-missing syft_1.57.2_checksums.txt
  • --check reads the list and compares every file named in it with its checksum.
  • --ignore-missing skips the many files in the list that you did not download (other architectures, other formats).

Expected:

syft_1.57.2_linux_amd64.tar.gz: OK

If it says FAILED, the file is damaged or not the published one – then you don’t install it.

Step 5 – unpack and install.

# on werk1
tar -xzf syft_1.57.2_linux_amd64.tar.gz syft

-x extract, -z decompress with gzip, -f from this file; the final syft extracts only this one file from the archive.

# on werk1
sudo install -m 0755 ~/werkzeuge/syft /usr/local/bin/syft

install copies the file and sets the permissions at the same time with -m 0755: executable for everyone, writable only for root.

# on werk1
syft version

Expected (excerpt):

Application:   syft
Version:       1.57.2
Platform:      linux/amd64

Step 6 – Trivy the same way. The same steps, different names:

# on werk1
curl -sSLO https://github.com/aquasecurity/trivy/releases/download/v0.77.0/trivy_0.77.0_Linux-64bit.tar.gz
# on werk1
curl -sSLO https://github.com/aquasecurity/trivy/releases/download/v0.77.0/trivy_0.77.0_checksums.txt
# on werk1
sha256sum --check --ignore-missing trivy_0.77.0_checksums.txt

Expected:

trivy_0.77.0_Linux-64bit.tar.gz: OK
# on werk1
tar -xzf trivy_0.77.0_Linux-64bit.tar.gz trivy
# on werk1
sudo install -m 0755 ~/werkzeuge/trivy /usr/local/bin/trivy
# on werk1
trivy --version

Expected:

Version: 0.77.0

Remember: An inspection tool you cannot trust inspects nothing. First the checksum, then sudo install.

Save your progress? Sign up for free

Drill 2: The first parts list

Where you are: on werk1.

What you have afterwards: a configuration file for Syft and the first parts list of the Bewerbungslotse as a table in the terminal.

Syft can read an image in three ways: from a local container program (Docker, Podman), from an archive file or directly from the registry. You take the registry – that is where exactly the image lies that the cluster loads and that you ship.

Step 1 – the first attempt.

# on werk1
syft scan registry:werk1:5000/bewerbungslotse:1.0.0
  • scan generates a parts list.
  • registry: at the beginning tells Syft to fetch the image directly from the registry, without Podman.

Expected:

[0001] ERROR could not determine source: errors occurred attempting to resolve 'werk1:5000/bewerbungslotse:1.0.0':
  - oci-registry: failed to get image descriptor from registry: Get "https://werk1:5000/v2/": http: server gave HTTP response to HTTPS client
  - oci-model: failed to fetch descriptor: Get "https://werk1:5000/v2/": http: server gave HTTP response to HTTPS client

What you see: The same message as in the diagnosis task of the Preparation on werk2: Syft asks via HTTPS, your registry only speaks HTTP. You have already taught Podman and k3s this, but not Syft yet.

Step 2 – allow Syft to use the registry. Syft reads settings from ~/.syft.yaml:

# on werk1
nano ~/.syft.yaml
~/.syft.yaml new file
registry:
  insecure-use-http: true

insecure-use-http: true allows Syft to talk to registries over unencrypted HTTP. This applies to all registries – fine in the lab; in a real factory you use a registry with TLS.

Step 3 – the second attempt.

# on werk1
syft scan registry:werk1:5000/bewerbungslotse:1.0.0

Expected (excerpt – beginning and end of the table):

NAME                     VERSION                            TYPE
Simple Launcher          1.1.0.14                           binary  (+5 duplicates)
adduser                  3.152                              deb
apt                      3.0.4                              deb
base-files               13.8+deb13u8                       deb
base-passwd              3.6.7                              deb
bash                     5.2.37-2+b10                       deb
blinker                  1.8.2                              python
…
python                   3.12.16                            binary
…
werkzeug                 3.0.3                              python
zlib1g                   1:1.3.dfsg+really1.3.1-1+deb13u1   deb

What you see: one line per part, alphabetical. Counting the TYPE column gives 87 deb, 15 python and two binary – the same numbers as your hand count on Day 1, plus two surprises:

Entry From Meaning
python 3.12.16 binary cataloger for programs Syft recognises the Python interpreter from the file itself; Debian doesn’t know it because the base image compiled it itself
Simple Launcher (+5 duplicates) cataloger for programs six programs with the same name – Drill 3 clarifies what this is

Remember: Syft reads the image where the cluster fetches it. What it finds there is your product – including the Python interpreter that no package manager knows about.

Save your progress? Sign up for free

Drill 3: The parts list as a file – CycloneDX and SPDX

Where you are: on werk1.

What you have afterwards: two parts lists in the folder ~/lotse/sbom, one in CycloneDX, one in SPDX, and the ability to query them with jq.

A table in the terminal is for humans. To match against vulnerability lists, you need a file in a standard format.

Step 1 – the folder.

# on werk1
mkdir -p ~/lotse/sbom

Step 2 – both formats in one run.

# on werk1
syft scan registry:werk1:5000/bewerbungslotse:1.0.0 --source-name bewerbungslotse --source-version 1.0.0 -o cyclonedx-json=$HOME/lotse/sbom/bewerbungslotse-1.0.0.cdx.json -o spdx-json=$HOME/lotse/sbom/bewerbungslotse-1.0.0.spdx.json
Option Meaning
--source-name bewerbungslotse name of the product in the parts list; otherwise the registry address would be there
--source-version 1.0.0 version of the product in the parts list
-o cyclonedx-json=<file> output as CycloneDX JSON into this file
-o spdx-json=<file> additionally as SPDX JSON; -o may appear several times
$HOME your home folder; ~ would not be expanded after the =

The command prints nothing.

# on werk1
ls -l ~/lotse/sbom

Expected (time differs):

total 3296
-rw-r--r-- 1 ubuntu ubuntu  993197 Dec  3 11:21 bewerbungslotse-1.0.0.cdx.json
-rw-r--r-- 1 ubuntu ubuntu 2379483 Dec  3 11:21 bewerbungslotse-1.0.0.spdx.json

Almost 1 MB and 2.4 MB – much more than 104 lines. jq shows why.

For the next steps, change into the folder:

# on werk1
cd ~/lotse/sbom

Step 3 – the header of the CycloneDX file. jq reads JSON and prints selected parts. An expression in { } builds a new object from fields of the file:

# on werk1
jq '{bomFormat, specVersion, serialNumber, timestamp: .metadata.timestamp, werkzeug: .metadata.tools.components[0].name, produkt: .metadata.component}' bewerbungslotse-1.0.0.cdx.json
Part of the expression Meaning
bomFormat, specVersion, serialNumber top-level fields, taken over under the same name
timestamp: .metadata.timestamp field timestamp from the object metadata, renamed
.metadata.tools.components[0].name name of the first tool that generated the file
.metadata.component the product that the parts list describes

Expected:

{
  "bomFormat": "CycloneDX",
  "specVersion": "1.7",
  "serialNumber": "urn:uuid:525fa87f-a86e-4a26-a4c9-e2bd7b2335e1",
  "timestamp": "2026-12-03T11:21:17Z",
  "werkzeug": "syft",
  "produkt": {
    "bom-ref": "cb464c5bb85c934f",
    "type": "container",
    "name": "bewerbungslotse",
    "version": "1.0.0"
  }
}

What you see: CycloneDX 1.7, a unique serial number for exactly this parts list, time, tool and the product with name and version from --source-name and --source-version.

Step 4 – how many entries?

# on werk1
jq '.components | length' bewerbungslotse-1.0.0.cdx.json

.components is the list of all entries, | length counts them. Here the | belongs to jq, not to the shell.

Expected:

2803

2803 instead of 104? Group by type:

# on werk1
jq '.components | group_by(.type) | map({typ: .[0].type, anzahl: length})' bewerbungslotse-1.0.0.cdx.json
  • group_by(.type) sorts the entries into groups of the same type.
  • map({…}) turns each group into an object with the type of the first entry (.[0].type) and the count.

Expected:

[
  {
    "typ": "application",
    "anzahl": 7
  },
  {
    "typ": "file",
    "anzahl": 2693
  },
  {
    "typ": "library",
    "anzahl": 102
  },
  {
    "typ": "operating-system",
    "anzahl": 1
  }
]

What you see:

Type Count What is behind it
library 102 87 Debian packages and 15 Python packages
application 7 the Python interpreter and the six “Simple Launcher”
operating-system 1 Debian 13.8
file 2693 every file that belongs to a package, with checksum

The files make the parts list large. They are useful when you later want to check whether a particular file has been modified.

Step 5 – one part in detail. select(…) keeps only entries for which the condition is true:

# on werk1
jq '.components[] | select(.name == "flask") | {name, version, purl, licenses}' bewerbungslotse-1.0.0.cdx.json

.components[] goes through the list entry by entry.

Expected:

{
  "name": "flask",
  "version": "3.0.3",
  "purl": "pkg:pypi/[email protected]",
  "licenses": [
    {
      "license": {
        "id": "BSD-3-Clause"
      }
    }
  ]
}

What you see: the part number pkg:pypi/[email protected] – package type PyPI, name flask, version 3.0.3 – and the licence. From Day 3, the scanner matches against vulnerability lists via the purl.

Step 6 – where is the licence missing? Licences are not part of security, but every customer asks about them. Which parts (excluding the files) have none?

# on werk1
jq '[.components[] | select(.type != "file" and .licenses == null) | .name]' bewerbungslotse-1.0.0.cdx.json

The outer square brackets collect the results in a list.

Expected:

[
  "Simple Launcher",
  "Simple Launcher",
  "Simple Launcher",
  "Simple Launcher",
  "Simple Launcher",
  "Simple Launcher",
  "python",
  "debian"
]

Step 7 – what are the “Simple Launcher”? CycloneDX entries from Syft carry the location where they were found in properties. The properties whose name starts with syft:location name layer and path:

# on werk1
jq -r '.components[] | select(.name == "Simple Launcher") | .properties[] | select(.name | startswith("syft:location")) | .value' bewerbungslotse-1.0.0.cdx.json
  • -r prints strings without quotation marks.
  • startswith("syft:location") keeps only the properties about the location.

Expected:

sha256:e1beed03d15a898c7106b87ab2c37ddd392bd1f69b08600b6c886b5b80bc1ae6
/usr/local/lib/python3.12/site-packages/pip/_vendor/distlib/t32.exe
sha256:e1beed03d15a898c7106b87ab2c37ddd392bd1f69b08600b6c886b5b80bc1ae6
/usr/local/lib/python3.12/site-packages/pip/_vendor/distlib/t64-arm.exe
sha256:e1beed03d15a898c7106b87ab2c37ddd392bd1f69b08600b6c886b5b80bc1ae6
/usr/local/lib/python3.12/site-packages/pip/_vendor/distlib/t64.exe
sha256:e1beed03d15a898c7106b87ab2c37ddd392bd1f69b08600b6c886b5b80bc1ae6
/usr/local/lib/python3.12/site-packages/pip/_vendor/distlib/w32.exe
sha256:e1beed03d15a898c7106b87ab2c37ddd392bd1f69b08600b6c886b5b80bc1ae6
/usr/local/lib/python3.12/site-packages/pip/_vendor/distlib/w64-arm.exe
sha256:e1beed03d15a898c7106b87ab2c37ddd392bd1f69b08600b6c886b5b80bc1ae6
/usr/local/lib/python3.12/site-packages/pip/_vendor/distlib/w64.exe

What you see: Your Linux image contains six Windows programs (.exe). They belong to distlib, which pip carries inside it to create launchers on Windows. The first line of each pair is the layer the file is in. In operation, the Lotse needs neither them nor pip itself. Remember this for Day 5: what is not inside cannot have a hole.

Step 8 – the same parts list in SPDX. SPDX is organised differently: packages instead of components, files separately in files:

# on werk1
jq '{spdxVersion, name, pakete: (.packages | length), dateien: (.files | length)}' bewerbungslotse-1.0.0.spdx.json

Expected:

{
  "spdxVersion": "SPDX-2.3",
  "name": "bewerbungslotse",
  "pakete": 110,
  "dateien": 2775
}

The numbers differ from CycloneDX because SPDX lists the image itself and its components as separate packages and assigns files differently. Take a look at flask:

# on werk1
jq '.packages[] | select(.name == "flask") | {name, versionInfo, licenseConcluded, licenseDeclared, supplier, externalRefs}' bewerbungslotse-1.0.0.spdx.json

Expected (excerpt – the list externalRefs has 13 entries; shown here are the first, one from the middle and the last):

{
  "name": "flask",
  "versionInfo": "3.0.3",
  "licenseConcluded": "BSD-3-Clause",
  "licenseDeclared": "NOASSERTION",
  "supplier": "NOASSERTION",
  "externalRefs": [
    {
      "referenceCategory": "SECURITY",
      "referenceType": "cpe23Type",
      "referenceLocator": "cpe:2.3:a:python-flask:python-flask:3.0.3:*:*:*:*:*:*:*"
    },
…
    {
      "referenceCategory": "SECURITY",
      "referenceType": "cpe23Type",
      "referenceLocator": "cpe:2.3:a:flask:flask:3.0.3:*:*:*:*:*:*:*"
    },
    {
      "referenceCategory": "PACKAGE-MANAGER",
      "referenceType": "purl",
      "referenceLocator": "pkg:pypi/[email protected]"
    }
  ]
}

What you see:

Field Value Meaning
supplier NOASSERTION Syft doesn’t know who supplies Flask – a gap
licenseDeclared NOASSERTION no explicitly declared licence found; licenseConcluded is Syft’s conclusion
12× cpe23Type guessed CPEs Syft guesses every spelling under which the NVD might list Flask
1× purl pkg:pypi/[email protected] the unambiguous part number

Guessed CPEs are the most common source of false alarms when scanning – that is what Day 3 is about.

Remember: CycloneDX and SPDX are two forms for the same parts list. What matters are the part numbers (purl) – and the fields that say “I don’t know”.

Save your progress? Sign up for free

Drill 4: The second inspector – Trivy

Where you are: on werk1.

What you have afterwards: a parts list of the same image from Trivy and the comparison with Syft.

Two tools, two opinions. Where they differ, you see what each tool overlooks.

Step 1 – the first attempt.

# on werk1
trivy image --format cyclonedx --output /tmp/trivy-test.cdx.json werk1:5000/bewerbungslotse:1.0.0

Expected (shortened – where … appears, I left out long parts of lines; timestamps at the start removed):

… FATAL Fatal error run error: image scan error: … unable to find the specified image "werk1:5000/bewerbungslotse:1.0.0" in ["docker" "containerd" "podman" "remote"]: 4 errors occurred:
    * docker error: … dial unix /var/run/docker.sock: connect: no such file or directory
    * containerd error: … dial unix /run/containerd/containerd.sock: connect: permission denied
    * podman error: unable to initialize Podman client: no podman socket found: …
    * remote error: Get "https://werk1:5000/v2/": http: server gave HTTP response to HTTPS client

What you see: Trivy tries four sources one after the other. There is no Docker, containerd belongs to root, Podman runs without a service – and the registry doesn’t speak HTTPS.

Step 2 – directly from the registry, over HTTP.

# on werk1
trivy image --image-src remote --insecure --format cyclonedx --output $HOME/trivy-1.0.0.cdx.json werk1:5000/bewerbungslotse:1.0.0
Option Meaning
image examine a container image
--image-src remote ask only the registry, not Docker, containerd or Podman
--insecure allow unencrypted and unverified connections to the registry
--format cyclonedx output as CycloneDX JSON
--output <file> write into this file

Expected (the timestamps differ):

2026-12-03T11:22:05Z    INFO    "--format cyclonedx" disables security scanning. Specify "--scanners vuln" explicitly if you want to include vulnerabilities in the "cyclonedx" report.
2026-12-03T11:22:06Z    INFO    [python] Licenses acquired from one or more METADATA files may be subject to additional terms. Use `--debug` flag to see all affected packages.
2026-12-03T11:22:08Z    INFO    Detected OS family="debian" version="13.8"
2026-12-03T11:22:08Z    INFO    Number of language-specific files   num=1

The first line is important: with --format cyclonedx, Trivy only creates the parts list and does not search for vulnerabilities.

Step 3 – count and group.

# on werk1
jq '.components | length' ~/trivy-1.0.0.cdx.json

Expected:

103
# on werk1
jq '.components | group_by(.type) | map({typ: .[0].type, anzahl: length})' ~/trivy-1.0.0.cdx.json

Expected:

[
  {
    "typ": "library",
    "anzahl": 102
  },
  {
    "typ": "operating-system",
    "anzahl": 1
  }
]

Step 4 – the same Python packages? Not every entry has a purl; .purl // "" then inserts an empty string so that startswith doesn’t fail on null:

# on werk1
jq '[.components[] | select(.purl // "" | startswith("pkg:pypi")) | .name]' ~/trivy-1.0.0.cdx.json

Expected:

[
  "blinker",
  "certifi",
  "charset-normalizer",
  "click",
  "Flask",
  "gunicorn",
  "idna",
  "itsdangerous",
  "Jinja2",
  "MarkupSafe",
  "packaging",
  "pip",
  "requests",
  "urllib3",
  "Werkzeug"
]
# on werk1
jq '.components[] | select(.name == "Flask" or .name == "flask") | {name, version, purl}' ~/trivy-1.0.0.cdx.json

Expected:

{
  "name": "Flask",
  "version": "3.0.3",
  "purl": "pkg:pypi/[email protected]"
}
# on werk1
jq '[.components[] | select(.purl // "" | startswith("pkg:deb"))] | length' ~/trivy-1.0.0.cdx.json

Expected:

87

What you see:

Syft Trivy
Debian packages 87 87
Python packages 15 15
Python interpreter yes (binary) no
Windows programs in pip 6 no
files with checksum 2693 no
spelling flask Flask
purl pkg:pypi/[email protected] pkg:pypi/[email protected]

On the packages, both agree. Syft additionally recognises programs by their content; Trivy relies on package managers. The names differ in spelling – the purl is the same. That is why you always compare parts lists via the purl, never via the name.

Remember: Two inspectors, one part number: where the tools disagree, one of them has a gap. Compare via the purl.

Save your progress? Sign up for free

Drill 5: The supplier assembly, then into Git

Where you are: on werk1.

What you have afterwards: a parts list of the Ollama image, an updated profile and all three parts lists versioned in the repository.

You don’t build Ollama yourself, but you ship it with your chart. As the manufacturer, under Article 13(5) CRA you are also responsible for due diligence with third-party components. So the supplier assembly needs a parts list too.

Step 1 – the parts list of Ollama. The image is 3.4 GB; Syft downloads it from the internet once for this. For me that took a good six minutes.

# on werk1
syft scan registry:docker.io/ollama/ollama:0.40.19 --source-name ollama --source-version 0.40.19 -o cyclonedx-json=$HOME/lotse/sbom/ollama-0.40.19.cdx.json

The command prints nothing when it is finished.

Step 2 – what is inside?

# on werk1
jq '[.components[] | select(.type != "file")] | group_by(.type) | map({typ: .[0].type, anzahl: length})' ollama-0.40.19.cdx.json

Expected:

[
  {
    "typ": "library",
    "anzahl": 180
  },
  {
    "typ": "operating-system",
    "anzahl": 1
  }
]
# on werk1
jq '.components[] | select(.type == "operating-system") | {name, version}' ollama-0.40.19.cdx.json

Expected:

{
  "name": "ubuntu",
  "version": "24.04"
}
# on werk1
jq '[.components[] | select(.purl // "" | startswith("pkg:golang"))] | length' ollama-0.40.19.cdx.json

Expected:

57
# on werk1
jq '[.components[] | select(.purl // "" | startswith("pkg:deb"))] | length' ollama-0.40.19.cdx.json

Expected:

123

What you see: Ollama brings its own operating system – Ubuntu 24.04 with 123 packages – and 57 Go modules. So your product consists of two vehicles with two different chassis: Debian 13 and Ubuntu 24.04.

Step 3 – a gap. What is the main program itself called?

# on werk1
jq '.components[] | select(.name == "github.com/ollama/ollama" or .name == "stdlib") | {name, version, purl}' ollama-0.40.19.cdx.json

Expected:

{
  "name": "github.com/ollama/ollama",
  "version": "UNKNOWN",
  "purl": "pkg:golang/github.com/ollama/ollama"
}
{
  "name": "stdlib",
  "version": "go1.26.10",
  "purl": "pkg:golang/[email protected]"
}

What you see: The Go standard library has a version (1.26.10), the main module does not. Go only writes the version of its own module into the program if the version data from Git was available at build time. A scanner therefore cannot match holes in github.com/ollama/ollama. But you know the version – 0.40.19 – and write it into the profile.

Step 4 – the profile.

# on werk1
nano ~/lotse/PRODUKT.md
~/lotse/PRODUKT.md changes in green
# Produktsteckbrief Bewerbungslotse

## Produkt

- Name: Bewerbungslotse
- Version: 1.0.0 (Image werk1:5000/bewerbungslotse:1.0.0, Chart bewerbungslotse 1.0.0)
- Hersteller: Beispielwerk GmbH (fiktiv)
- Zweckbestimmung: sortiert Bewerbungen mit einem Sprachmodell vor
  (Passung 1 bis 5 mit Begründung)
- Auslieferung: Container-Image und Helm-Chart; wir betreiben es auch selbst

## Einstufung nach CRA

- Produkt mit digitalen Elementen: ja (Software, Art. 3 Nr. 1)
- Rolle: Hersteller (Art. 3 Nr. 13)
- Anhang III (wichtig, Klasse I/II): nein – keine der Kategorien
- Anhang IV (kritisch): nein
- Ergebnis: Standardprodukt, Konformität durch interne Kontrolle
  (Modul A, Art. 32 Abs. 1)

## Unterstützungszeitraum (Art. 13 Abs. 8 und 19)

- Inverkehrbringen geplant: 12/2027
- Ende des Unterstützungszeitraums: 12/2032 (fünf Jahre)
- Begründung: Personalsoftware wird typischerweise mehrere Jahre
  genutzt; das Grundimage python:3.12-slim (Debian 13) und
  Ollama sind Komponenten mit eigenen Lebenszyklen

## Bestandteile (Stand Tag 1)

| Teil | Version | Herkunft |
|---|---|---|
| Programm app.py | 1.0.0 | eigen |
| Python-Pakete | 14 Stück, requirements.txt | PyPI |
| Python | 3.12.16 | Grundimage |
| Debian-Pakete | 87 Stück | Grundimage Debian 13 |
| Ollama | 0.40.19 | docker.io/ollama/ollama |
| Sprachmodell | qwen3:4b-instruct, Apache 2.0 | Ollama-Bibliothek |

## Stückliste (SBOM, Anhang I Teil II Nr. 1)

- sbom/bewerbungslotse-1.0.0.cdx.json (CycloneDX 1.7, Syft 1.57.2)
- sbom/bewerbungslotse-1.0.0.spdx.json (SPDX, Syft 1.57.2)
- sbom/ollama-0.40.19.cdx.json (Zulieferer-Image; Version des
  Hauptmoduls fehlt dort, gilt: 0.40.19)
- Erzeugt aus dem Image in der Registry, nicht aus dem Quellordner
- Nicht enthalten: Sprachmodell qwen3:4b-instruct (siehe Bestandteile)

## Angriffsfläche (Stand Tag 1)

| Schnittstelle | Erreichbar von | Schutz |
|---|---|---|
| NodePort 30080 (alle Routen von app.py) | jedem, der einen Knoten erreicht | keiner, außer Export (Passwort) |
| /api/admin/export | wie oben | Passwort, Voreinstellung lotse |
| Ollama :11434 | jedem Pod im Cluster | keiner |

## Offene Punkte

- Schwachstellen der Bestandteile unbekannt
- Voreingestelltes Admin-Passwort
- Container läuft als root
- keine Zugriffs- und Entscheidungsprotokolle
- Akten in emptyDir, gehen bei Neustart verloren

New is the section “Stückliste” (parts list, green). It names the three files, the gap in Ollama and what no parts list contains: the language model. It is a file that Ollama loads at runtime – Syft doesn’t see it in the image. Under “Offene Punkte”, the line “Stückliste (SBOM) fehlt” disappears.

Step 5 – commit.

# on werk1
cd ~/lotse
# on werk1
git status --short

Expected:

 M PRODUKT.md
?? sbom/

M means modified, ?? new.

# on werk1
git add PRODUKT.md sbom
# on werk1
git commit -m "Stücklisten für 1.0.0 (CycloneDX, SPDX) und Ollama"

Expected:

[main 8992076] Stücklisten für 1.0.0 (CycloneDX, SPDX) und Ollama
 4 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 sbom/bewerbungslotse-1.0.0.cdx.json
 create mode 100644 sbom/bewerbungslotse-1.0.0.spdx.json
 create mode 100644 sbom/ollama-0.40.19.cdx.json

Only 12 inserted lines for 4 MB? Syft writes each JSON file into a single long line.

Remember: The parts list belongs to the version like the type plate to the vehicle – generated from the shipped image, stored next to the code, with everything it doesn’t know in the profile.

The parts list is now in Git, but not attached to the image. Anyone who only fetches the image from the registry doesn’t see it and cannot check whether it is genuine. On Day 6 you attach it to the image, signed with Cosign.

Save your progress? Sign up for free

Diagnosis task

For a customer enquiry, a colleague quickly built a parts list – from the source folder, because that was quicker than from the image. The customer asks back whether the Lotse is affected by an OpenSSL hole; the parts list doesn’t contain OpenSSL at all. This is how you reproduce the colleague’s parts list:

# on werk1
syft scan dir:$HOME/lotse --exclude ./sbom
  • dir: reads a folder instead of an image.
  • --exclude ./sbom leaves out the folder with the parts lists; otherwise Syft would read them too.

Expected:

[0001]  WARN no explicit name and version provided for directory source, deriving artifact ID from the given path (which is not ideal)
NAME                VERSION   TYPE
blinker             1.8.2     python
certifi             2024.2.2  python
charset-normalizer  3.3.2     python
click               8.1.7     python
flask               3.0.3     python
gunicorn            22.0.0    python
idna                3.6       python
itsdangerous        2.2.0     python
jinja2              3.1.4     python
markupsafe          2.1.5     python
packaging           24.0      python
requests            2.31.0    python
urllib3             2.2.1     python
werkzeug            3.0.3     python

What is wrong with this parts list, and what do you answer the customer?

Solution path:

  1. Count: 14 entries – exactly the lines from requirements.txt. In the image there were 104.

  2. All 87 Debian packages (among them openssl and libssl3t64), the Python interpreter and pip are missing. In the folder, Syft only found the requirements.txt – the order form, not the built vehicle.

  3. The correct answer is in the parts list from the image:

    # on werk1
    jq '.components[] | select(.name == "openssl") | {name, version, purl}' ~/lotse/sbom/bewerbungslotse-1.0.0.cdx.json

    Expected:

    {
      "name": "openssl",
      "version": "3.5.9-1~deb13u1",
      "purl": "pkg:deb/debian/[email protected]~deb13u1?arch=amd64&distro=debian-13.8"
    }

    OpenSSL is inside, in the Debian version 3.5.9-1~deb13u1. The purl even names the architecture and the Debian version. Whether the hole affects this version you find out on Day 3.

  4. You send the customer the parts list from the image and a correction.

The lesson: a parts list from the source folder describes the plan. For the CRA, what counts is what you ship.

Challenge

How many of the 102 packages did you put into the image, and how many came with the base image? In the property syft:location:0:layerID of every entry, Syft writes the layer in which it found the package. Use jq to find out how the packages are distributed across the layers, and map the layers to the lines in the Containerfile.

Solution:

# on werk1
jq '[.components[] | select(.type == "library") | .properties[] | select(.name == "syft:location:0:layerID") | .value] | group_by(.) | map({schicht: .[0][7:19], anzahl: length})' ~/lotse/sbom/bewerbungslotse-1.0.0.cdx.json

.[0][7:19] cuts characters 7 to 18 out of the layer ID (sha256:…), i.e. the first twelve characters after sha256:.

Expected:

[
  {
    "schicht": "62060de7dc81",
    "anzahl": 14
  },
  {
    "schicht": "e1beed03d15a",
    "anzahl": 88
  }
]

Podman shows the order of the layers:

# on werk1
podman image inspect werk1:5000/bewerbungslotse:1.0.0 --format "{{range .RootFS.Layers}}{{println .}}{{end}}"

With a Go template, --format prints only the list of layers, one per line.

Expected:

sha256:54ae9782e24f4abba5eebc5cc388f983b590abb011b69f20e0e592240bb7a698
sha256:dc8af65e94dc68431087c659ec8fe872bd0554ddbfd8c82fdab7ce035d778857
sha256:e1beed03d15a898c7106b87ab2c37ddd392bd1f69b08600b6c886b5b80bc1ae6
sha256:7283aa26293991a17d79b1cdb1da7786e3242b5caa67439cec6964ee545ff2b8
sha256:961b214ca3495e4b0ec8cd072abfa13c9683019b03d9ea3e4f9045162057c356
sha256:62060de7dc813b2542254f75ac5da5ab9a76c74d6b94598e2a87d068707523a3
sha256:4bcd1b89af540d82a77bdf530235272a1b7fc80a5b6e2c5ce93dc2d58d4b6456
sha256:1f30a5c15decfdd98e43442cc4d582e06f895ffc5bf0bf2a8b1e8735ee12772a

And podman history shows which line created which layer:

# on werk1
podman history werk1:5000/bewerbungslotse:1.0.0 --format "{{.ID}} {{.Size}} {{.CreatedBy}}"

Expected (truncated on the right):

2152202c694d 0B /bin/sh -c #(nop) CMD ["gunicorn", "--bind...
<missing> 0B /bin/sh -c #(nop) EXPOSE 8080
<missing> 3.07kB /bin/sh -c mkdir /daten
1e3443544ff4 6.14kB /bin/sh -c #(nop) COPY file:e5e3de551f150b...
d869a7527be8 17.4MB /bin/sh -c pip install --no-cache-dir -r r...
66e755f9a8c5 2.56kB /bin/sh -c #(nop) COPY file:a40f9d6be7cae3...
d497f3e5689c 0B /bin/sh -c #(nop) WORKDIR /app
<missing> 0B CMD ["python3"]
<missing> 5.12kB RUN /bin/sh -c set -eux;   for src in idle3...
<missing> 38.2MB RUN /bin/sh -c set -eux;       savedAptMark="$...
<missing> 0B ENV PYTHON_SHA256=b5796915dc45ff745cfb4e99...
<missing> 0B ENV PYTHON_VERSION=3.12.16
<missing> 0B ENV GPG_KEY=7169605F62C751356D054A26A821E6...
<missing> 4.12MB RUN /bin/sh -c set -eux;   apt-get update; ...
<missing> 0B ENV LANG=C.UTF-8
<missing> 0B ENV PATH=/usr/local/bin:/usr/local/sbin:/u...
<missing> 81.3MB # debian.sh --arch 'amd64' out/ 'trixie' '...

podman history reads from top (newest line) to bottom (oldest); only lines with a size above 0 create a layer. Counting from the bottom:

Layer ID (start) Line Packages
1 54ae9782e24f Debian base system (81.3 MB) –
2 dc8af65e94dc apt-get update; … in the base image –
3 e1beed03d15a compile and install Python (38.2 MB) 88
4 7283aa262939 links idle3 etc. –
5 961b214ca349 COPY requirements.txt –
6 62060de7dc81 pip install -r requirements.txt (17.4 MB) 14
7–8 … COPY app.py, mkdir /daten –

You installed 14 packages yourself with pip install. 88 came from the base image: 87 Debian packages and pip. The fact that the Debian packages appear in layer 3 and not in layer 1 is due to how Syft finds them: via the package database /var/lib/dpkg/status, and that was last written in layer 3, when the base image installed and removed packages there. This changes nothing about your responsibility: as the manufacturer, you are responsible for all 102.

Save your progress? Sign up for free

Checkpoint

# on werk1
syft version

Expected (excerpt): Version: 1.57.2

# on werk1
trivy --version

Expected: Version: 0.77.0

# on werk1
git -C ~/lotse ls-files sbom

Expected:

sbom/bewerbungslotse-1.0.0.cdx.json
sbom/bewerbungslotse-1.0.0.spdx.json
sbom/ollama-0.40.19.cdx.json
# on werk1
jq '.metadata.component | {name, version}' ~/lotse/sbom/bewerbungslotse-1.0.0.cdx.json

Expected:

{
  "name": "bewerbungslotse",
  "version": "1.0.0"
}

Test yourself

  1. Why do you generate the parts list from the image in the registry and not from the source folder?
  2. What is a purl, and why do you compare two parts lists via it instead of via the name?
  3. Syft finds 104 parts, Trivy 103. Which parts does only Syft find, and why?
  4. What does Annex I, Part II, point 1 CRA require of a parts list at a minimum – and do you have to publish it?
  5. The parts list of Ollama shows UNKNOWN for the main module. What follows from this, and what do you do?
  6. What is missing from all of today’s parts lists, even though it is part of the product?

Answers:

  1. The source folder only knows the requirements.txt, i.e. what you ordered. The image contains everything that is really shipped – Debian packages, Python, pip. The diagnosis task showed: 14 parts from the folder, 104 from the image.
  2. The purl (pkg:pypi/[email protected]) names package type, name and version in a fixed notation. Tools spell names differently (flask in Syft, Flask in Trivy).
  3. The Python interpreter and the six “Simple Launcher”. Syft also recognises programs by their content; Trivy relies on package managers, and neither is registered there.
  4. A commonly used and machine-readable format covering at the very least the top-level dependencies. You don’t have to publish it (recital 77); the technical documentation refers to it (Annex VII, point 2(b)), and market surveillance can request it on a reasoned request (Annex VII, point 8).
  5. A scanner cannot find holes in Ollama’s main program via the parts list because the version is missing. You enter the version you know (0.40.19) in the profile and keep an eye on advisories about Ollama yourself.
  6. The language model qwen3:4b-instruct. Ollama loads it at runtime into a volume; it is not in the image. It is listed in the profile under “Bestandteile” (components).

Interview note

“How do you create SBOMs?” – A good answer: automatically in the build pipeline, from the finished image (not from the source code), in CycloneDX or SPDX, versioned per release and linked to the image. If you want to go further: comparing two tools shows what one of them overlooks – for example embedded programs or interpreters without a package manager. And an SBOM has gaps: missing suppliers, guessed CPEs, modules without a version, models and data that are only added at runtime. You write those down instead of pretending the list is complete.

Enterprise note

In larger environments, the CI pipeline generates the SBOM on every build and stores it as a signed attestation next to the image in the registry (Cosign, on Day 6). Platforms such as OWASP Dependency-Track or GUAC collect the SBOMs of all products and answer the question “Where is urllib3 2.2.1 used?” across hundreds of products. In Germany, the BSI’s technical guideline TR-03183-2 (the BSI is Germany’s federal cybersecurity agency) describes which fields an SBOM should contain; many customers now require it in tenders. Check there and in a possible implementing act under Article 13(24) CRA whether fields such as the supplier (supplier) are mandatory for you – Syft leaves it empty.

Summary

  • Syft 1.57.2 and Trivy 0.77.0 are installed, both with a verified checksum.
  • The registry only speaks HTTP: Syft learns this via ~/.syft.yaml, Trivy via --image-src remote --insecure.
  • The Lotse’s parts list comes from the image: 87 Debian packages, 15 Python packages, the Python interpreter, six Windows programs from pip and 2693 files – as CycloneDX 1.7 and SPDX 2.3.
  • Trivy finds the same packages, but no programs without a package manager. Compare via the purl.
  • Ollama brings Ubuntu 24.04 with 123 packages and 57 Go modules; the version of the main module is missing.
  • A parts list from the source folder contains only the 14 ordered parts.
  • All parts lists are in ~/lotse/sbom; the profile names them and their gaps.

Commands at a glance

Command Purpose
sha256sum --check --ignore-missing <list> check a downloaded file against a checksum list
sudo install -m 0755 <file> /usr/local/bin/<name> install a program
syft scan registry:<image> parts list directly from the registry as a table
syft scan … --source-name <n> --source-version <v> -o cyclonedx-json=<file> -o spdx-json=<file> parts list in two formats with product name and version
syft scan dir:<folder> parts list of a folder (order form only)
trivy image --image-src remote --insecure --format cyclonedx --output <file> <image> parts list with Trivy
jq '.components \| length' <file> count entries of a CycloneDX file
jq '.components \| group_by(.type) \| map({typ: .[0].type, anzahl: length})' <file> group entries by type
jq '.components[] \| select(.name == "<n>")' <file> filter out one entry
podman image inspect <image> --format "{{range .RootFS.Layers}}{{println .}}{{end}}" layers of an image
podman history <image> which line created which layer

Contents

More