fix: pin enclave container image digest in attestation, fail closed#9454
fix: pin enclave container image digest in attestation, fail closed#9454khoaguin wants to merge 2 commits into
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>
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 |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| "Image digest", | ||
| False, | ||
| f"digest mismatch (got {image_digest or 'none'}, expected {EXPECTED_IMAGE_DIGEST[:20]}...)", | ||
| f"digest mismatch (got {image_digest}, expected {EXPECTED_IMAGE_DIGEST[:20]}...)", |
There was a problem hiding this comment.
Minor issue, but why print the full digest for the actual image_digest and truncate it for the expected? If there's a mismatch, we want to compare both in full.
| with pytest.raises(AttestationError, match="image_digest"): | ||
| verify_attestation_token("fake-token", verbose=False) | ||
|
|
||
| def test_pinned_digest_is_set(self): |
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.
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