fix(tdx): delegate quote signature parsing to agent-manifest - #528
Open
devdiv07 wants to merge 1 commit into
Open
fix(tdx): delegate quote signature parsing to agent-manifest#528devdiv07 wants to merge 1 commit into
devdiv07 wants to merge 1 commit into
Conversation
Signed-off-by: devdiv07 <sarvenclothing@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
imran-siddique
self-requested a review
August 18, 2026 18:57
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.
What
Delegates cMCP's duplicate Intel TDX DCAP v4 signature-section parser to the
canonical parser already shipped by the required
agent-manifestdependency.parse_td_quote()remains as a thin local adapter that keeps cMCP's existing_ParsedQuoteshape andValueErrorcontract.Follow-up to #420.
Why
src/cmcp_verify/tdx.pycarried its own copy of the nested DCAP v4 signaturelayout while its own comment already stated that the parse was delegated to
Agent Manifest. The comment and the implementation contradicted each other.
The local copy also read attacker-controlled declared lengths — the outer
signature-data size, the nested QE certification-data size, the QE auth-data
size and the PCK-chain size — and sliced with them directly. Python slicing
clamps an out-of-range range instead of raising, so an overstated length
produced a silently shorter buffer rather than a rejection.
The shared parser explicitly validates those declared lengths before slicing.
This change keeps cMCP-specific behavior at the adapter boundary:
att_key_typecheck remains local becauseparse_tdx_quote_signature()does not perform that check;TdxVerificationErroris translated back toValueError, preserving theexisting
parse_td_quote()contract andverify_tdx_quote()failure path;REPORTDATAextraction remains local using_TD_BODY_REPORT_DATA_OFF;The follow-up direction was suggested directly in the #420 review: consolidate
on the Agent Manifest parser rather than maintain another copy of the DCAP v4
signature layout.
Security impact
Positive hardening of the TDX verification path.
The change removes a duplicated parser for attacker-controlled DCAP quote bytes
and delegates nested signature-section parsing to the canonical Agent Manifest
implementation, which performs explicit bounds checks on declared signature,
QE certification, QE auth-data, and PCK-chain lengths.
Regression tests demonstrate that the previous local parser did not reject
overstated declared lengths because Python slicing silently truncated the
requested range.
No TDX cryptographic verification policy is changed. Quote-signature
verification, QE binding, QE-report signature verification, PCK-chain
verification, report-data comparison, and the raw-TDREPORT path are otherwise
unchanged.
Real-hardware behavior is not newly claimed by this PR. The existing
CMCP_TDX_FIXTURE_DIRtests remain the hardware-gated validation path.Test plan
pytest tests/unit/test_tdx_quote_verify.py -vCMCP_TDX_FIXTURE_DIRpytest tests/unit/ -qruff check src/cmcp_verify/tdx.py tests/unit/test_tdx_quote_verify.pymypy src/cmcp_verify/bandit -r src/ -c pyproject.tomlRegression coverage added for:
The malformed-length regressions were also run against the pre-change parser:
the overstated signature and QE-certification cases failed with
DID NOT RAISE,confirming they exercise behavior changed by this patch rather than merely
duplicating an existing check.
DCO sign-off
Developer Certificate of Origin (https://developercertificate.org).