Skip to content

Verifying the Image

Sam Bent edited this page Sep 26, 2026 · 23 revisions

Verifying the Image

You're about to run software that protects where you are. You shouldn't have to trust that the image on the registry is really the one built from the public source. This page shows how to check.

There are two independent things you can verify: that the image was signed by the maintainer, and that it was built from the public source and nothing else.

Where to get it

The image is published to two registries:

docker pull sambent.dev/sam/hiddenforge:2.0.4   # the maintainer's own registry
docker pull doingfedtime/hiddenforge:2.0.4      # Docker Hub

Both serve the identical digest, and the signatures below verify either one. If they ever disagree, that is exactly the kind of thing this page exists to catch: stop and ask.

The digest, not the tag, is what the signatures are over. Check which digest you actually received:

skopeo inspect --raw docker://sambent.dev/sam/hiddenforge:2.0.4 | sha256sum
# or
docker buildx imagetools inspect sambent.dev/sam/hiddenforge:2.0.4 | head -3

It must equal the contents of signatures/hiddenforge.digest in the code repository.

1. Check the signatures

The release is signed two separate ways, with no dependency on any outside transparency log or third-party service. The verification material lives in the signatures/ folder of the code repository.

The one-command check

The hiddenforge CLI (scripts/hiddenforge in the repository, Python 3.10 or later) does the digest check and both signature checks together. Run it from the root of a clone of the repository, where it reads signatures/, or point it there with --sigdir:

git clone https://sambent.dev/sam/HiddenForge.git && cd HiddenForge
scripts/hiddenforge verify-image sambent.dev/sam/hiddenforge:<version> --json

It verifies against release keys pinned inside the CLI, never against keys it finds in the signatures/ folder, and it fails (exit 1) if the post-quantum half cannot be checked, unless you explicitly pass --allow-classical-only.

Check the keys first

A signature file verifies against whatever public key sits beside it. Someone able to replace the signatures could replace the keys next to them too, so the keys are the trust anchor. Before trusting the manual commands below, confirm the key files match these values (the same ones pinned in the CLI and printed in the README):

ssh-keygen -lf allowed-signers   # SHA256:wL6piZbyXpTOzT7Z66f/Q+vegj0Ml0ZwVouGJ06+3Q0
                                 # SHA256:YcUo1tBtj+Mlnpv9QpsWnJcMt77B4SipyD6OWSMjMB4
sha256sum sambent-mldsa.pub      # 4ae873ade7ee596c815f55f3052c0f01020b1817f86eaf15ab67c8fc77cbfd22

Compare them against a copy you got some other way (an earlier download, a trusted contact) rather than only against this page.

Post-quantum signature (ML-DSA-65)

ML-DSA-65 is standardized for the era of quantum computers (FIPS 204). Stock OpenSSL 3.5 or later verifies it; older OpenSSL has no ML-DSA. The key and signature files carry a 16-byte header in front of the standard encoding, which the first two lines strip. Run this inside signatures/:

# ML-DSA-65 with stock OpenSSL 3.5 or later (strip pqsign's 16-byte headers,
# wrap the raw key as a SubjectPublicKeyInfo, verify)
tail -c +17 sambent-mldsa.pub > /tmp/mldsa.key
tail -c +17 hiddenforge.digest.mldsa > /tmp/mldsa.sig
{ printf '\060\202\007\262\060\013\006\011\140\206\110\001\145\003\004\003\022\003\202\007\241\000'
  cat /tmp/mldsa.key; } > /tmp/mldsa.der
openssl pkeyutl -verify -pubin -keyform DER -inkey /tmp/mldsa.der \
  -in hiddenforge.digest -sigfile /tmp/mldsa.sig

It prints Signature Verified Successfully.

Hardware key (YubiKey / SSH-FIDO2)

This signature was made by a physical security key, so it can't be produced by software alone, not even by someone who has stolen the maintainer's disk:

ssh-keygen -Y verify \
  -f allowed-signers \
  -I sam@sambent.com \
  -n file \
  -s hiddenforge.digest.sig \
  < hiddenforge.digest

Both sign the same image digest. Together they cover different kinds of risk: a future quantum attack, and impersonation without the hardware token.

A note on cosign, and on the signing key

Releases up to 2.0.3 additionally carried a cosign signature. From 2.0.4 cosign is no longer used: it was the last part of the process that depended on external tooling, and the ML-DSA + hardware pair is the attestation. cosign.pub is kept in the repository so the older releases remain verifiable.

Also from 2.0.4, the maintainer signs with a single per-identity key rather than a per-project one. allowed-signers retains every key that has ever signed a release, so earlier releases still verify. If you verified an earlier release, you are consciously accepting a new key, and that is worth noticing, because a signing key changing without explanation is exactly what a compromise looks like.

2. Reproduce the build yourself

Signatures tell you who signed the image. A reproducible build tells you what's in it: that it was built from the public source and nothing was slipped in along the way.

Build the same source commit twice, on any machine, and you get a byte-for-byte identical image with the same digest.

Build from a fresh clone. This is not a stylistic preference; see the warning below.

git clone https://sambent.dev/sam/HiddenForge.git /tmp/hf && cd /tmp/hf
git checkout v2.0.4

export SOURCE_DATE_EPOCH=$(git log -1 --format=%ct v2.0.4)
docker buildx build \
  --platform linux/amd64,linux/arm64 \
  --build-arg SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH \
  --provenance=false \
  --output type=oci,dest=build.tar,rewrite-timestamp=true .

tar -xOf build.tar index.json \
  | python3 -c 'import json,sys;print(json.load(sys.stdin)["manifests"][0]["digest"])'

That digest must match signatures/hiddenforge.digest.

Two flags that are load-bearing

--provenance=false. buildx attaches a SLSA provenance attestation containing wall-clock build timestamps, and that attestation is carried inside the image index, so leaving it enabled changes the index digest on every build, even when the images themselves are identical. The published digest could never be reproduced.

A fresh clone. rewrite-timestamp clamps file modification times to SOURCE_DATE_EPOCH (min(mtime, epoch)); it does not set them all equal. In a fresh clone every file's mtime is the checkout time, which is newer than the commit time, so they all clamp to the same value and the build is deterministic. In a working tree where files were edited at different times, anything older than SOURCE_DATE_EPOCH keeps its own mtime and is baked into the layer verbatim, producing a digest that only that particular tree can generate. Releases are built from a pristine checkout for exactly this reason.

Reproducibility applies from 2.0.4 onward under this procedure. The signatures cover every published release.

If a check fails

If a signature doesn't verify, or a rebuild doesn't match the documented digest, do not run the image. Stop and ask on the project's channels. A failed check is exactly the signal this is here to give you.

Clone this wiki locally