Skip to content

fix(azure): bound attestation evidence payload size#52

Open
samlaf wants to merge 1 commit into
flashbots:mainfrom
SeismicSystems:fix/issue-50-payload-size
Open

fix(azure): bound attestation evidence payload size#52
samlaf wants to merge 1 commit into
flashbots:mainfrom
SeismicSystems:fix/issue-50-payload-size

Conversation

@samlaf

@samlaf samlaf commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Partially fixes #50

Reject serialized Azure attestation evidence larger than 128 KiB on every verification entry point, before deserializing untrusted bytes into owned strings and byte vectors. This includes get_measurements, which parses evidence without verifying it. Enforce the same bound after generation so a node fails fast instead of emitting evidence that verifiers would reject.

Realized this isn't enough, and the real DDoS mitigation should happen at the network boundary. Transports should bound reads at the network edge before the payload is ever buffered; this is the library's own fail-closed limit so verification stays safe regardless of which transport delivered the evidence. On the attested-TLS path the evidence travels inside the peer certificate, which rustls already caps at 64 KiB, so this check is a backstop there rather than the primary defense.

TODO (follow-ups):

  • explicitly bound reads on attested-TLS connections rather than relying on rustls' internal (pub(crate), unconfigurable) certificate size cap, if rustls exposes a way to do so
  • cap attestation_provider_client's HTTP response read, which currently buffers the response unbounded (reqwest .bytes()) before decoding and verification

These touch parts of the library that I don't know anything about (I've only worked with Azure). Also unsure if generic bounds would work for both azure and gcp, as gcp probably has smaller attestations I would guess? In any case probably worth creating a separate issue for anyone who has more context than me.

Reject serialized Azure attestation evidence larger than 128 KiB on
every verification entry point, before deserializing untrusted bytes
into owned strings and byte vectors. This includes get_measurements,
which parses evidence without verifying it. Enforce the same bound
after generation so a node fails fast instead of emitting evidence
that verifiers would reject.

Transports are expected to bound reads at the network edge before the
payload is ever buffered; this is the library's own fail-closed limit
so verification stays safe regardless of which transport delivered
the evidence. On the attested-TLS path the evidence travels inside
the peer certificate, which rustls already caps at 64 KiB, so this
check is a backstop there rather than the primary defense.

TODO at the network edges, in follow-ups:
- explicitly bound reads on attested-TLS connections rather than
  relying on rustls' internal (pub(crate), unconfigurable)
  certificate size cap, if rustls exposes a way to do so
- cap attestation_provider_client's HTTP response read, which
  currently buffers the response unbounded (reqwest .bytes()) before
  decoding and verification

@ameba23 ameba23 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

💯 Great fix.

@ameba23

ameba23 commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Re:

cap attestation_provider_client's HTTP response read, which currently buffers the response unbounded (reqwest .bytes()) before decoding and verification

Created #53

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.

Add size limits for Azure attestation evidence before deserialization

2 participants