-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a mock config-TSM sub-attester #39
base: main
Are you sure you want to change the base?
Conversation
Endpoint chares now gathers the output of GetEvidence() from each sub-attesters, combines them into a CMW collection, and wrap it as an EAT in its response. If there are multiple supported format available from a sub-attesters, ratsd core picks the first available format from GetSupportedFormats() Signed-off-by: Ian Chin Wang <[email protected]>
Add MockTSM attester as the wrapper of the faketsm from google/go-configfs-tsm repo to enable mock mode Signed-off-by: Ian Chin Wang <[email protected]>
Signed-off-by: Ian Chin Wang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Find a couple of tiny comments inline.
) | ||
|
||
const ( | ||
mediaType = "application/vnd.veraison.mock-tsm+json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be the “usual” configfs-tsm media type.
The “provider” field in the JSON will be set to “fake” (or whatever) :-)
|
||
outEncoded, err := out.ToJSON() | ||
if err != nil { | ||
errMsg := fmt.Errorf("failed to get mock TSM report: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errMsg := fmt.Errorf("failed to get mock TSM report: %v", err) | |
errMsg := fmt.Errorf("failed to JSON encode mock TSM report: %v", err) |
return getEvidenceError(errMsg) | ||
} | ||
|
||
if in.ContentType == mediaType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid nesting long pieces of logic. Please invert the condition and fail early.
Fix #26