fix(tpm): classify signature envelopes by key shape - #375
Open
noah-ing wants to merge 1 commit into
Open
Conversation
Signed-off-by: Noah Ingwers <98993329+noah-ing@users.noreply.github.com>
Contributor
|
🟡 Contributor Check: MEDIUM
Automated check by AgenTrust Contributor Check. |
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
Classify legacy bare TPM quote signatures from the attestation key's signature shape instead of the untrusted
sigAlgprefix:TPMT_SIGNATURE.The regression coverage includes the committed reference vectors, supported and unsupported two-byte envelope mutations, malformed EC framing, and a fixed public synthetic vector whose valid 2048-bit bare RSA signature begins with
0x0014.Why
This is a narrow follow-up to the typed signature work in #320 and the reference vectors in #323.
The current discriminator treats a byte string as
TPMT_SIGNATUREonly when its first two bytes name a supported scheme. As a result:sigAlgto an unsupported value moves it into the legacy bare-signature path, changing an explicit unsupported-algorithm error into a genericFalseresult.0x0014,0x0016, or0x0018is misclassified as an envelope and rejected.The patch makes framing depend on the AK representation, not attacker-controlled envelope metadata. Invalid mutated evidence remains rejected; its diagnostic becomes explicit. Documented legacy bare RSA inputs with scheme-like random prefixes can now verify normally.
The fixed compatibility vector is synthetic public test cryptography. It did not come from a TPM and establishes no hardware provenance.
Spec impact
None. This is an SDK-only parsing and legacy-compatibility correction; no normative text or conformance IDs change.
Test plan
pytest -vequivalent full suite passes: 1,340 passed, 6 skipped, 1 xfailedmypy src/agent_manifestpasses: 26 source filesruff check src/ tests/ --select E,F,W --ignore E501passesAdditional verification:
bandit -r src/agent_manifest -c pyproject.toml— 0 findingspip-audit— no known vulnerabilitiesdetect-secrets1.5.0 on changed files — 0 findingsgit diff --checkandgit fsck --full— passedDCO
All commits in this PR are signed off (
git commit -s). By submitting this PR I certify the Developer Certificate of Origin.