fix(verifier): make VerificationRequest fields optional#722
Merged
Conversation
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`.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes JSON deserialization for the verifier’s POST /verify request type so that omitted fields correctly deserialize to None (instead of causing a 422 error), matching the README’s documented request shapes.
Changes:
- Add
#[serde(default)]to allVerificationRequestfields so missing JSON keys default toNone. - Combine
defaultwith the existingserde_human_bytes(with = "serde_bytes") handling for the byte fields (quote,attestation).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
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.
Problem
The verifier's
POST /verifyhandler rejects requests with HTTP 422 unless all ofquote,event_log,vm_config,attestation, anddebugare present — even though every field is anOption<...>and the README documents sending only a subset:Sending exactly what the README shows fails:
Root cause: the fields are
Option, but without#[serde(default)]serde treats a missing field as a hard parse error rather thanNone.Fix
Add
#[serde(default)]to every field ofVerificationRequestso any documented subset deserializes and absent fields default toNone.Verification
Built the verifier and POSTed a request containing only the documented
quote+event_log+vm_config:HTTP 422 Unprocessable Entity(missing field \attestation``)HTTP 200,is_valid: true,quote_verified: true,os_image_hash_verified: true