fix: pin enclave container image digest in attestation, fail closed - #9454
Merged
Conversation
The image_digest check previously skipped when EXPECTED_IMAGE_DIGEST was empty (a TODO), so the verifier accepted any container running in a genuine Confidential Space — whoever controls the deployment could swap in a tampered image and attestation still passed. - Pin EXPECTED_IMAGE_DIGEST to the released openminedreleasebot/syft-client-enclave:latest digest - Fail closed: reject on empty pinned digest, missing image_digest claim, or mismatch — no skip path - Tests for all three reject paths + guard that the constant stays a real sha256 digest - docs/security.md: how data owners independently confirm the digest, and the maintainer re-pin step on each image release Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Member
Author
Provenance of the pinned digest
TOKEN=$(curl -s "https://auth.docker.io/token?service=registry.docker.io&scope=repository:openminedreleasebot/syft-client-enclave:pull" | jq -r .token)
curl -sI -H "Authorization: Bearer $TOKEN" \
-H "Accept: application/vnd.oci.image.index.v1+json, application/vnd.docker.distribution.manifest.list.v2+json" \
"https://registry-1.docker.io/v2/openminedreleasebot/syft-client-enclave/manifests/latest" \
| grep -i docker-content-digestEquivalent one-liner: Reviewer checks before marking ready
🤖 Generated with Claude Code |
khoaguin
marked this pull request as ready for review
July 19, 2026 04:53
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pjwerneck
previously approved these changes
Jul 20, 2026
| with pytest.raises(AttestationError, match="image_digest"): | ||
| verify_attestation_token("fake-token", verbose=False) | ||
|
|
||
| def test_pinned_digest_is_set(self): |
Collaborator
There was a problem hiding this comment.
Minor, but if the goal is guarding for malformed sha256, checking length is not enough. If should check if the encoding is correct too. Just testing if it decodes cleanly from hex is enough.
rasswanth-s
approved these changes
Jul 22, 2026
Google mints Confidential Space attestation tokens with a short (~30 min) lifetime, but the enclave writes its token to SYFT_version.json once at boot and does not yet refresh it, so peers would reject a still-genuine enclave after ~30 minutes. Widen the accepted expiry window on the verifier side via jwt.decode's clock_skew_in_seconds (JWT_EXPIRY_GRACE_SECONDS, ~1 month) as a stopgap until the enclave refreshes its token. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EXPECTED_IMAGE_DIGESTinsyft-enclavewas an empty TODO, and the verifier treated it as "skip the image check." That meant attestation only proved genuine Confidential Space hardware — not that the enclave runs the audited image. Anyone controlling the deployment (operator, CI, compromised SA) could swap the container and still pass attestation.This PR pins the digest and makes the check fail closed:
EXPECTED_IMAGE_DIGESTpinned to the currentdocker.io/openminedreleasebot/syft-client-enclave:latestdigest (sha256:23a06dd0…), with a comment on how to re-pin.image_digestclaim, or digest mismatch. The oldpassed=Noneskip path is gone.sha256:digest (so it can't be silently blanked again).docs/security.mdgains a "Verifying the enclave image digest" section: how a data owner independently fetches the published digest from Docker Hub (docker buildx imagetools inspect) and compares it to the constant at the installed release tag — plus the known gap (no signed release manifest yet; cosign/sigstore is the planned hardening).Before / After
Before
After
AttestationError, named in the failure list like every other check.docs/security.md).Don't regress
client.py— unchanged, flagged as a separate discussion.For maintainers
Releasing a new enclave image now requires re-pinning
EXPECTED_IMAGE_DIGESTin the same release — otherwise clients correctly reject the mismatched enclave. Worth wiring into thejust publishrecipe as a follow-up.Test plan
uv run --with pytest pytest tests/inpackages/syft-enclave— 69 passed.🤖 Generated with Claude Code