From a24fc3a3f72f542fc14804e82d8b58aa3db99001 Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Wed, 10 Jun 2026 02:49:39 -0700 Subject: [PATCH 1/2] fix(verifier): make VerificationRequest fields optional the /verify handler rejected requests that omitted `attestation` and `debug` with a 422, even though the README documents sending only `quote` + `event_log` + `vm_config` (or only `attestation`). every field is an `Option`, but without `#[serde(default)]` serde treats a missing field as a parse error. add `#[serde(default)]` to all fields so any documented subset deserializes and missing fields default to `None`. --- verifier/src/types.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/verifier/src/types.rs b/verifier/src/types.rs index 736b4cfb7..70ae9e974 100644 --- a/verifier/src/types.rs +++ b/verifier/src/types.rs @@ -9,12 +9,15 @@ use serde_human_bytes as serde_bytes; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VerificationRequest { - #[serde(with = "serde_bytes")] + #[serde(with = "serde_bytes", default)] pub quote: Option>, + #[serde(default)] pub event_log: Option, + #[serde(default)] pub vm_config: Option, - #[serde(with = "serde_bytes")] + #[serde(with = "serde_bytes", default)] pub attestation: Option>, + #[serde(default)] pub debug: Option, } From c0eaa3a160a898071924fd4c36b8673d6ee1b8c1 Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Wed, 10 Jun 2026 02:52:56 -0700 Subject: [PATCH 2/2] test(verifier): cover optional VerificationRequest field combinations add serde tests proving each documented request subset deserializes: quote-only (no attestation), attestation-only, and empty object. these fail with "missing field" without the #[serde(default)] fix. --- verifier/src/types.rs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/verifier/src/types.rs b/verifier/src/types.rs index 70ae9e974..40aa95728 100644 --- a/verifier/src/types.rs +++ b/verifier/src/types.rs @@ -87,3 +87,41 @@ pub enum RtmrEventStatus { Extra, Missing, } + +#[cfg(test)] +mod tests { + use super::*; + + // the README documents sending either `attestation` or + // (`quote` + `event_log` + `vm_config`); every field is optional, so any + // documented subset must deserialize without a "missing field" error. + + #[test] + fn deserializes_quote_subset_without_attestation() { + let json = r#"{"quote":"00","event_log":"[]","vm_config":"{}"}"#; + let req: VerificationRequest = serde_json::from_str(json).unwrap(); + assert_eq!(req.quote, Some(vec![0u8])); + assert_eq!(req.event_log.as_deref(), Some("[]")); + assert_eq!(req.vm_config.as_deref(), Some("{}")); + assert_eq!(req.attestation, None); + assert_eq!(req.debug, None); + } + + #[test] + fn deserializes_attestation_subset_without_quote() { + let json = r#"{"attestation":"00"}"#; + let req: VerificationRequest = serde_json::from_str(json).unwrap(); + assert_eq!(req.attestation, Some(vec![0u8])); + assert_eq!(req.quote, None); + assert_eq!(req.event_log, None); + assert_eq!(req.vm_config, None); + } + + #[test] + fn deserializes_empty_object() { + let req: VerificationRequest = serde_json::from_str("{}").unwrap(); + assert_eq!(req.quote, None); + assert_eq!(req.attestation, None); + assert_eq!(req.debug, None); + } +}