Skip to content

Commit 834e750

Browse files
achamayouCopilot
andauthored
Test endorsed TCB (#7668)
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
1 parent 71c64f5 commit 834e750

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,7 @@ if(BUILD_TESTS)
10501050
NAME programmability_and_jwt
10511051
CONSTITUTION ${RBAC_CONSTITUTION_ARGS}
10521052
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/programmability.py
1053+
LABEL snp
10531054
)
10541055

10551056
# This test uses large requests (so too slow for SAN)

tests/npm_tests.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,33 @@ def corrupt_value(value: str):
987987
for key, value in r.body.json().items():
988988
LOG.info(f"{key} : {value}")
989989

990+
# Test with endorsed_tcb derived from the reported_tcb of the
991+
# first call, which also captures the architecture (Milan/Genoa/Turin)
992+
endorsed_tcb = report_json["reported_tcb"]
993+
LOG.info(f"Testing with endorsed_tcb: {endorsed_tcb}")
994+
r = c.post(
995+
"/app/verifySnpAttestation",
996+
{
997+
"evidence": primary_quote_info["raw"],
998+
"endorsements": primary_quote_info["endorsements"],
999+
"uvm_endorsements": primary_quote_info["uvm_endorsements"],
1000+
"endorsed_tcb": endorsed_tcb,
1001+
},
1002+
)
1003+
assert r.status_code == http.HTTPStatus.OK, r.status_code
1004+
1005+
# Test with endorsed_tcb of correct size but all zeroes, should be rejected
1006+
r = c.post(
1007+
"/app/verifySnpAttestation",
1008+
{
1009+
"evidence": primary_quote_info["raw"],
1010+
"endorsements": primary_quote_info["endorsements"],
1011+
"uvm_endorsements": primary_quote_info["uvm_endorsements"],
1012+
"endorsed_tcb": "0" * len(endorsed_tcb),
1013+
},
1014+
)
1015+
assert r.status_code == http.HTTPStatus.BAD_REQUEST, r.status_code
1016+
9901017
validate_openapi(c)
9911018
generate_and_verify_jwk(c)
9921019

0 commit comments

Comments
 (0)