Skip to content

fix(verifier): make VerificationRequest fields optional#722

Merged
kvinwang merged 2 commits into
masterfrom
fix/verifier-optional-request-fields
Jun 10, 2026
Merged

fix(verifier): make VerificationRequest fields optional#722
kvinwang merged 2 commits into
masterfrom
fix/verifier-optional-request-fields

Conversation

@kvinwang

Copy link
Copy Markdown
Collaborator

Problem

The verifier's POST /verify handler rejects requests with HTTP 422 unless all of quote, event_log, vm_config, attestation, and debug are present — even though every field is an Option<...> and the README documents sending only a subset:

Provide either attestation or (quote + event_log + vm_config).

Sending exactly what the README shows fails:

parse error: missing field `attestation`

Root cause: the fields are Option, but without #[serde(default)] serde treats a missing field as a hard parse error rather than None.

Fix

Add #[serde(default)] to every field of VerificationRequest so any documented subset deserializes and absent fields default to None.

Verification

Built the verifier and POSTed a request containing only the documented quote + event_log + vm_config:

  • Before: HTTP 422 Unprocessable Entity (missing field \attestation``)
  • After: HTTP 200, is_valid: true, quote_verified: true, os_image_hash_verified: true

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`.
Copilot AI review requested due to automatic review settings June 10, 2026 09:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 all VerificationRequest fields so missing JSON keys default to None.
  • Combine default with the existing serde_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.
@kvinwang kvinwang merged commit 703ac39 into master Jun 10, 2026
15 checks passed
@kvinwang kvinwang deleted the fix/verifier-optional-request-fields branch June 10, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants