Repository navigation
fix(tee): validate SNP measurement against expected value (HW-002) - #233
Merged
Merged
Conversation
imran-siddique
force-pushed
the
fix/hw-002-snp-measurement-validation
branch
from
June 7, 2026 23:50
ddbd966 to
caa1219
Compare
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.
Summary
expected_measurementfield toAttestationConfig(optional, defaults toNone)SEVSNPProvider.__init__accepts the value and stores it as_expected_measurementget_attestation_reportcall, if configured, computessha384of the raw firmware measurement bytes and useshmac.compare_digestfor constant-time comparison — raisesRuntimeError("measurement mismatch")on failuredetect_provider/_get_provider_implnow thread the config through soSEVSNPProviderreceivesexpected_measurementat constructionCloses #172
Test plan
test_expected_measurement_loaded_from_config— field parsed from YAMLtest_expected_measurement_defaults_to_none— omitting field leaves itNonetest_expected_measurement_non_string_rejected— non-string value raisesConfigErrortest_sevsnp_no_expected_measurement_skips_check—Nonevalue skips comparisontest_sevsnp_stores_expected_measurement— value stored on instancetest_sevsnp_rejects_mismatched_expected_measurement— mismatch raisesRuntimeErrortest_sevsnp_accepts_matching_expected_measurement— match returns report cleanlytest_detect_provider_passes_expected_measurement_to_snp— wired end-to-end