Skip to content
Compliance engineering: CRA and AI Act on Kubernetes · Chapter 7 of 20 Day 6: The recall

Day 6: The recall

Goal: ship version 1.0.1 as a security update – libraries at the minimum versions, Debian fixes applied, the image signed with Cosign, parts list and VEX attached as signed evidence, rolled out in the cluster by digest, with a rehearsed way back · Duration: about 130 min · Prerequisite: Day 5 completed

State before this chapter

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

Expected (your commit number differs):

ee2aa48 (HEAD -> main) 1.0.1-rc1: sichere Standardkonfiguration, Laufzeit-Image ohne pip
# on werk1
curl -s http://10.43.146.193:8080/gesund

Use your ClusterIP from Day 5.

Expected:

{"status":"ok","version":"1.0.1-rc1"}

Introduction

Since Day 3, your workshop log has said: Werkzeug 3.0.3 has a vulnerability that really affects the Lotse (CVE-2024-49767), and six more Python packages are below their minimum version. Today you issue a recall: version 1.0.1 fixes this.

A recall consists of more than a new image. The customer must be sure that the image they download really comes from you and was not swapped on the way. They should find the parts list and VEX for the right version without asking you. And if the update breaks something, they need a rehearsed way back. That is why you sign 1.0.1 with Cosign, attach the parts list and VEX to the image as signed evidence and roll it out by digest – not by tag, because tags move. You will experience yourself today how easily that happens.

Today you will learn:

  • to update dependencies selectively and to resolve a conflict between them,
  • to apply Debian fixes that are not yet in the base image,
  • to generate a key pair with Cosign and to sign an image by digest – without a public transparency log,
  • to attach the parts list and VEX to the image as attestations and to read them back out when verifying,
  • to pin the digest in the chart and to go back and forward again with helm rollback,
  • why a tag does not prove which image is meant.

Background

The picture of the day: the recall

A brake hose is defective. The factory issues a recall: the workshop fits the new hose, and the factory seals the part so that nobody swaps in a cheap copy on the way. The recall comes with a recall letter, the updated parts list and the workshop note – all with the factory’s inspection seal, all referring to the vehicle identification number. And if the new part causes problems, the workshop knows how to restore the old state.

  • Recall = security update 1.0.1.
  • Seal with the factory stamp = signature with Cosign; only the factory has the stamp (private key), every workshop knows the seal (public key).
  • Vehicle identification number = digest; the number plate (tag) can be moved to another car.
  • Documents with an inspection seal on the vehicle = attestation: parts list and VEX, signed and bound to the digest.
  • The workshop’s way back = rollback.

The terms

Term Meaning In the picture
security update version that fixes vulnerabilities, ideally without new features recall
Cosign tool from the Sigstore project for signing container images sealing pliers
key pair the private key signs, the public key verifies stamp and seal pattern
signature cryptographic proof: this digest, this key seal
attestation signed statement about an image, such as “this is its parts list” document with inspection seal
transparency log public, append-only register of all signatures (Rekor) public seal register
digest pinning pin the image in the chart by its digest vehicle identification number in the recall letter
rollback go back to an earlier revision of the release old state in the workshop

Remember: A recall is only complete with seal and papers: signature, parts list and VEX – all bound to the digest, not to the tag.

What the law requires

Annex I, Part II CRA obliges the manufacturer, among other things, to

  • point 2 “address and remediate vulnerabilities without delay, including by providing security updates; where technically feasible, new security updates shall be provided separately from functionality updates”,
  • point 7 “provide for mechanisms to securely distribute updates […]”,
  • point 8 ensure that security updates “are disseminated without delay and, […] free of charge, accompanied by advisory messages providing users with the relevant information”.

Article 13(9) additionally requires that each security update “remains available after it has been issued for a minimum of 10 years or for the remainder of the support period” – so you do not delete the image 1.0.1 and its signature from the registry, even when 1.0.2 comes.

The signature is your “mechanism to securely distribute updates”: the customer can verify that the update comes from you. You write the public description of the fixed vulnerability (point 4) on Day 7.

Drill 1: Updating the libraries

Where you are: on werk1.

What you have afterwards: the image werk1:5000/bewerbungslotse:1.0.1 with all Python packages at or above the minimum version.

Step 1 – enter the minimum versions. The table is at the end of SCHWACHSTELLEN.md. You change exactly the seven lines from it, nothing else.

# on werk1
nano ~/lotse/requirements.txt
~/lotse/requirements.txt changes in green
flask==3.1.3
werkzeug==3.1.9
jinja2==3.1.6
markupsafe==2.1.5
itsdangerous==2.2.0
click==8.1.7
blinker==1.8.2
requests==2.33.0
urllib3==2.8.0
idna==3.15
certifi==2026.10.18
charset-normalizer==3.3.2
gunicorn==22.0.0
packaging==24.0

Step 2 – the version in the program.

# on werk1
nano ~/lotse/app.py
~/lotse/app.py changes in green
"""Bewerbungslotse – sortiert Bewerbungen mit einem Sprachmodell vor."""

import hmac
import json
import os
import uuid
from pathlib import Path

import requests
from flask import Flask, abort, jsonify, request, send_file

VERSION = "1.0.1"
OLLAMA = os.environ.get("OLLAMA_URL", "http://ollama:11434")
MODELL = os.environ.get("MODELL", "qwen3:4b-instruct")
ABLAGE = Path(os.environ.get("ABLAGE", "/daten"))
# strip(): eine Passwortdatei endet meist mit einem Zeilenumbruch
ADMIN_PASSWORT = os.environ.get("ADMIN_PASSWORT", "").strip()

ANWEISUNG = (
    "Du hilfst einer Personalabteilung. Bewerte, wie gut die Bewerbung zur Stelle passt. "
    'Antworte nur mit JSON: {"passung": <Zahl von 1 bis 5>, "begruendung": "<ein Satz>"}'
)

app = Flask(__name__)


@app.get("/gesund")
def gesund():
    return {"status": "ok", "version": VERSION}


@app.post("/api/bewerbungen")
def bewerbung_anlegen():
    daten = request.get_json(force=True)
    frage = f"Stelle: {daten['stelle']}\n\nBewerbung:\n{daten['text']}"
    antwort = requests.post(
        f"{OLLAMA}/api/chat",
        json={
            "model": MODELL,
            "stream": False,
            "format": "json",
            "options": {"temperature": 0},
            "messages": [
                {"role": "system", "content": ANWEISUNG},
                {"role": "user", "content": frage},
            ],
        },
        timeout=300,
    )
    antwort.raise_for_status()
    bewertung = json.loads(antwort.json()["message"]["content"])
    akte = {
        "nummer": uuid.uuid4().hex[:8],
        "name": daten["name"],
        "stelle": daten["stelle"],
        "bewertung": bewertung,
    }
    (ABLAGE / f"{akte['nummer']}.json").write_text(json.dumps(akte, ensure_ascii=False))
    return jsonify(akte), 201


@app.get("/api/bewerbungen/<nummer>")
def bewerbung_lesen(nummer):
    akte = ABLAGE / f"{nummer}.json"
    if not nummer.isalnum() or not akte.exists():
        abort(404)
    return json.loads(akte.read_text())


@app.post("/api/bewerbungen/<nummer>/anlagen")
def anlage_hochladen(nummer):
    datei = request.files["datei"]
    ordner = ABLAGE / "anlagen" / nummer
    ordner.mkdir(parents=True, exist_ok=True)
    datei.save(ordner / Path(datei.filename).name)
    return {"gespeichert": f"{nummer}/{Path(datei.filename).name}"}, 201


@app.get("/api/anlagen/<path:name>")
def anlage_herunterladen(name):
    return send_file(ABLAGE / "anlagen" / name)


@app.get("/api/admin/export")
def export():
    if not ADMIN_PASSWORT:
        abort(404)
    zugang = request.authorization
    if zugang is None or not hmac.compare_digest(zugang.password or "", ADMIN_PASSWORT):
        abort(401)
    return [json.loads(p.read_text()) for p in sorted(ABLAGE.glob("*.json"))]

Step 3 – build, with a fresh base image.

# on werk1
cd ~/lotse
# on werk1
podman build --pull=always -t werk1:5000/bewerbungslotse:1.0.1 .

--pull=always downloads the base image python:3.12-slim again from the network instead of using the cached one. For a security update, you want the latest state of the base.

Expected (excerpt – the end):

INFO: pip is looking at multiple versions of flask to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install -r requirements.txt (line 1) and blinker==1.8.2 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested blinker==1.8.2
    flask 3.1.3 depends on blinker>=1.9.0
…
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
Error: building at STEP "RUN pip install --no-cache-dir --target /app/pakete -r requirements.txt": while running runtime: exit status 1

What you see: the build aborts. Flask 3.1.3 needs blinker 1.9.0 or later; your file still says 1.8.2. Good thing you pinned every version: without pinned versions, pip would silently have chosen a different Flask version, and you would only have noticed in the scan – or not at all.

Step 4 – resolve the conflict. One line, the smallest version that fits:

# on werk1
nano ~/lotse/requirements.txt
~/lotse/requirements.txt changes in green
flask==3.1.3
werkzeug==3.1.9
jinja2==3.1.6
markupsafe==2.1.5
itsdangerous==2.2.0
click==8.1.7
blinker==1.9.0
requests==2.33.0
urllib3==2.8.0
idna==3.15
certifi==2026.10.18
charset-normalizer==3.3.2
gunicorn==22.0.0
packaging==24.0
# on werk1
podman build --pull=always -t werk1:5000/bewerbungslotse:1.0.1 .

Expected (excerpt – the last lines; the numbers differ):

[2/2] COMMIT werk1:5000/bewerbungslotse:1.0.1
--> dd7e54dbca70
Successfully tagged werk1:5000/bewerbungslotse:1.0.1

Step 5 – look at what is inside.

# on werk1
podman run --rm werk1:5000/bewerbungslotse:1.0.1 python -c "import importlib.metadata as m; print(*[p + ' ' + m.version(p) for p in ('flask', 'werkzeug', 'jinja2', 'blinker')])"

importlib.metadata.version() reads the version of an installed package from its metadata – the way Flask itself recommends instead of __version__.

Expected:

flask 3.1.3 werkzeug 3.1.9 jinja2 3.1.6 blinker 1.9.0

Remember: A recall changes only what the defect requires – plus whatever a new part necessarily brings with it. Pinned versions make such follow-up changes visible instead of hiding them.

Save your progress? Sign up for free

Drill 2: Scan, fix, rebuild

Where you are: on werk1.

What you have afterwards: 1.0.1 without matches in Python packages and without fixable Debian matches, in the registry, with a known digest.

Step 1 – push and check.

# on werk1
podman push werk1:5000/bewerbungslotse:1.0.1
# on werk1
mkdir -p ~/kurs/06
# on werk1
grype registry:werk1:5000/bewerbungslotse:1.0.1 -o json --file ~/kurs/06/grype-1.0.1-erstbau.json
# on werk1
jq '.matches | group_by(.artifact.type) | map({typ: .[0].artifact.type, anzahl: length})' ~/kurs/06/grype-1.0.1-erstbau.json

Expected:

[
  {
    "typ": "binary",
    "anzahl": 14
  },
  {
    "typ": "deb",
    "anzahl": 220
  }
]

No more Python matches – 32 are gone. But 220 Debian matches as before. Surely the group “Debian with fix” from your workshop log should disappear with a fresh base image:

# on werk1
jq -r '.matches[] | select(.artifact.type == "deb" and .vulnerability.fix.state == "fixed") | [.artifact.name, .artifact.version, .vulnerability.id, (.vulnerability.fix.versions | join(","))] | @tsv' ~/kurs/06/grype-1.0.1-erstbau.json

Expected:

libzstd1    1.5.7+dfsg-1    CVE-2026-124851 1.5.7+dfsg-1+deb13u1
login.defs  1:4.17.4-2  CVE-2026-135901 1:4.17.4-2+deb13u1
passwd  1:4.17.4-2  CVE-2026-135901 1:4.17.4-2+deb13u1

Step 2 – why did --pull not help?

# on werk1
podman image inspect docker.io/library/python:3.12-slim --format '{{.Created}}'

Expected (your date may be newer):

2026-11-24 05:02:20.803590292 +0000 UTC

What you see: the base image is more than a week old. Debian has published the fixes, but the Python project has not yet rebuilt its image. --pull only fetches what exists.

Step 3 – apply the fixes yourself. One line in the Containerfile, in the runtime stage:

# on werk1
nano ~/lotse/Containerfile
~/lotse/Containerfile changes in green
# Stufe 1: Pakete bauen – pip wird nur hier gebraucht
FROM docker.io/library/python:3.12-slim AS bau
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir --target /app/pakete -r requirements.txt

# Stufe 2: Laufzeit – ohne pip, als eigener Benutzer
FROM docker.io/library/python:3.12-slim
# Debian-Sicherheitskorrekturen, die noch nicht im Grundimage stecken
RUN apt-get update && apt-get upgrade --yes && rm -rf /var/lib/apt/lists/*
RUN pip uninstall --yes pip
WORKDIR /app
COPY --from=bau /app/pakete /app/pakete
COPY app.py .
ENV PYTHONPATH=/app/pakete
USER 10001:10001
EXPOSE 8080
CMD ["python", "-m", "gunicorn", "--bind", "0.0.0.0:8080", "--timeout", "300", "--worker-tmp-dir", "/tmp", "app:app"]
Part Meaning
apt-get update downloads the current package lists from Debian
apt-get upgrade --yes applies all available updates without asking
rm -rf /var/lib/apt/lists/* deletes the package lists again; they only make the image bigger

In a Containerfile, && is common: the three commands end up in one layer, and the deleted lists take up no space.

Step 4 – rebuild and push, this time with the digest.

# on werk1
podman build -t werk1:5000/bewerbungslotse:1.0.1 .

Expected (excerpt – the packages Debian has fixed):

Unpacking login.defs (1:4.17.4-2+deb13u1) over (1:4.17.4-2) ...
Setting up login.defs (1:4.17.4-2+deb13u1) ...
…
Unpacking passwd (1:4.17.4-2+deb13u1) over (1:4.17.4-2) ...
Setting up passwd (1:4.17.4-2+deb13u1) ...
…
Unpacking libzstd1:amd64 (1.5.7+dfsg-1+deb13u1) over (1.5.7+dfsg-1) ...
Setting up libzstd1:amd64 (1.5.7+dfsg-1+deb13u1) ...
…
Successfully tagged werk1:5000/bewerbungslotse:1.0.1
# on werk1
podman push --digestfile ~/kurs/06/digest-1.0.1 werk1:5000/bewerbungslotse:1.0.1

--digestfile <file> writes the digest under which the registry stored the image into a file.

# on werk1
cat ~/kurs/06/digest-1.0.1

Expected (your digest differs):

sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e

From now on, this digest is the name of version 1.0.1. Use yours in all following commands.

The tag 1.0.1 now points to the new image. The first image from step 1 is still in the registry – under its own digest, without a tag. Keep this in mind for the diagnosis task.

Step 5 – the result.

# on werk1
cd ~/lotse/scans
# on werk1
grype registry:werk1:5000/bewerbungslotse:1.0.1 -o json --file grype-1.0.1.json
# on werk1
jq '.matches | length' grype-1.0.1.json

Expected:

231
# on werk1
jq '.matches | group_by(.vulnerability.fix.state) | map({stand: .[0].vulnerability.fix.state, anzahl: length})' grype-1.0.1.json

Expected:

[
  {
    "stand": "fixed",
    "anzahl": 14
  },
  {
    "stand": "not-fixed",
    "anzahl": 53
  },
  {
    "stand": "wont-fix",
    "anzahl": 164
  }
]

From 266 down to 231. The 14 “fixed” are the matches in the Python interpreter that Grype guesses via CPE; their fixes are in Python 3.13 and later. They stay at “check individually” in your workshop log.

Remember: The vehicle identification number comes from the registry, not from the number plate: --digestfile tells you which image you really shipped. And a fresh base image is not necessarily an up-to-date one.

Save your progress? Sign up for free

Drill 3: The factory stamp

Where you are: on werk1.

What you have afterwards: Cosign 3.1.6 and a key pair beispielwerk.key/beispielwerk.pub in ~/geheim.

Step 1 – download and verify Cosign.

# on werk1
cd ~/werkzeuge
# on werk1
curl -sSLO https://github.com/sigstore/cosign/releases/download/v3.1.6/cosign-linux-amd64
# on werk1
curl -sSLO https://github.com/sigstore/cosign/releases/download/v3.1.6/cosign_checksums.txt
# on werk1
sha256sum --check --ignore-missing cosign_checksums.txt

Expected:

cosign-linux-amd64: OK
# on werk1
sudo install -m 0755 ~/werkzeuge/cosign-linux-amd64 /usr/local/bin/cosign
# on werk1
cosign version

Expected (excerpt – below a large banner):

cosign: A tool for Container Signing, Verification and Storage in an OCI registry

GitVersion:    v3.1.6

Step 2 – a password for the key. The private key is stored encrypted. You generate the password for it as on Day 5:

# on werk1
openssl rand -hex -out ~/geheim/cosign-passwort 16
# on werk1
chmod 600 ~/geheim/cosign-passwort

Step 3 – the key pair. The private key belongs in ~/geheim, never in the repository:

# on werk1
cd ~/geheim
# on werk1
cosign generate-key-pair --output-key-prefix beispielwerk

--output-key-prefix beispielwerk names the files beispielwerk.key and beispielwerk.pub instead of cosign.key and cosign.pub. Cosign asks for the password twice. Open ~/geheim/cosign-passwort in a second window with nano and paste the content; the input stays invisible.

Expected:

Enter password for private key: 
Enter password for private key again: 
Private key written to beispielwerk.key
Public key written to beispielwerk.pub
# on werk1
ls -l ~/geheim

Expected (times differ):

total 16
-rw------- 1 ubuntu ubuntu  33 Dec  3 12:08 admin-passwort
-rw------- 1 ubuntu ubuntu 653 Dec  3 12:31 beispielwerk.key
-rw-r--r-- 1 ubuntu ubuntu 178 Dec  3 12:31 beispielwerk.pub
-rw------- 1 ubuntu ubuntu  33 Dec  3 12:30 cosign-passwort

Cosign itself creates the private key with permissions 600. The public key is readable by everyone – it is there to be passed on:

# on werk1
cat ~/geheim/beispielwerk.pub

Expected (your key differs):

-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEHyMOoaVeg+ATKI7Y+C3rA/r+KxGw
L7obv+F4qyJPMZoXdMX3orsaVCYkzaQPlK2e6n0usHQ5OklXXWsv4DSH9w==
-----END PUBLIC KEY-----

Remember: The stamp stays in the safe, the seal pattern hangs at the factory gate: beispielwerk.key lives in ~/geheim with a password, beispielwerk.pub goes to every customer.

Save your progress? Sign up for free

Drill 4: Seal and verify

Where you are: on werk1.

What you have afterwards: a signature on the image 1.0.1 in the registry, verified with the public key.

Step 1 – no public services. Without further options, Cosign records every signature in the public transparency log Rekor of the Sigstore project – with digest and public key, forever. For a public open-source project, that is intended. For the lab and for internal material, it is not. Cosign 3 reads the services from a signing configuration; you create an empty one:

# on werk1
cosign signing-config create --out ~/lotse/signing-config.json
# on werk1
cat ~/lotse/signing-config.json

Expected:

{"mediaType":"application/vnd.dev.sigstore.signingconfig.v0.2+json", "rekorTlogConfig":{}, "tsaConfig":{}}

No transparency log (rekorTlogConfig), no timestamp service (tsaConfig). The file goes into the repository – that way it is traceable how the signing was done.

Step 2 – sign, by digest.

# on werk1
cosign sign --key $HOME/geheim/beispielwerk.key --signing-config $HOME/lotse/signing-config.json --allow-http-registry --yes werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e
Option Meaning
--key <file> the private key
--signing-config <file> the empty signing configuration: nothing goes to public services
--allow-http-registry your registry speaks HTTP without TLS (lab only)
--yes no confirmation prompt
…@sha256:… the image by digest – Cosign warns if you use a tag

Cosign asks for the key’s password; paste it again from ~/geheim/cosign-passwort.

Expected:

Enter password for private key: 
Pushing signature to: werk1:5000/bewerbungslotse

Step 3 – include the public key. Customers need it for verification:

# on werk1
cp ~/geheim/beispielwerk.pub ~/lotse/beispielwerk.pub

Step 4 – verify like a customer.

# on werk1
cosign verify --key ~/lotse/beispielwerk.pub --insecure-ignore-tlog --allow-http-registry werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e
  • --key is the public key here.
  • --insecure-ignore-tlog skips the check in the transparency log – there is no entry, after all.

Expected:

WARNING: Skipping tlog verification is an insecure practice that lacks transparency and auditability verification for the signature.

Verification for werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e --
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - Existence of the claims in the transparency log was verified offline
  - The signatures were verified against the specified public key

[{"critical":{"identity":{"docker-reference":"werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e"},"image":{"docker-manifest-digest":"sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e"},"type":"https://sigstore.dev/cosign/sign/v1"},"optional":{}}]

What you see: the decisive line is the last check line: the signature matches the public key. The signed statement names exactly one digest (docker-manifest-digest). Cosign prints the line about the transparency log anyway; the warning above it says what really happened: there was no check in the log. Without a log, there is no public proof of when the signing happened, and nobody notices a stolen key. In the factory, the key must therefore be protected particularly well.

Step 5 – what is attached to the image now.

# on werk1
cosign tree --allow-http-registry werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e

Expected:

📦 Supply Chain Security Related artifacts for an image: werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e
└── 🔗 https://sigstore.dev/cosign/sign/v1 artifacts via OCI referrer: werk1:5000/bewerbungslotse@sha256:012ff5fac9b83d4ff0f12647482f46d5886996ac0356e5c2cffd002158bd7ea7
   └── 🍒 sha256:a90ae83127775582aaea539348207ef6aba3f7e5f3b887e2fa2c1d31abd66c98

The signature is stored as a separate object in the registry and refers to the image (“OCI referrer”). The image itself stays unchanged – and so does its digest.

Remember: What gets sealed is the vehicle identification number, not the number plate: Cosign signs a digest. Verification uses the seal pattern that anyone may have.

Save your progress? Sign up for free

Drill 5: The papers with an inspection seal

Where you are: on werk1.

What you have afterwards: parts list and VEX for 1.0.1 in the repository and as signed attestations on the image.

Step 1 – the parts list for 1.0.1. As on Day 2, this time by digest:

# on werk1
cd ~/lotse
# on werk1
syft scan registry:werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e --source-name bewerbungslotse --source-version 1.0.1 -o cyclonedx-json=$HOME/lotse/sbom/bewerbungslotse-1.0.1.cdx.json -o spdx-json=$HOME/lotse/sbom/bewerbungslotse-1.0.1.spdx.json
# on werk1
jq -r '.components[] | select(.purl? // "" | startswith("pkg:pypi/")) | .name + " " + .version' ~/lotse/sbom/bewerbungslotse-1.0.1.cdx.json

Expected:

blinker 1.9.0
certifi 2026.10.18
charset-normalizer 3.3.2
click 8.1.7
flask 3.1.3
gunicorn 22.0.0
idna 3.15
itsdangerous 2.2.0
jinja2 3.1.6
markupsafe 2.1.5
packaging 24.0
requests 2.33.0
urllib3 2.8.0
werkzeug 3.1.9

14 packages – pip is missing, as intended.

Step 2 – the VEX document for 1.0.1. A new product (new digest), so a new document. Of the eleven statements for 1.0.0, two remain, and the Werkzeug vulnerability gets the status fixed. The other eight concerned Werkzeug and Jinja2 versions that are no longer in the image.

# on werk1
nano ~/lotse/vex/bewerbungslotse-1.0.1.openvex.json
~/lotse/vex/bewerbungslotse-1.0.1.openvex.json new file
{
  "@context": "https://openvex.dev/ns/v0.2.0",
  "@id": "https://beispielwerk.example/vex/bewerbungslotse-1.0.1",
  "author": "Beispielwerk GmbH, Produktsicherheit",
  "timestamp": "2026-12-03T13:00:00Z",
  "version": 1,
  "statements": [
    {
      "vulnerability": {
        "name": "GHSA-q34m-jh98-gwm2",
        "aliases": [
          "CVE-2024-49767"
        ]
      },
      "products": [
        {
          "@id": "pkg:oci/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e?repository_url=werk1:5000/bewerbungslotse",
          "subcomponents": [
            {
              "@id": "pkg:pypi/[email protected]"
            }
          ]
        }
      ],
      "status": "fixed",
      "status_notes": "Behoben durch Update von Werkzeug 3.0.3 auf 3.1.9.",
      "timestamp": "2026-12-03T13:00:00Z"
    },
    {
      "vulnerability": {
        "name": "CVE-2026-124709"
      },
      "products": [
        {
          "@id": "pkg:oci/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e?repository_url=werk1:5000/bewerbungslotse",
          "subcomponents": [
            {
              "@id": "pkg:deb/debian/[email protected]~deb13u1"
            },
            {
              "@id": "pkg:deb/debian/[email protected]~deb13u1"
            },
            {
              "@id": "pkg:deb/debian/[email protected]~deb13u1"
            }
          ]
        }
      ],
      "status": "not_affected",
      "justification": "vulnerable_code_not_in_execute_path",
      "impact_statement": "Die Lücke betrifft nur QUIC-Server. Der Bewerbungslotse spricht nur HTTP über TCP und nutzt OpenSSL nicht für QUIC.",
      "timestamp": "2026-12-03T13:00:00Z"
    },
    {
      "vulnerability": {
        "name": "CVE-2025-12781"
      },
      "products": [
        {
          "@id": "pkg:oci/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e?repository_url=werk1:5000/bewerbungslotse",
          "subcomponents": [
            {
              "@id": "pkg:generic/[email protected]"
            }
          ]
        }
      ],
      "status": "under_investigation",
      "status_notes": "Treffer nur über CPE; Prüfung, ob die Korrektur in Python 3.12.16 enthalten ist, läuft.",
      "timestamp": "2026-12-03T13:00:00Z"
    }
  ]
}
Statement Status Meaning
GHSA-q34m-jh98-gwm2 fixed fixed in 1.0.1; status_notes says how
CVE-2026-124709 not_affected unchanged: QUIC server only, the Lotse does not use QUIC
CVE-2025-12781 under_investigation unchanged, still being investigated
# on werk1
cd ~/lotse/scans
# on werk1
grype registry:werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e --vex ~/lotse/vex/bewerbungslotse-1.0.1.openvex.json -o json --file grype-vex-1.0.1.json
# on werk1
jq '(.matches | length), (.ignoredMatches | length)' grype-vex-1.0.1.json

Expected:

228
3

The three OpenSSL packages are hidden. The fixed statement hides nothing – the vulnerability is no longer in the image at all.

Step 3 – the parts list as an attestation.

# on werk1
cosign attest --key $HOME/geheim/beispielwerk.key --signing-config $HOME/lotse/signing-config.json --allow-http-registry --yes --type cyclonedx --predicate $HOME/lotse/sbom/bewerbungslotse-1.0.1.cdx.json werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e
Option Meaning
attest signs a statement about the image instead of just the image
--type cyclonedx kind of statement: a CycloneDX parts list
--predicate <file> the content of the statement
other options as for signing

Expected (after entering the password):

Using payload from: /home/ubuntu/lotse/sbom/bewerbungslotse-1.0.1.cdx.json
Enter password for private key: 

Step 4 – the VEX as an attestation.

# on werk1
cosign attest --key $HOME/geheim/beispielwerk.key --signing-config $HOME/lotse/signing-config.json --allow-http-registry --yes --type openvex --predicate $HOME/lotse/vex/bewerbungslotse-1.0.1.openvex.json werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e

Expected (after entering the password):

Using payload from: /home/ubuntu/lotse/vex/bewerbungslotse-1.0.1.openvex.json
Enter password for private key: 
# on werk1
cosign tree --allow-http-registry werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e

Expected:

📦 Supply Chain Security Related artifacts for an image: werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e
└── 🔗 https://sigstore.dev/cosign/sign/v1 artifacts via OCI referrer: werk1:5000/bewerbungslotse@sha256:012ff5fac9b83d4ff0f12647482f46d5886996ac0356e5c2cffd002158bd7ea7
   └── 🍒 sha256:a90ae83127775582aaea539348207ef6aba3f7e5f3b887e2fa2c1d31abd66c98
└── 🔗 https://cyclonedx.org/bom artifacts via OCI referrer: werk1:5000/bewerbungslotse@sha256:48195d0b70086fa1d0109ed7ff811cce3722ab3114dcd01b9d39025d83911ff0
   └── 🍒 sha256:3ab2f1f4a4bf07bc49b95b9b6380e649bac06bca4b789673a2574c90f6c1cd91
└── 🔗 https://openvex.dev/ns artifacts via OCI referrer: werk1:5000/bewerbungslotse@sha256:42a733ad86ed9555d21743a4f259360afc79b1f6e82534952e0d9f002a1e22bc
   └── 🍒 sha256:32c64642f538b6a9bc36abee40a88f824e543914df6998757d8f186627c7c74a

Three attachments: signature, parts list, VEX.

Step 5 – verify and read the VEX attestation.

# on werk1
cd ~/kurs/06
# on werk1
cosign verify-attestation --key ~/lotse/beispielwerk.pub --insecure-ignore-tlog --allow-http-registry --type openvex werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e > vex-attestation.json

> redirects the verified attestation into a file; the check messages still appear on the screen, because Cosign writes them to the error channel.

Expected (excerpt):

The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - Existence of the claims in the transparency log was verified offline
  - The signatures were verified against the specified public key

The attestation is an in-toto statement, Base64-encoded in the field payload:

# on werk1
jq -r '.payload | @base64d | fromjson | .predicateType, (.predicate.statements | length)' vex-attestation.json

@base64d decodes Base64, fromjson reads the result as JSON.

Expected:

https://openvex.dev/ns
3
# on werk1
jq '.payload | @base64d | fromjson | .subject' vex-attestation.json

Expected:

[
  {
    "name": "werk1:5000/bewerbungslotse",
    "digest": {
      "sha256": "87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e"
    }
  }
]

What you see: the statement (“these three VEX statements”) and its object (subject, the digest) are signed together. Nobody can attach the VEX to a different image or change it on the way without the verification failing.

Remember: Papers with an inspection seal belong to the vehicle identification number: an attestation binds a parts list or VEX to exactly one digest. Whoever has the image finds the papers in the same registry.

Save your progress? Sign up for free

Drill 6: Rolling out by digest and back

Where you are: on werk1.

What you have afterwards: 1.0.1 in the cluster, pinned by digest in the chart, and a rehearsed way back to 1.0.1-rc1 and forward again.

Step 1 – the digest into the chart.

# on werk1
nano ~/lotse/chart/values.yaml
~/lotse/chart/values.yaml changes in green
lotse:
  # Tag zum Lesen, Digest zum Laden: genau das signierte Image
  image: werk1:5000/bewerbungslotse:1.0.1@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e
  # Pflichtwert, kein Standardpasswort: --set lotse.adminPasswort=…
  adminPasswort: ""
  service:
    # ClusterIP: nur im Cluster erreichbar; NodePort nur bewusst setzen
    typ: ClusterIP
    nodePort: 30080
  speicher: 1Gi

ollama:
  image: docker.io/ollama/ollama:0.40.19
  modell: qwen3:4b-instruct
  knoten: werk1
  speicher: 10Gi

# NetworkPolicies: nur der Lotse darf Ollama erreichen
netzwerkregeln: true

<tag>@sha256:<digest> is a valid image reference: Kubernetes pulls by the digest; the tag is there only for reading.

# on werk1
nano ~/lotse/chart/Chart.yaml
~/lotse/chart/Chart.yaml changes in green
apiVersion: v2
name: bewerbungslotse
description: Sortiert Bewerbungen mit einem Sprachmodell vor
type: application
version: 1.0.1
appVersion: "1.0.1"

Step 2 – roll out.

# on werk1
helm upgrade lotse ~/lotse/chart -n lotse --set-file lotse.adminPasswort=$HOME/geheim/admin-passwort --wait --timeout 5m

Expected (excerpt – your revision is 6; on my system there was one more failed attempt in between):

Release "lotse" has been upgraded. Happy Helming!
…
REVISION: 8
DESCRIPTION: Upgrade complete

Step 3 – which image is really running?

# on werk1
kubectl -n lotse get pod -l app=lotse -o jsonpath='{.items[0].status.containerStatuses[0].imageID}{"\n"}'

imageID is the digest that the node actually pulled.

Expected:

werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e

The same digest that you signed.

# on werk1
curl -s http://10.43.146.193:8080/gesund

Expected:

{"status":"ok","version":"1.0.1"}

Step 4 – the way back. Imagine that 1.0.1 causes problems at the customer’s site. Back to the revision with 1.0.1-rc1 – 5 for you, 6 for me:

# on werk1
helm rollback lotse 6 -n lotse --wait --timeout 5m
  • 6 is the revision Helm returns to; helm history lotse -n lotse shows all of them.
  • --wait --timeout 5m as for the upgrade.

Expected:

Rollback was a success! Happy Helming!
# on werk1
curl -s http://10.43.146.193:8080/gesund

Expected:

{"status":"ok","version":"1.0.1-rc1"}

Step 5 – and forward again. To the revision with 1.0.1 – 6 for you, 8 for me:

# on werk1
helm rollback lotse 8 -n lotse --wait --timeout 5m

Expected:

Rollback was a success! Happy Helming!
# on werk1
helm history lotse -n lotse --max 4

Expected (your revisions are two lower, so yours say Rollback to 5 and Rollback to 6):

REVISION    UPDATED                     STATUS      CHART                       APP VERSION DESCRIPTION     
7           Thu Dec  3 12:33:48 2026    superseded  bewerbungslotse-1.0.1       1.0.1       Upgrade complete
8           Thu Dec  3 12:34:05 2026    superseded  bewerbungslotse-1.0.1       1.0.1       Upgrade complete
9           Thu Dec  3 12:34:25 2026    superseded  bewerbungslotse-1.0.1-rc1   1.0.1-rc1   Rollback to 6   
10          Thu Dec  3 12:34:30 2026    deployed    bewerbungslotse-1.0.1       1.0.1       Rollback to 8   

What you see: a rollback deletes nothing. It creates a new revision that takes over the values of an old one (Rollback to 6). That way it stays traceable what ran when – and a rollback can itself be undone.

Be careful on the way back: back to 1.0.1-rc1 means back to a version with a known, exploitable vulnerability. A rollback across a security update is an emergency measure with a deadline, not a permanent state.

Remember: The workshop fits parts by vehicle identification number: the digest in the chart determines which image runs. The way back is a new revision – rehearsed before you need it.

Save your progress? Sign up for free

Drill 7: Committing version 1.0.1

Where you are: on werk1.

What you have afterwards: product profile and workshop log for 1.0.1, everything in Git, tag v1.0.1.

Step 1 – the product profile.

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

## Produkt

- Name: Bewerbungslotse
- Version: 1.0.1 (Image werk1:5000/bewerbungslotse:1.0.1@sha256:87e72e42…,
  Chart bewerbungslotse 1.0.1); Vorgänger 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)
- 1.0.1: sbom/bewerbungslotse-1.0.1.cdx.json und .spdx.json, zusätzlich
  als signierte Attestation am Image

## Signatur und Nachweise (ab 1.0.1)

- Image per Digest signiert mit Cosign, Schlüssel des Werks
- Öffentlicher Schlüssel: beispielwerk.pub (liegt diesem Repository bei)
- Am Image hängen: Signatur, Stückliste (CycloneDX), VEX (OpenVEX)
- Kein öffentliches Transparenzlog: signing-config.json ohne Dienste;
  prüfen mit cosign verify --key beispielwerk.pub --insecure-ignore-tlog
- Privater Schlüssel und Passwort nur beim Hersteller, nie im Repository

## Angriffsfläche (Stand Tag 5, Version 1.0.1)

| Schnittstelle | Erreichbar von | Schutz |
|---|---|---|
| Service lotse :8080 (ClusterIP) | im Cluster und vom Knoten | NodePort nur, wenn der Betreiber ihn setzt |
| /api/admin/export | wie oben | Passwort Pflicht, kein Standardwert; ohne Passwort abgeschaltet |
| Ollama :11434 | nur Pods mit app=lotse | NetworkPolicy |

## Sichere Standardkonfiguration (Anhang I Teil I Nr. 2 b)

- Kein Standardpasswort: Helm bricht ohne lotse.adminPasswort ab
- Service vom Typ ClusterIP statt NodePort
- NetworkPolicies: alles zu, nur Lotse → Ollama und Port 8080 zum Lotsen
- Lotse: Benutzer 10001, kein root, keine Rechteausweitung, alle
  Capabilities entfernt, Dateisystem nur lesbar, Seccomp RuntimeDefault,
  kein Service-Account-Token, CPU/Speicher begrenzt
- Laufzeit-Image ohne pip (mehrstufiger Bau)
- Akten auf einem PersistentVolume statt emptyDir
- Prüfung: trivy config mit --helm-set, Befunde siehe SCHWACHSTELLEN.md
- Zurücksetzen auf die Werkseinstellungen: helm upgrade mit
  --reset-values (nur das Passwort neu angeben)

## Offene Punkte

- Ollama läuft als root (Zulieferer-Image); als Benutzer 10001
  getestet, braucht HOME auf eigenem Volume und neu geladenes Modell
- keine Zugriffs- und Entscheidungsprotokolle
- keine Verschlüsselung zwischen Lotse und Ollama (nur im Cluster)

Step 2 – the workshop log.

# on werk1
nano ~/lotse/SCHWACHSTELLEN.md
~/lotse/SCHWACHSTELLEN.md changes in green
# Schwachstellen Bewerbungslotse

Stand: 2026-12-03 · Scanner: Grype 0.122.1 (Datenbank vom 2026-12-03),
Gegenprobe Trivy 0.77.0 · Grundlage: die Images 1.0.0 und 1.0.1 aus der Registry

## Überblick

- 1.0.1: 231 Treffer (Grype): 217 Debian, 0 Python-Pakete,
  14 Python-Interpreter; mit VEX 228
- 1.0.0: 266 Treffer (Grype): 220 Debian, 32 Python, 14 Python-Interpreter
- Im KEV-Katalog der CISA (Stand 2026.11.30): keiner
- Höchstes EPSS: CVE-2026-21441 (urllib3), 2,9 %

## Entscheidungen

| Gruppe | Treffer | Entscheidung | Wann |
|---|---|---|---|
| Python-Pakete außer pip | 26 | aktualisiert in 1.0.1 (blinker 1.9.0 für Flask 3.1.3 nötig) | erledigt |
| davon Werkzeug safe_join (nur Windows) | 5 | für 1.0.0: nicht betroffen, VEX | erledigt |
| davon Jinja2-Sandbox (nicht genutzt) | 3 | für 1.0.0: nicht betroffen, VEX | erledigt |
| pip (nur beim Bau gebraucht) | 6 | aus dem Laufzeit-Image entfernt (1.0.1-rc1: 260 Treffer) | erledigt |
| Python-Interpreter (über CPE geraten) | 14 | einzeln prüfen; CVE-2025-12781 in VEX als under_investigation | offen |
| Debian mit Korrektur | 3 | apt-get upgrade im Bau, Grundimage war noch nicht neu | erledigt |
| Debian ohne Korrektur | 217 | Debian-Bewertung übernehmen, Grundimage aktuell halten | laufend |
| davon OpenSSL QUIC CVE-2026-124709 (3 Pakete) | 3 | nicht betroffen, VEX | erledigt |

## VEX

- vex/bewerbungslotse-1.0.0.openvex.json (OpenVEX 0.2.0, 11 Aussagen)
- vex/bewerbungslotse-1.0.1.openvex.json (3 Aussagen: fixed, not_affected,
  under_investigation), auch als signierte Attestation am Image
- Produkt jeweils per Digest (1.0.0: b2ff3085…, 1.0.1: 87e72e42…)
- Scan mit VEX nur gegen das Image, nicht gegen die Stückliste

## Betraf uns sicher (behoben in 1.0.1)

- CVE-2024-49767 (Werkzeug 3.0.3, Speicher erschöpfen beim Lesen von
  Formulardaten): app.py nimmt Anlagen über request.files an –
  erreichbar über POST /api/bewerbungen/<nummer>/anlagen

## Mindestversionen (Python)

| Paket | 1.0.0 | mindestens | 1.0.1 |
|---|---|---|---|
| certifi | 2024.2.2 | 2026.10.18 | 2026.10.18 |
| flask | 3.0.3 | 3.1.3 | 3.1.3 |
| idna | 3.6 | 3.15 | 3.15 |
| jinja2 | 3.1.4 | 3.1.6 | 3.1.6 |
| requests | 2.31.0 | 2.33.0 | 2.33.0 |
| urllib3 | 2.2.1 | 2.8.0 | 2.8.0 |
| werkzeug | 3.0.3 | 3.1.9 | 3.1.9 |

## Fehlkonfigurationen (trivy config, Stand 1.0.1)

- 1.0.0: 38 Befunde, 1.0.1: 9 Befunde
- Ollama läuft als root (KSV-0012, -0020, -0021): Zulieferer-Image,
  akzeptiert für 1.0.1, Umstellung auf Benutzer 10001 geplant
- Ollama ohne CPU-Grenze (KSV-0011): bewusst, das Modell soll alle
  freien Kerne nutzen; Speicher ist begrenzt
- Namespace default (KSV-0110): Fehlalarm, das Chart wird mit -n lotse
  installiert
- Vertrauenswürdige Registries (KSV-0125): regelt der Betreiber per
  Zulassungsregel, nicht das Chart
- Kein HEALTHCHECK im Containerfile (DS-0026): Kubernetes nutzt die
  readinessProbe im Chart

Step 3 – commit.

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

Expected:

 M Containerfile
 M PRODUKT.md
 M SCHWACHSTELLEN.md
 M app.py
 M chart/Chart.yaml
 M chart/values.yaml
 M requirements.txt
?? beispielwerk.pub
?? sbom/bewerbungslotse-1.0.1.cdx.json
?? sbom/bewerbungslotse-1.0.1.spdx.json
?? scans/grype-1.0.1.json
?? scans/grype-vex-1.0.1.json
?? signing-config.json
?? vex/bewerbungslotse-1.0.1.openvex.json

No key and no password in the list – they live in ~/geheim.

# on werk1
git add Containerfile app.py requirements.txt chart PRODUKT.md SCHWACHSTELLEN.md beispielwerk.pub signing-config.json sbom/bewerbungslotse-1.0.1.cdx.json sbom/bewerbungslotse-1.0.1.spdx.json vex/bewerbungslotse-1.0.1.openvex.json scans/grype-1.0.1.json scans/grype-vex-1.0.1.json
# on werk1
git commit -m "1.0.1: Sicherheitsupdate, signiert, Stückliste und VEX als Attestation"

Expected:

[main 8d31f5d] 1.0.1: Sicherheitsupdate, signiert, Stückliste und VEX als Attestation
 14 files changed, 133 insertions(+), 32 deletions(-)
 create mode 100644 beispielwerk.pub
 create mode 100644 sbom/bewerbungslotse-1.0.1.cdx.json
 create mode 100644 sbom/bewerbungslotse-1.0.1.spdx.json
 create mode 100644 scans/grype-1.0.1.json
 create mode 100644 scans/grype-vex-1.0.1.json
 create mode 100644 signing-config.json
 create mode 100644 vex/bewerbungslotse-1.0.1.openvex.json

Step 4 – the version tag, with the digest in the message.

# on werk1
git tag -a v1.0.1 -m "Bewerbungslotse 1.0.1, Image sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e"

-a creates a tag with message, author and date. The message contains the digest – that way the code state leads to the shipped image.

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

Expected:

8d31f5d (HEAD -> main, tag: v1.0.1) 1.0.1: Sicherheitsupdate, signiert, Stückliste und VEX als Attestation
ee2aa48 1.0.1-rc1: sichere Standardkonfiguration, Laufzeit-Image ohne pip
bdb2a6a VEX für 1.0.0: 9 nicht betroffen, 1 betroffen, 1 in Prüfung

Remember: Code state, image and papers point to each other: the Git tag names the digest, the chart pulls it, signature and attestations are attached to it.

Save your progress? Sign up for free

Diagnosis task

At the first notice about 1.0.1, a customer quickly noted down the digest that their registry interface showed for 1.0.1 at the time. Now they verify the signature and get an error:

# on werk1
cosign verify --key ~/lotse/beispielwerk.pub --insecure-ignore-tlog --allow-http-registry werk1:5000/bewerbungslotse@sha256:bfd9fcbd39e065daa17259b265195e2c5bc33dfcd34ded72c759973ff930a49e

Use the digest of your first build (step 1 below shows where it is).

Expected:

WARNING: Skipping tlog verification is an insecure practice that lacks transparency and auditability verification for the signature.
Error: no signatures found
error during command execution: no signatures found

Did someone swap the image?

Solution path:

  1. Which digest belonged to which build? Your first scan from Drill 2 knows it:

    # on werk1
    jq -r '.source.target.manifestDigest' ~/kurs/06/grype-1.0.1-erstbau.json

    Expected (your digest differs):

    sha256:bfd9fcbd39e065daa17259b265195e2c5bc33dfcd34ded72c759973ff930a49e
    # on werk1
    cat ~/kurs/06/digest-1.0.1

    Expected:

    sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e
  2. And the tag?

    # on werk1
    curl -s http://werk1:5000/v2/bewerbungslotse/tags/list

    Expected:

    {"name":"bewerbungslotse","tags":["1.0.0","1.0.1","1.0.1-rc1"]}

    There is one tag 1.0.1, but two images that have carried it.

  3. The cause: you pushed 1.0.1 twice – first without, then with the Debian fixes. The tag moved along, and the customer noted the digest of the first build. You only signed the second. Nothing was swapped, but the customer would have run an image without the Debian fixes and without a seal.

  4. The fix: give the customer the signed digest – in the recall letter (Day 7), in the Git tag and in the chart. And in future, never push a version tag before the image has been fully checked: for testing, there are -rc tags.

The lesson: no signatures found does not mean “forged”, but “not this image”. A tag is a number plate that anyone can move to another car – including you.

Challenge

A customer has Cosign but no access to your Git. She wants to know which Python packages are in 1.0.1 – and be sure that the list comes from you. Get the parts list out of the attestation, verify it and print all Python packages with their purl. What happens if she tries the same for 1.0.0?

Solution:

# on werk1
cd ~/kurs/06
# on werk1
cosign verify-attestation --key ~/lotse/beispielwerk.pub --insecure-ignore-tlog --allow-http-registry --type cyclonedx werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e > sbom-attestation.json
# on werk1
jq -r '.payload | @base64d | fromjson | .predicate.metadata.component.name + " " + .predicate.metadata.component.version' sbom-attestation.json

Expected:

bewerbungslotse 1.0.1
# on werk1
jq -r '.payload | @base64d | fromjson | .predicate.components[] | select(.purl // "" | startswith("pkg:pypi/")) | .purl' sbom-attestation.json

Expected:

pkg:pypi/[email protected]
pkg:pypi/[email protected]
pkg:pypi/[email protected]
pkg:pypi/[email protected]
pkg:pypi/[email protected]
pkg:pypi/[email protected]
pkg:pypi/[email protected]
pkg:pypi/[email protected]
pkg:pypi/[email protected]
pkg:pypi/[email protected]
pkg:pypi/[email protected]
pkg:pypi/[email protected]
pkg:pypi/[email protected]
pkg:pypi/[email protected]

And for 1.0.0:

# on werk1
cosign verify-attestation --key ~/lotse/beispielwerk.pub --insecure-ignore-tlog --allow-http-registry --type cyclonedx werk1:5000/bewerbungslotse:1.0.0

Expected (excerpt):

Error: no matching attestations: 
error during command execution: no matching attestations:

1.0.0 was never signed and has no attestation. For old versions, the parts list in the repository remains the only source – a reason to sign every version at build time from now on, not only at the recall.

Save your progress? Sign up for free

Checkpoint

# on werk1
cosign verify --key ~/lotse/beispielwerk.pub --insecure-ignore-tlog --allow-http-registry -o text werk1:5000/bewerbungslotse@sha256:87e72e42d0ecc84eef601e079b05c0be8b0d979a6f86a30f76d1e2fbb92a657e

Expected (excerpt): the line - The signatures were verified against the specified public key.

# on werk1
curl -s http://10.43.146.193:8080/gesund

Expected:

{"status":"ok","version":"1.0.1"}
# on werk1
helm list -n lotse

Expected (excerpt – the columns STATUS, CHART and APP VERSION):

deployed    bewerbungslotse-1.0.1   1.0.1
# on werk1
jq '.matches | length' ~/lotse/scans/grype-1.0.1.json

Expected:

231
# on werk1
git -C ~/lotse describe --tags

Expected:

v1.0.1

Test yourself

  1. Why did podman build --pull=always not remove the three Debian matches that have a fix?
  2. Why do you sign by digest and not by tag?
  3. What does the empty signing-config.json do, and what do you lose because of it?
  4. A customer gets no signatures found. Name two possible causes that are not a forgery.
  5. What distinguishes an attestation from a parts list that sits next to the image in the repository?
  6. After helm rollback lotse 6 – is revision 8 lost?

Answers:

  1. The base image python:3.12-slim had not been rebuilt yet; --pull only fetches what has been published. Only apt-get upgrade in the Containerfile applies Debian’s fixes.
  2. A tag can be moved to a different image, even by accident. The signature applies to exactly one digest; only that way does it prove which image is meant.
  3. Cosign writes nothing to the public transparency log and uses no timestamp service. As a result, there is no public proof of when the signing happened, and no way to detect misuse of a key in the log. Verification has to use --insecure-ignore-tlog.
  4. The customer verifies a different digest – such as an earlier build under the same tag – or uses a different public key. A registry that did not copy the referrers along is also a possibility.
  5. The attestation is signed and bound to the digest (subject); it lives in the same registry as the image. A file in the repository can be changed by anyone and cannot be assigned unambiguously to any image.
  6. No. A rollback creates a new revision; revision 8 stays in the history, and helm rollback lotse 8 returns to it.

Interview note

“How do you make sure customers run your image and not a different one?” – Good answer: we sign every release by digest with Cosign; parts list and VEX are attached to the image as signed attestations. The chart contains the digest, not just the tag. Customers verify with our public key, ideally automatically at admission in the cluster. If you want to go further: keys live in a KMS or HSM, not as a file; public projects use keyless signing with an OIDC identity and a transparency log; and a rollback across a security update has a deadline.

Enterprise note

In a company, the signing key does not live on a VM but in a KMS or HSM (Cosign speaks Vault, AWS KMS, Azure Key Vault, GCP KMS and PKCS#11), and signing happens only in the pipeline after all checks. On the customer side, admission controllers such as Kyverno (verifyImages), the Sigstore Policy Controller or Ratify enforce that only signed images with a matching attestation start. For provenance of the build itself, there is SLSA provenance as a further attestation. And a recall needs a release process that ships security updates separately from features, as point 2 requires.

Summary

  • 1.0.1 raises seven Python packages to the minimum version; Flask 3.1.3 additionally forces blinker 1.9.0.
  • apt-get upgrade in the Containerfile applies Debian fixes that are not yet in the base image.
  • Result: 231 instead of 266 matches, none left in Python packages, none left fixable in Debian.
  • Cosign signs 1.0.1 by digest with the factory’s key; an empty signing configuration keeps public services out.
  • Parts list and VEX are attached to the image as signed attestations and can be verified and read.
  • The chart pulls 1.0.1 by digest; rollback to rc1 and back is rehearsed.
  • A tag that moved along leads to no signatures found – customers need the signed digest.

Commands at a glance

Command Purpose
podman build --pull=always -t <image> . build with a freshly pulled base image
podman push --digestfile <file> <image> push and record the digest
cosign generate-key-pair --output-key-prefix <name> generate a key pair
cosign signing-config create --out <file> signing configuration without public services
cosign sign --key <key> --signing-config <file> <image>@sha256:… sign an image by digest
cosign verify --key <pub> --insecure-ignore-tlog <image>@sha256:… verify a signature
cosign attest --key <key> --type cyclonedx\|openvex --predicate <file> <image>@sha256:… attach a parts list or VEX
cosign verify-attestation --key <pub> --type <type> <image> > <file> verify and save an attestation
cosign tree <image>@sha256:… show the attachments of an image
helm rollback <release> <revision> -n <ns> go back to an earlier revision

Contents

More