Skip to content

fix: build releases on a BuildKit that honours rewrite-timestamp - #1

Merged
Marketen merged 1 commit into
mainfrom
fix/reproducible-enclave-builds
Sep 3, 2026
Merged

fix: build releases on a BuildKit that honours rewrite-timestamp#1
Marketen merged 1 commit into
mainfrom
fix/reproducible-enclave-builds

Conversation

@Marketen

@Marketen Marketen commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

The problem

deploy/nitro/verify-build.sh fails against every release we have published. The enclave build is not reproducible, so the manifest's "reproducibility": {"measurements": true} claim — and the "rebuild it yourself" half of the Nexus privacy story — does not currently hold.

Three builds of the same commit 96e1c23b, same SOURCE_DATE_EPOCH, three different measurements:

build PCR0
CI attempt 1 41459ff7…
CI attempt 2 (published as v0.1.60) 98c3915c…
local rebuild f8abaf0f…

PCR1 matched in all three, so the kernel is fine; PCR0/PCR2 track the enclave image.

Root cause

rewrite-timestamp is honoured only by a docker-container BuildKit. The docker driver bundled with the daemon — which CI was using (building with "default" instance using docker driver) — accepts the option and ignores it. Reproduced on one machine, same source, driver as the only variable:

driver BuildKit build 1 build 2
docker-container v0.32.2 e5e60655… e5e60655… deterministic
docker v0.17.3 534102407d… 9a240abe… differs every build

The existing guard could not catch this. It compared the image config's Created against SOURCE_DATE_EPOCH, and SOURCE_DATE_EPOCH sets that field whether or not the layers were normalised — both docker-driver builds above reported a correctly normalised Created.

This was latent from the start rather than a recent regression: every previous release built a different commit, so a different PCR0 was always expected and nothing ever compared two builds of one revision.

Changes

  • release-and-push.yml: docker/setup-buildx-action (SHA-pinned) with driver: docker-container before the EIF step.
  • build-release-assets.sh: refuse to release unless the driver is docker-container; replace the Created-only guard with building the enclave image twice and requiring identical IDs.
  • verify-build.sh: same driver guard. Without it a verifier on the docker driver sees a mismatch against an honest release — a false accusation, which is worse for us than a missed detection.
  • Both scripts build the nitro-cli image with buildx --load: a docker-container builder leaves results in the build cache, so build-enclave would fail on a clean machine or silently reuse a stale image of the same tag.

Verification

check result
verify-build.sh on docker driver refuses, exit 1
build-release-assets.sh on docker driver refuses, exit 1, no artifacts
End-to-end release, clean slate, docker-container exit 0, PCR0 f8abaf0f…
nitro-cli image loaded this run, not stale yes
Determinism-check image cleaned up yes
verify-build.sh against the fixed path's own manifest PASS — all 3 PCRs match

Follow-up

v0.1.60's published measurements came from a non-reproducible build. After this merges, cut v0.1.61, repoint the SDK trust policy at it, and redeploy before making the repos public.

🤖 Generated with Claude Code

The docker driver bundled with dockerd accepts the exporter's
rewrite-timestamp option and then ignores it: layer mtimes keep the build
clock, so two builds of one revision produce different images and
different measurements. It still normalises the image config's created
field, which is the only thing the old guard compared, so the check
passed and unreproducible releases shipped anyway.

Three builds of 96e1c23 demonstrate it -- CI attempt 1 measured PCR0
41459ff7, attempt 2 measured 98c3915c, and a local rebuild measured
f8abaf0f. Only a docker-container BuildKit honours the option, so the
release now runs on one and refuses to build otherwise.

Replace the created-only guard with a real one: build the enclave image
twice and require both to be identical. A normalised created field is not
evidence that the layers were normalised, and the manifest's
reproducibility claim should be tested by the release that makes it
rather than merely asserted.

verify-build.sh gets the same driver check. Without it a verifier on the
docker driver sees a mismatch against an honest release, which reads as
an accusation that the published measurements are dishonest.

Both scripts now build the nitro-cli image with buildx --load: a
docker-container builder leaves results in the build cache, so
build-enclave would either fail on a clean machine or silently reuse a
stale image of the same tag.

Verified locally: verify-build.sh now reports PASS against a manifest
produced by the fixed release path, and both scripts refuse to run on the
docker driver.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Marketen
Marketen force-pushed the fix/reproducible-enclave-builds branch from 9da3705 to 2808e2b Compare September 3, 2026 10:04
@Marketen
Marketen merged commit 893f4c9 into main Sep 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant