Skip to content

Use attest repo to compute expected measurements from image hashes#47

Merged
ameba23 merged 38 commits into
mainfrom
peg/attest-integrate-incremental-00
Jul 7, 2026
Merged

Use attest repo to compute expected measurements from image hashes#47
ameba23 merged 38 commits into
mainfrom
peg/attest-integrate-incremental-00

Conversation

@ameba23

@ameba23 ameba23 commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

This is a protocol breaking change as it changes the format of the wire message for attestation payload.

This is the first step towards integrating with the easy-tee/attest repo, and is based roughly on @Ruteri 's attest-integration-idea branch.

This adds platform metadata from the to the attestation payload which the attester produces and the verifier checks, and adds a new variant to the MeasurementRecord enum used by in the measurement policy for verification, which allows image hashes to be specified rather than a full set of measurements.

When verifying, if we have a policy which specifies image hashes rather than a full set of measurements, we we compute expected measurements using attest-measure's expected_dcap_registers function based on the platform metadata and image hashes.

There are still some things missing from this PR, and currently some very similar types are duplicated between this repo's attestation crate and attest-types. There is a little bit of friction there with wanting to maintain compatibility with our current measurement policy JSON format (for the attestation type names) and some things which i just didn't get to yet. But potentially this can become a lot neater, and we can lean more on the functionality in the attest repo.

A separate PR to add a cache for known GCP firmware has been merged into this branch: #57

In order to accommodate this change we had to drop support for:

  • Parsing/verifying attested certificates created with dstack. We now require our own custom format.
  • Using an attestation provider server other than our own. The one used by flashtestations produces raw dcap quotes without platform metadata, so can no longer be used.

Related issue: #40
Paired PR in attest: Easy-TEE/attest#13

TODO:

  • Test on GCP deployment.
  • See what else we need to do to support Azure for portable measurements (where we have image hashes rather than PCRs in policy). As far as i can see, DcapImageHashes is DCAP specific because the azure measure function expects 256 bit hashes rather than 384. So probably we just need to document that Azure is not supported for portable image hashes.
  • Consider also bailing for 'Self-hosted' (non-GCP) 'portable' policies, as this is not fully tested. Or at least document that it is experimental.
  • Deduplicate types (AttestationType, AttestationEvidence / AttestationExchangeMessage) between attestation and attest. The issue is representing the NoAttestation case. Potentially we can use Option. Also potentially an issue with adding Nitro support in Add support for AWS Nitro #45
  • Improve testing / consider approach to mock platform metadata
  • Consider dropping support for attestations encoded as Dstacks/ra-tls VersionedAttestationformat. Or at least document that these will not work with 'portable' measurement policies due to the missing platform metadata.
  • Check error handling logic related to missing mrtd / rtmr0 values returned from expected_dcap_registers.

@ameba23 ameba23 changed the title Use attest_measure repo to compute expected measurements from image hashes Use attest repo to compute expected measurements from image hashes Jun 3, 2026
@ameba23 ameba23 marked this pull request as draft June 3, 2026 11:04
@ameba23 ameba23 added the breaks protocol This is a protocol breaking change label Jun 3, 2026
ameba23 added 8 commits June 3, 2026 14:15
* main:
  azure: bound attestation evidence payload size (#50)
  chore: move attestation-provider-server crate from proxy repo
  azure: stop AIA fetch once AK chain verifies
  test(attestation): cover Azure AK issuer fetch fallbacks
  docs(azure_attn): document potential network fetches
  add comment explaining the PEM guard
  add AIA_CA_ISSUERS_ACCESS_METHOD_OID variable
  fix(attestation): harden Azure AK issuer AIA fetching
  fix clippy: box MaaError
  add capture_azure_fixture test util
  cargo fmt
  fix(attestation): include Azure vTPM AK intermediates
@ameba23 ameba23 marked this pull request as ready for review July 3, 2026 07:51

@alexhulbert alexhulbert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm! everything i commented was like super minor nitpicky stuff, feel free to ignore all of it :)

Comment thread crates/attestation/src/measurements.rs Outdated
true
}
return true;
ExpectedMeasurements::Image(image_hashes) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is nested deep enough that its a bit hard to read, maybe split something around here into a separate fn?

Comment thread crates/attestation/src/measurements.rs Outdated
return false;
}

if let Some(rtmr1) = dcap_measurements.get(&DcapMeasurementRegister::RTMR1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will we ever have a policy w/o RTMR1 or RTMR2? making this pass validation when we don't have RTMR1/RTMR2 seems a bit sketchy

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Totally agree, good catch.
i have fixed this here to return false if the value is not present and made an issue to change the representation for DCAP measurements so that individual values are not optional: #67

Comment thread crates/attestation/src/measurements.rs Outdated
pub(crate) fn check_measurement_with_gcp_cache(
&self,
measurements: &MultiMeasurements,
platform_metadata: Option<PlatformMetadata>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this could probably be a Option<&PlatformMetadata> without adding complexity anywhere if im not mistaken

Comment thread crates/attestation/src/gcp.rs Outdated
num_disks: 1,
acpi: Some(AcpiHashes {
loader: [
246, 12, 53, 229, 59, 178, 27, 70, 117, 207, 168, 219, 49, 14, 200, 142, 56,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this would be cleaner as hex

Comment thread crates/attestation/src/gcp.rs Outdated
/// verification
#[derive(Clone, Debug, Default)]
pub(crate) struct GcpFirmwareCache {
cache: Arc<RwLock<HashMap<[u8; 48], attest_measure::dcap::DcapFirmware>>>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

attest_measure::dcap::DcapFirmware is imported

Comment thread crates/attestation/src/measurements.rs Outdated
},
};

let expected_measurements = match expected_dcap_registers(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I will fix the todo in my code asap like u said so this doesn't potentially cause a panic

@ameba23 ameba23 merged commit 60d4112 into main Jul 7, 2026
2 checks passed
@ameba23 ameba23 deleted the peg/attest-integrate-incremental-00 branch July 7, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaks protocol This is a protocol breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants