Skip to content

prototype(tdx_collateral): reject non-finite JSON, non-minimal/duplicate PCK OIDs, boolean integer fields, and non-list advisoryIDs (#644) - #650

Open
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-tdx-collateral-644
Open

drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-tdx-collateral-644

Conversation

@drk-ram

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

Copy link
Copy Markdown
Contributor

What this changes

Closes #644.

Hardens offline Intel TDX collateral appraisal in prototype/tdx_collateral.py:

  • Rejects NaN, Infinity, -Infinity, and overflowed float literals (1e309, -1e309) in _json via parse_constant and parse_float.
  • Rejects trailing continuation bytes (value[-1] & 0x80 != 0) and non-minimal leading 0x80 subidentifier bytes in _oid, and rejects duplicate OIDs in _pck_extension.
  • Enforces exact int types (type(...) is int) on QCNL cache expiration hours (pck_cache_expire_hours, verify_collateral_cache_expire_hours), collateral snapshot version and tee_type, tcbInfo version and tcbType, qeIdentity version and isvprodid, and tcbEvaluationDataNumber.
  • Validates that advisoryIDs (when present) is a list of non-empty str items before sorting.

Validation commands and results:

  • PYTHONPATH=src python -m pytest tests/test_tdx_collateral.py -q -> passed (36 passed, 51 skipped)
  • python -m ruff check prototype/tdx_collateral.py tests/test_tdx_collateral.py -> passed (All checks passed!)
  • python tools/check_dashes.py -> passed (no dashes outside examples/, spec/trace-v0.1.md)
  • PYTHONPATH=src python tools/review_bar.py --base origin/main --head HEAD -> passed (23 changed test cases fail on behaviour at origin/main)

Type of change

  • Editorial (typo, link fix, clarification: no normative effect)
  • Non-breaking spec change (new optional field, new platform profile, informative addition)
  • Breaking spec change (requires 14-day comment period and Project Lead sign-off)
  • Schema change
  • Example addition

Spec section

prototype/tdx_collateral.py (experimental Intel TDX QVL collateral appraisal prototype; no normative change to spec/trace-v0.2.md)

Tests for a fix

  • parse_constant=_no_constants and parse_float=_finite_float in _json: tests/test_tdx_collateral.py::test_json_rejects_nan_infinity_and_float_overflow
  • Trailing continuation byte and leading 0x80 subidentifier byte checks in _oid: tests/test_tdx_collateral.py::test_oid_rejects_trailing_continuation_and_leading_zero_subidentifier
  • Duplicate outer/inner OID checks in _pck_extension: tests/test_tdx_collateral.py::test_pck_extension_rejects_duplicate_outer_and_inner_oids
  • Exact int checks on pck_cache_expire_hours and verify_collateral_cache_expire_hours in _check_qcnl: tests/test_tdx_collateral.py::test_check_qcnl_rejects_boolean_and_float_cache_expire_hours
  • Exact int checks on snapshot["version"], snapshot["tee_type"], tcb_info["version"], tcb_info["tcbType"], qe_identity["version"], qe_identity["isvprodid"], and list[str] validation on advisoryIDs in appraise_collateral: tests/test_tdx_collateral.py::test_appraise_collateral_rejects_non_int_fields_and_invalid_advisory_ids

Changelog entry

Checklist

  • DCO sign-off on all commits (git commit -s)
  • Breaking changes marked with <!-- CHANGED: #NNN: description --> in spec text
  • Backward compatibility statement included (for breaking changes)

…ate PCK OIDs, boolean integer fields, and non-list advisoryIDs (agentrust-io#644)

- Reject NaN, Infinity, -Infinity, and overflowed float literals in _json via parse_constant and parse_float.
- Reject trailing continuation bytes and non-minimal leading 0x80 subidentifier bytes in _oid, and reject duplicate OIDs in _pck_extension.
- Enforce exact int types on QCNL cache expiration hours, collateral snapshot version/tee_type, tcbInfo version/tcbType, qeIdentity version/isvprodid, and tcbEvaluationDataNumber.
- Require advisoryIDs (when present) to be a list of non-empty strings.

Closes agentrust-io#644

Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
@drk-ram
drk-ram requested review from a team, lywinged and rajnisht7 as code owners October 30, 2026 15:05
@github-actions

github-actions Bot commented Oct 30, 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 30, 2026
@rajnisht7

rajnisht7 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Batch response for this cluster is here: #653 (comment)

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

Development

Successfully merging this pull request may close these issues.

prototype(tdx_collateral): reject non-finite JSON, non-minimal/duplicate PCK OIDs, boolean integer fields, and non-list advisoryIDs

2 participants