Repository navigation
fix(verify/sev_snp,tpm): enforce canonical lowercase hex in measurement checks and validate report_data_hex (#811) - #816
Conversation
…nt checks and validate report_data_hex (agentrust-io#811) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com>
|
🟡 Contributor Check: MEDIUM
Automated check by AgenTrust Contributor Check. |
noah-ing
left a comment
There was a problem hiding this comment.
Reviewed exact head 87498ac against #811. Independent synthetic SNP/TPM controls reproduce the previous acceptance of an overlong report_data_hex and the previous misclassification of noncanonical measurement hex; this head rejects them while preserving a valid lowercase measurement and 128-character report-data control. The focused checks passed (50 passed, 1 skipped), as did the broader unit, conformance, integration, and confinement suite (2,640 passed, 43 skipped), lint, typing, and dependency checks.
I approve this fix within that local verification scope. The synthetic SNP control did not include a VCEK certificate chain, so this review does not claim hardware attestation. Normal hosted checks and maintainer approval remain applicable.
carloshvp
left a comment
There was a problem hiding this comment.
Reviewed exact head 87498ac6853e59e43ebd7cc5d5b9a3f078dbd2e9 in an isolated checkout.
The SNP/TPM measurement guards require the declared lowercase digest formats, and report-data input is validated before decoding rather than silently truncating oversized values. The focused format/report-data regression passes here and fails with the actual baseline verifier modules restored in process. Valid report/measurement controls remain passing; this review does not establish new hardware execution.
Independent validation in a fresh repository-hash-locked Python 3.12.10 environment: 2,526 tests passed, 20 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.
What
Enforce canonical lowercase hex in
verify_sev_snp_measurementandtpm._valid_measurement, and validatereport_data_hexformat and length (<= 128hex chars) before decoding inverify_sev_snp_measurement.Why
Closes #811.
Security impact
Prevents non-hex
"sha384:" + "z" * 96strings from passing Step 1 format checks inverify_sev_snp_measurement, prevents silent truncation of oversizedreport_data_hex[:128], and prevents malformedreport_data_hexfrom being misreported asraw_evidence_parse_error.Test plan
pytestpasses (pytest tests/unit/test_sev_snp_verify.py -q:22 passed)ruff checkpasses (All checks passed!)mypypassesDCO sign-off
Developer Certificate of Origin (https://developercertificate.org).