Skip to content

Commit 7ef08da

Browse files
committed
verifier: report attestation mode
1 parent a2fbb67 commit 7ef08da

3 files changed

Lines changed: 14 additions & 17 deletions

File tree

verifier/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ or
3535
"os_image_hash_verified": true,
3636
"os_image_is_dev": false, // true=dev image, false=prod, null=unknown/N/A
3737
"os_image_version": "0.5.10", // dstack OS version, null if unknown
38-
"tee_platform": "tdx", // tdx | gcp-tdx | nitro
38+
"attestation_mode": "dstack-tdx", // dstack-tdx | dstack-gcp-tdx | dstack-nitro-enclave | dstack-amd-sev-snp
3939
"report_data": "hex-encoded-64-byte-report-data",
4040
"tcb_status": "UpToDate",
4141
"advisory_ids": [],
@@ -196,7 +196,7 @@ Beyond pass/fail, the result carries a few descriptive fields so a relying party
196196

197197
- **`os_image_is_dev`** — `true` for a development OS image, `false` for production. Dev images are built for local testing and are not hardened for production use, so a relying party generally wants to reject them.
198198
- **`os_image_version`** — the dstack OS version (e.g. `0.5.10`), useful for enforcing a minimum version.
199-
- **`tee_platform`** — which TEE produced the verified quote: `tdx`, `gcp-tdx`, or `nitro`.
199+
- **`attestation_mode`** — the attestation mode that produced the verified quote, serialized as `AttestationMode`: `dstack-tdx`, `dstack-gcp-tdx`, `dstack-nitro-enclave`, or `dstack-amd-sev-snp`.
200200
- **`key_provider`** — the decoded `app_info.key_provider_info` (`{name, id}`); `name` is e.g. `kms` or `local`. A `local` key provider means the CVM is not KMS-backed, which is itself a dev/insecure posture signal. The raw bytes remain in `app_info.key_provider_info`.
201201

202202
`os_image_is_dev` and `os_image_version` are read from the image's `metadata.json`, which is part of `sha256sum.txt` and therefore bound to the `os_image_hash` that step 3 verifies against the quote — so they are as trustworthy as the os-image-hash check itself. They are `null` when the platform does not expose them (e.g. GCP TDX / Nitro Enclave) or when the image predates the field (images without `is_dev` are always production).

verifier/src/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// SPDX-License-Identifier: Apache-2.0
44

55
use dstack_types::KeyProviderInfo;
6-
use ra_tls::attestation::AppInfo;
6+
use ra_tls::attestation::{AppInfo, AttestationMode};
77
use serde::{Deserialize, Serialize};
88

99
use serde_human_bytes as serde_bytes;
@@ -45,8 +45,8 @@ pub struct VerificationDetails {
4545
pub os_image_is_dev: Option<bool>,
4646
/// dstack OS version, from the same metadata.json.
4747
pub os_image_version: Option<String>,
48-
/// "tdx" | "gcp-tdx" | "nitro".
49-
pub tee_platform: Option<String>,
48+
/// Attestation mode that produced the verified quote.
49+
pub attestation_mode: Option<AttestationMode>,
5050
pub report_data: Option<String>,
5151
pub tcb_status: Option<String>,
5252
pub advisory_ids: Vec<String>,

verifier/src/verification.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,6 @@ use crate::types::{
3737
VerificationRequest, VerificationResponse,
3838
};
3939

40-
fn tee_platform_name(quote: &AttestationQuote) -> &'static str {
41-
match quote {
42-
AttestationQuote::DstackTdx(_) => "tdx",
43-
AttestationQuote::DstackGcpTdx(_) => "gcp-tdx",
44-
AttestationQuote::DstackNitroEnclave(_) => "nitro",
45-
AttestationQuote::DstackAmdSevSnp(_) => "sev-snp",
46-
}
47-
}
48-
4940
/// best-effort: None for empty/malformed blobs.
5041
fn decode_key_provider_info(bytes: &[u8]) -> Option<dstack_types::KeyProviderInfo> {
5142
if bytes.is_empty() {
@@ -560,7 +551,7 @@ impl CvmVerifier {
560551
let verified_attestation = match verified {
561552
Ok(att) => {
562553
details.quote_verified = true;
563-
details.tee_platform = Some(tee_platform_name(&att.quote).to_string());
554+
details.attestation_mode = Some(att.quote.mode());
564555
details.tcb_status = att.report.tdx_report().map(|r| r.status.clone());
565556
details.advisory_ids = att
566557
.report
@@ -1273,7 +1264,10 @@ mod tests {
12731264
assert!(response.details.quote_verified);
12741265
assert!(response.details.event_log_verified);
12751266
assert!(response.details.os_image_hash_verified);
1276-
assert_eq!(response.details.tee_platform.as_deref(), Some("sev-snp"));
1267+
assert_eq!(
1268+
response.details.attestation_mode,
1269+
Some(ra_tls::attestation::AttestationMode::DstackAmdSevSnp)
1270+
);
12771271
assert!(
12781272
!image_cache_dir.exists(),
12791273
"SNP verification must not download or cache OS images"
@@ -1298,6 +1292,9 @@ mod tests {
12981292

12991293
let response = verifier.verify(request).await.expect("verifier runs");
13001294
assert!(response.is_valid, "{:?}", response.reason);
1301-
assert_eq!(response.details.tee_platform.as_deref(), Some("sev-snp"));
1295+
assert_eq!(
1296+
response.details.attestation_mode,
1297+
Some(ra_tls::attestation::AttestationMode::DstackAmdSevSnp)
1298+
);
13021299
}
13031300
}

0 commit comments

Comments
 (0)