Skip to content

feat(tpm): add type-safe NV certify attestation parsing - #304

Merged
imran-siddique merged 1 commit into
agentrust-io:mainfrom
noah-ing:feat/tpm-nv-certify-parser
Aug 15, 2026
Merged

feat(tpm): add type-safe NV certify attestation parsing#304
imran-siddique merged 1 commit into
agentrust-io:mainfrom
noah-ing:feat/tpm-nv-certify-parser

Conversation

@noah-ing

Copy link
Copy Markdown
Contributor

What

Add a shared TPMS_ATTEST dispatch parser and a type-enforcing TPM_ST_ATTEST_NV entry point for TPMS_NV_CERTIFY_INFO.

Why

This addresses the NV-certify consolidation scope added in #255. cMCP currently carries a local parser because parse_tpm_quote() assumes the quote union and rejects TPM_ST_ATTEST_NV. The new API lets consumers inspect the signed common header and safely parse a full NV certify without reimplementing TPM wire offsets.

The high-level parse_tpm_nv_certify() checks the signed attestation type before interpreting the union. The lower-level union parser remains available for callers that already dispatched on TpmAttest.attest_type. Size-prefixed TPM2B_ATTEST input must consume the full outer buffer; undeclared trailing bytes now fail closed.

This is the NV-certify portion of #255 only. It does not claim to close the remaining digest-agility or verification work.

Spec impact

None. SDK-only; no normative or conformance-level change.

Test plan

  • pytest -q tests - 874 passed, 6 skipped
  • mypy src/agent_manifest passes
  • ruff check src tests --select E,F,W --ignore E501 passes
  • bandit -r src/agent_manifest -c pyproject.toml passes
  • New tests cover bare and TPM2B framing, a non-empty qualified signer, type confusion rejection, truncation, trailing bytes, public exports, and the maximum UINT16 offset
  • CHANGELOG.md updated

DCO

All commits in this PR are signed off (git commit -s). By submitting this PR I certify the Developer Certificate of Origin.

Signed-off-by: Noah Ing <98993329+noah-ing@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 15, 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 Aug 15, 2026

@imran-siddique imran-siddique 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 the TPM wire parsing, framing/bounds behavior, public exports, regression coverage, and security-sensitive type separation. The common TPMS_ATTEST header and TPM_ST_ATTEST_NV union layout match the current TCG Part 2 structures; the distinct TPM_ST_ATTEST_NV_DIGEST selector is not conflated. CI evidence is green across lint, typing, security scan, governance, build, and completed test platforms. Approved.

@imran-siddique
imran-siddique merged commit 1d93f65 into agentrust-io:main Aug 15, 2026
14 of 15 checks passed
zohebk8s pushed a commit to zohebk8s/agent-manifest that referenced this pull request Aug 16, 2026
Only CHANGELOG.md conflicted, and only because both sides opened a new
## Unreleased / ### Added block. Both entries are kept under one heading, the
TPM attest parsing from agentrust-io#304 first since it landed first, then the COSE
conformance vectors.

No code conflict. The 35 vectors still regenerate byte-identically after the
merge, so nothing on main moved the engine's normative behaviour.

Signed-off-by: Mohammed Zoheb Shaik <zoheb.shaik7@gmail.com>
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.

2 participants