Attestation Report Parsing #373
Replies: 4 comments 1 reply
-
|
@fitzthum @hyperfinitism @cschramm @tylerfanelli I know you guys are active users of the library so getting your thoughts on this would be appreciated. |
Beta Was this translation helpful? Give feedback.
-
|
#370 (comment) has good directions on a raw blob mode. I think the getter approach would be something like a struct that holds the blob and exposes fallible methods like #370 (comment) is a similar approach where parsing is not done on demand in getters, but the |
Beta Was this translation helpful? Give feedback.
-
|
Below is a summary of several possible design directions, including the current approach and alternatives, with their trade-offs. 1. Keep the current approach (strict parsing + zero checks)Current behavior:
However, from reading the code, zero-checks are currently not consistently applied to sub-structures such as If this approach is kept, then:
A concrete example of why this matters:
So if we keep the current design, consistency demands that all sub-structures must apply the same strict validation rules, otherwise variant detection becomes unreliable. 2. Preserve reserved fields in the parsed structures (configurable zero check)Another approach is to explicitly preserve reserved fields:
An intermediate option is also possible:
On TCB VersionThe raw One possible mitigation:
Trade-offs
Overall, this feels like a reasonable balance between strict validation, forward compatibility, and API stability. 3. Treat the report as an opaque binary blob and parse on demandIn this approach:
Pros
Cons
As already mentioned in the discussion, this is the most flexible option, but also the most disruptive. Summary
Personally, I think Option 2 strikes the best balance for the current |
Beta Was this translation helpful? Give feedback.
-
|
This analysis focuses on I suspect this will reveal the following... Actors
A. Minimal parsing is performed just to determine the metadata related to the signing process. Then the signature is verified using this metadata. There's an important rule here: signing must be validated before parsing untrusted data. B. Once the remaining data is signed, the verifier will extract the known fields from the version and perform semantic validation.
Proposal
Putting this altogether, this is basically a more well-defined version of Option 3 from @hyperfinitism. Objections
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I wanted to open this discussion around how we might revamp the way the Attestation Report and related structs are currently parsed, with the goal of improving forward compatibility while preserving type safety:
Current Attestation Report Parsing: Design and Limitations
This issue documents how the attestation report is parsed today, why it works the way it does, and what limitations arise from that design—particularly around forward compatibility and reserved fields.
Overview
The current attestation report implementation uses strict, fully typed parsing. Each field defined in the SNP specification is decoded into a corresponding Rust type, producing a strongly typed
AttestationReportstructure.This design prioritizes:
How Parsing Works Today
Reserved fields are not stored in the
AttestationReportstruct and are not preserved after parsing.Encoding and Round-Tripping
When encoding an
AttestationReport:Because reserved data is discarded during parsing, encoding the report does not guarantee byte-for-byte round-tripping, even if decoding succeeded.
Strengths of the Current Design
Limitations
1. Reserved Field Data Is Lost
If firmware repurposes reserved fields:
Even in relaxed parsing modes, the data is still discarded.
2. Forward Compatibility Is Limited
New report versions may introduce:
Under the current model:
3. Single Parsing Mode per Dependency Tree
Feature-based approaches (e.g. strict vs lax parsing):
4. Raw Data Is Outside the Typed Model
While raw report bytes may be available separately:
AttestationReportdoes not retain unknown or reserved dataSummary
The current parsing model:
This approach works well for known report versions and strict validation use cases, but it limits:
Addressing these concerns likely requires a more fundamental redesign (e.g. raw-backed or hybrid models), which may involve API-breaking changes and warrants a broader design discussion.
We’ve already touched on aspects of this problem in:
#370
#366
#363
Beta Was this translation helpful? Give feedback.
All reactions