-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scheme/tpm-enacttrust: BadEvidenceError when token decode fails
Return BadEvidenceError when token decoding fails. This is used distinguish between errors in the user-provided input and internal server errors. Without this, sending a bad token resulted in a 500 response from the REST frontend. Signed-off-by: Sergei Trofimov <[email protected]>
- Loading branch information
Showing
7 changed files
with
131 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"node-id": "7df7714e-aa04-4638-bcbf-434b1dd720f1", | ||
"firmware": 7, | ||
"pcrs": [1, 2, 3, 4], | ||
"algorithm": 11, | ||
"digest": "h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc=" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"ear.status": "contraindicated", | ||
"ear.trustworthiness-vector": { | ||
"configuration": 99, | ||
"executables": 99, | ||
"file-system": 99, | ||
"hardware": 99, | ||
"instance-identity": 99, | ||
"runtime-opaque": 99, | ||
"sourced-data": 99, | ||
"storage-opaque": 99 | ||
}, | ||
"ear.appraisal-policy-id": "policy:TPM_ENACTTRUST", | ||
"ear.veraison.policy-claims": { | ||
"problem": "could not establish identity from evidence" | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
integration-tests/tests/test_enacttrust_badnode.tavern.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
test_name: enacttrust-badnode | ||
|
||
marks: | ||
- parametrize: | ||
key: | ||
# Attestation scheme -- this is used to indicate how test cases should | ||
# be constructed (e.g. how the evidence token will be compiled. | ||
- scheme | ||
# Some attestation schemes (currently, only PSA) may support multiple | ||
# profiles. If a scheme does not support multiple profiles, specify it | ||
# as '_'. | ||
- profile | ||
# Which evidence description will be used to construct the evidence token. | ||
- evidence | ||
# The name of the endorsements spec within common.yaml | ||
- endorsements | ||
# Signing keys that will be used to construct the evidence. How this is | ||
# used is dependent on the scheme. | ||
- signing | ||
# Expected structure of the returned EAR (EAT (Entity Attestation | ||
# Token) Attestation Result). | ||
- expected | ||
vals: | ||
- [enacttrust, _, badnode, mini, ec.p256.enacttrust, badnode] | ||
|
||
includes: | ||
- !include common.yaml | ||
|
||
stages: | ||
- name: submit post request to the provisioning service successfully | ||
request: | ||
method: POST | ||
url: http://{provisioning-service}/endorsement-provisioning/v1/submit | ||
headers: | ||
content-type: '{endorsements-content-type}' # set via hook | ||
file_body: __generated__/endorsements/corim-{scheme}-{endorsements}.cbor | ||
response: | ||
status_code: 200 | ||
|
||
- name: verify as relying party - creation of session resource | ||
request: | ||
method: POST | ||
url: http://{verification-service}/challenge-response/v1/newSession?nonce={good-nonce} | ||
response: | ||
status_code: 201 | ||
save: | ||
headers: | ||
relying-party-session: Location | ||
|
||
- name: verify as relying party - submitting the evidence | ||
request: | ||
method: POST | ||
url: http://{verification-service}/challenge-response/v1/{relying-party-session} | ||
headers: | ||
content-type: '{evidence-content-type}' # set via hook | ||
file_body: __generated__/evidence/{scheme}.{evidence}.cbor | ||
response: | ||
status_code: 200 | ||
verify_response_with: | ||
- function: checkers:save_result | ||
extra_kwargs: | ||
scheme: '{scheme}' | ||
evidence: '{evidence}' | ||
- function: checkers:compare_to_expected_result | ||
extra_kwargs: | ||
expected: data/results/{scheme}.{expected}.json | ||
verifier_key: data/keys/verifier.jwk | ||
|
||
- name: verify as relying party - deleting the session object | ||
request: | ||
method: DELETE | ||
url: http://{verification-service}/challenge-response/v1/{relying-party-session} | ||
response: | ||
status_code: 204 |
This file contains 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
This file contains 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
This file contains 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
This file contains 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