Skip to content

fix(verify): require TDX quote version 4 and validate expected digest lengths in verify_tdx_quote and verify_sev_snp_report (#283) - #288

Open
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-tdx-snp-verify-283
Open

drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-tdx-snp-verify-283

Conversation

@drk-ram

@drk-ram drk-ram commented Oct 25, 2026

Copy link
Copy Markdown

What

Require quote.version == 4 in verify_tdx_quote, validate expected_mrtd / expected_measurement (48 bytes) and expected_report_data (64 bytes) in verify_tdx_quote and verify_sev_snp_report, and validate isinstance(reject_unrecognized_platform_bits, bool) in verify_sev_snp_report and sev_snp_verifier.

Why

Closes #283.

Security impact

Prevents non-v4 TDX quotes from being parsed with DCAP v4 offsets during verification and prevents caller misconfiguration with wrong-length expected measurements or report_data bindings.

Test plan

  • pytest passes (pytest tests/unit/test_tdx.py tests/unit/test_sev_snp.py -q: 54 passed, 2 skipped)
  • ruff check passes (ruff check src tests/unit/test_tdx.py tests/unit/test_sev_snp.py: All checks passed!)
  • mypy passes
  • Manual test performed

DCO sign-off

@drk-ram
drk-ram requested review from a team, carloshvp and zohebk8s as code owners October 25, 2026 06:00
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Contributor Check: MEDIUM

Check Result
Profile MEDIUM
Credential LOW
Overall MEDIUM

Automated check by AgenTrust Contributor Check.

@github-actions github-actions Bot added the needs-review:MEDIUM Contributor check flagged MEDIUM risk label Oct 25, 2026
carloshvp
carloshvp previously approved these changes Oct 25, 2026

@carloshvp carloshvp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed exact head fa6f446cc727712e51845434825c240927d4f606 in an isolated checkout.

The TDX verifier requires the supported v4 layout and validates expected measurement/report-data byte lengths before appraisal. SNP expectations and the platform-bits option receive the corresponding type checks. All nine focused input/version cases pass here and fail against the baseline verifier modules at the expected guard boundary. Existing valid v4/SNP controls remain passing; no blocking source finding.

Independent validation in a fresh repository-hash-locked Python 3.12.10 environment: 785 tests passed, 16 skipped; pip check, configured Ruff, mypy, Bandit and diff whitespace checks passed. Commit sign-offs are present. Hosted CI and applicable independent maintainer/security gates remain separate prerequisites to merge.

Reviewed with OpenAI Codex.

@drk-ram drk-ram closed this Oct 29, 2026
@drk-ram
drk-ram force-pushed the drk-ram-fix-tdx-snp-verify-283 branch from fa6f446 to 1889ce4 Compare October 29, 2026 15:20
… lengths in verify_tdx_quote and verify_sev_snp_report (agentrust-io#283)

Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>

@carloshvp carloshvp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed current head aabdad3eb9dabf4a73f19526c21971f104a90037 in an isolated checkout.

The scoped input-hardening behavior passes source review and the full local unit/conformance suite (841 passed, 16 skipped). Ruff lint, mypy, configured Bandit and dependency consistency pass; the commit is signed off.

The required ruff format --check src/ tests/ job still fails on this head, while the same command passes on current main. Please run the pinned formatter on src/ca2a_verify/tdx.py and rerun the format gate. The formatting diff is mechanical; no additional behavioral repair is requested by this review. Hosted CI and the independent security-review requirements still apply.

Reviewed with OpenAI Codex.

Copy link
Copy Markdown
Contributor

The requested formatting correction is ready for author adoption: dinakarjs#8, commit 0824465b14d7bdef7f92287b3d109b9eb5c8f988, based directly on this reviewed PR head. Pinned Ruff 0.17.1 formatting changes only; every changed Python AST is identical before/after. Final unit/conformance run: 855 passed, 2 skipped; Ruff format/lint, mypy, Bandit and whitespace checks pass. Environment and scope are recorded in the companion. Please cherry-pick into the existing PR and rerun hosted checks. This does not replace independent maintainer approval. DCO signed; prepared with Codex.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review:MEDIUM Contributor check flagged MEDIUM risk

Projects

None yet

3 participants