Skip to content

Reproducible Builds

Containment Chamber produces bit-for-bit identical binaries and Docker images across builds. Given the same source code and toolchain, any two builds of the same commit produce the same SHA256 digest — for both the binary and the container image.

This means you can independently verify that a published release was built from the claimed source code, with no hidden modifications.

A remote signer holds validator private keys. If a compromised build pipeline injected malicious code into the binary, validators would unknowingly sign with tampered software. Reproducible builds make this detectable: anyone can rebuild from source and compare the result against the published artifact.

The build pipeline has two stages. The Dockerfile compiles the binary, then crane assembles the production Docker image.

Diagram

Dockerfile compiles inside rust:1.94-alpine3.23 (pinned by digest) with reproducibility flags and cargo-auditable for embedded dependency SBOM. The binary is extracted from the container.

crane builds the OCI image without Docker — no layer timestamps, no random metadata. Same inputs always produce the same image digest.

Every build applies these flags to eliminate non-determinism:

FlagWhat it eliminates
SOURCE_DATE_EPOCHNon-deterministic build timestamps
--build-id=noneRandom ELF build ID
-C metadata=''Path-dependent symbol name hashes
--remap-path-prefixBuild machine filesystem paths
CARGO_INCREMENTAL=0Non-deterministic incremental artifacts
LC_ALL=C / TZ=UTCLocale and timezone-dependent output
--lockedDependency version drift

Verify binary provenance (SLSA attestation)

Section titled “Verify binary provenance (SLSA attestation)”

Every release binary has a SLSA provenance attestation proving it was built by the CI pipeline:

Terminal window
gh release download v1.2.3 -p 'containment-chamber-linux-amd64'
gh attestation verify ./containment-chamber-linux-amd64 \
--owner unforeseen-consequences

Every Docker image is signed with Sigstore keyless signing:

Terminal window
cosign verify \
--certificate-identity-regexp \
'https://github.com/unforeseen-consequences/containment-chamber/.github/workflows/release.yml' \
--certificate-oidc-issuer \
'https://token.actions.githubusercontent.com' \
ghcr.io/unforeseen-consequences/containment-chamber:v1.2.3

The strongest verification — rebuild the binary yourself and compare SHA256:

  1. Check out the release tag:

    Terminal window
    git checkout v1.2.3
  2. Compute the build metadata:

    Terminal window
    SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
    GIT_SHA=$(git rev-parse HEAD)
    GIT_DESCRIBE=$(git describe --always)
  3. Build inside Docker (same environment as CI):

    Terminal window
    docker build \
    --build-arg SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \
    --build-arg VERGEN_GIT_SHA="$GIT_SHA" \
    --build-arg VERGEN_GIT_DESCRIBE="$GIT_DESCRIBE" \
    -t cc-verify . --no-cache
  4. Extract the binary:

    Terminal window
    docker create --name cc-extract cc-verify
    docker cp cc-extract:/containment-chamber ./my-binary
    docker rm cc-extract
  5. Download the release binary and compare:

    Terminal window
    gh release download v1.2.3 -p 'containment-chamber-linux-amd64'
    sha256sum my-binary containment-chamber-linux-amd64

If the hashes match, the published binary was built from the tagged source with no modifications.

Diagram

Every push to main builds a reproducible binary and publishes a signed Docker image. On tags, a verification step builds twice and blocks the release if the binaries differ.

Run the full verification locally (builds twice, compares binary SHA256 and crane image digest):

Terminal window
just verify-reproducible

Every binary includes a cargo-auditable dependency SBOM in the .dep-v0 ELF section. Container vulnerability scanners (Trivy, Grype, Syft) can extract and scan it:

Terminal window
cargo audit bin containment-chamber-linux-amd64