Skip to content
This repository was archived by the owner on Aug 3, 2026. It is now read-only.

fix: keep enclave signing key out of image builds - #703

Merged
davidtaikocha merged 1 commit into
mainfrom
fix/enclave-key-build-secrets
Jun 29, 2026
Merged

fix: keep enclave signing key out of image builds#703
davidtaikocha merged 1 commit into
mainfrom
fix/enclave-key-build-secrets

Conversation

@smtmfft

@smtmfft smtmfft commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • remove the committed enclave signing key from the repo and Docker build context
  • sign SGX and SGXGETH artifacts with a BuildKit secret instead of copying the key into image layers
  • support release builds from either ENCLAVE_KEY_PATH or GCP Secret Manager, while keeping disposable-key fallback for direct CI/local Docker builds without a stable key
  • scrub the historical Gramine key from the SGX runtime base inside the main Dockerfile via an internal scratch-based runtime-base-clean stage, so no external base-clean image needs to be published first

This supersedes #695 with only the enclave-key build hardening changes. It intentionally does not include the stale gaiko pointer, chainspec, Cargo.lock, or unrelated branch changes from #695.

Verification

  • bash -n script/publish-image.sh
  • git diff --check
  • docker buildx build --check -f Dockerfile .
  • rg for private-key headers returned no matches

Copilot AI review requested due to automatic review settings June 29, 2026 07:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the SGX/TEE build pipeline by removing the enclave signing private key from the repository and image build context, and switching signing steps to use BuildKit secrets so the key is never written into Docker image layers.

Changes:

  • Updated Dockerfile to sign SGX/SGXGETH artifacts using RUN --mount=type=secret and an optional public-key hash check, instead of copying a private key into the build context/layers.
  • Updated script/publish-image.sh to support supplying the signing key via ENCLAVE_KEY_PATH or GCP Secret Manager and pass it to docker buildx as a BuildKit secret.
  • Removed the committed docker/enclave-key.pem, adjusted .dockerignore/.gitignore, and added docker/Dockerfile.base-clean to create a scrubbed runtime base image.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
script/publish-image.sh Adds BuildKit secret wiring and optional GCP Secret Manager retrieval for enclave signing key during image builds.
Dockerfile Switches enclave signing to BuildKit secrets and parameterizes the SGX runtime base image to a scrubbed base-clean.
docker/enclave-key.pem Removes the committed private signing key from the repository.
docker/Dockerfile.base-clean Adds a “scrubbed” base image recipe to remove the historical key from the runtime base filesystem.
.gitignore Ensures any local docker/enclave-key.pem is not accidentally committed.
.dockerignore Removes the exception that previously forced docker/enclave-key.pem into the Docker build context.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Dockerfile
Comment thread Dockerfile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 122bbbb7ec

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Dockerfile Outdated
@smtmfft
smtmfft force-pushed the fix/enclave-key-build-secrets branch from 122bbbb to bac6fad Compare June 29, 2026 08:24
@davidtaikocha
davidtaikocha added this pull request to the merge queue Jun 29, 2026
Merged via the queue into main with commit e7f1f87 Jun 29, 2026
14 of 16 checks passed
@davidtaikocha
davidtaikocha deleted the fix/enclave-key-build-secrets branch June 29, 2026 10:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants