fix(attestation): preserve TDX V2 event integrity - #1038
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a correctness gap in TDX V2 attestation handling so that serialized/stripped evidence preserves the digest-to-canonical-preimage binding required to independently verify RTMR3 runtime events.
Changes:
- Ensure TDX V2 event preimages are populated before projecting an
Attestationinto a versioned wire format. - Preserve TDX event digests when stripping event logs for RA-TLS / size-reduced representations.
- Add tests asserting stripped/serialized V2 events remain verifiable via digest ↔ preimage validation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| dstack/dstack-attest/src/attestation.rs | Populates V2 preimages before versioned serialization; strengthens versioning/stripping test to validate digest↔preimage binding survives round-trip. |
| dstack/cc-eventlog/src/tdx.rs | Fixes TdxEvent::stripped() to preserve the digest (and adds a test ensuring stripped V2 runtime events remain verifiable). |
Suppressed comments (1)
dstack/dstack-attest/src/attestation.rs:2426
into_versioned()only upgrades to the V1/msgpack wire format based onself.runtime_events, but TDX V2 events can also exist in the embedded TDX quote event log (tdx_quote.event_log). If a caller has V2 events only in the quote log (common whenruntime_eventsis empty), this will still choose the V0/SCALE format, which cannot encodeTdxEvent.version/preimage(#[codec(skip)]) and will break the intended digest-to-preimage binding.
let has_v2 = self
.runtime_events
.iter()
.any(|e| !matches!(e.version, EventLogVersion::V1));
if has_v2 {
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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
Context
TDX V2 runtime events are extended into RTMR3 using the SHA-384 digest of a canonical preimage. Versioned and RA-TLS stripped attestations must carry enough information for relying parties to independently verify that binding. Previously the versioned conversion could omit the preimage, and stripping could clear the corresponding digest.
Testing
cargo fmt --all -- --checkcargo test -p cc-eventlog -p dstack-attestcargo clippy -p cc-eventlog -p dstack-attest -- -D warningsgit diff --check origin/next...HEAD