Skip to content

fix(enclave): report the release version in build info - #30

Merged
Marketen merged 1 commit into
mainfrom
fix/enclave-build-version
Nov 25, 2026
Merged

Marketen merged 1 commit into
mainfrom
fix/enclave-build-version

Conversation

@Marketen

Copy link
Copy Markdown
Contributor

Problem

After the v0.1.74 cutover, Grafana shows the enclave as nexus_gateway_build_info{version="dev", commit=""}, and enclave logs say "version":"dev". The regular gateway reports its release tag. The cause is that Dockerfile.enclave sets only the enclave profile values (revision, region and KMS key) at link time, so pkg/buildinfo keeps its defaults.

Change

  • apps/gateway/Dockerfile.enclave:
    • takes a VERSION build argument and validates it with the same pattern the release workflow uses (vX.Y.Z[-suffix]), like the other linker inputs;
    • links it into buildinfo.Version, and links SOURCE_REVISION into buildinfo.Commit.
  • deploy/nitro/build-release-assets.sh: passes the release VERSION.
  • deploy/nitro/verify-build.sh:
    • reads release.version from the signed manifest and refuses a manifest that lacks it;
    • passes the version as VERSION (and reuses it for nitro-cli --version, which read it separately before).
  • ci.yml: passes VERSION=v0.0.0-ci, because the argument is now required.

Effect on measurements

The version is now compiled into the measured binary, so it affects the PCRs: the same revision released under two different tags measures differently. Each release already gets new measurements, so nothing changes for the KMS allowlist or the cutover. verify-build.sh takes the version from the signed manifest, so third-party rebuilds still reproduce.

Older releases (v0.1.74 and earlier) are unaffected. Their Dockerfile.enclave doesn't declare VERSION, and BuildKit only warns about an unused build argument.

This takes effect at the next enclave release. Nothing needs to run in infrastructure.

Testing

  • I compiled the enclave binary (GOOS=linux GOARCH=amd64, -tags nitro_enclave) using the ldflags taken from this Dockerfile.enclave. buildinfo.Version and buildinfo.Commit are embedded, and nexus_gateway_build_info is fed by exactly those (metrics/prometheus.go:289).
  • The version pattern accepts v0.1.75, v0.0.0-ci and v1.2.3-rc.1. It rejects dev, an empty value, 0.1.75, and a value that would inject an extra -X.
  • I ran verify-build.sh's manifest parsing against synthetic manifests. With a version, all 11 fields parse and line up. Without one, it reports manifest is missing release.version.
  • bash -n passes on both scripts.
  • Not run: a full reproducible buildx build and verify-build.sh against a real release. I only have an arm64 machine, and the script requires x86_64. CI's enclave build and the release workflow's double-build determinism check cover the first. For the second, it's worth running verify-build.sh on the v0.1.74 manifest on an x86_64 host to confirm the unused-argument case.

🤖 Generated with Claude Code

The enclave build linked only its profile values, so buildinfo kept its
defaults: nexus_gateway_build_info reported version="dev" with an empty
commit, and enclave logs said "dev", while the regular gateway reports its
release tag.

- Dockerfile.enclave takes VERSION, validates it like the other linker
  inputs, and links it into buildinfo.Version, with SOURCE_REVISION as
  buildinfo.Commit.
- build-release-assets.sh passes the release VERSION.
- verify-build.sh reads release.version from the signed manifest, requires
  it, and passes the same value, so a release still reproduces. Older
  revisions do not declare VERSION, so BuildKit ignores it for them.
- CI passes a placeholder version, since VERSION is now required.

The version is now part of the measured binary, so it reaches the PCRs:
the same revision released under two tags measures differently. Every
release already gets new measurements, so the KMS allowlist and cutover
steps do not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Marketen
Marketen marked this pull request as ready for review November 25, 2026 15:31
@Marketen
Marketen merged commit fe55690 into main Nov 25, 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