-
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 attester specific option support #40
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]>
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]>
Add a way for users to specify attester-specific options in /chares endpoint. Each attesters is responsible for parsing the parameters. If the options are not supplied in the request, the attester should continue with the default options. Options specified for unavailable attesters are ignored by ratsd. Signed-off-by: Ian Chin Wang <[email protected]>
MockTSM now takes the support of options, only privilege_level is supported at this time. The schema is defined as the following: mocktsm:{"privilege_level": "$level"}. Replace $level with number 0-3 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.
Looks awesome! Again a few silly comments inlined that should be easy to fix.
if err != nil { | ||
errMsg := fmt.Sprintf( | ||
"failed to parse attester selection: %s", err.Error()) | ||
p := problems.NewDetailedProblem(http.StatusInternalServerError, errMsg) |
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 is a client error (4xx) rather than a server error (5xx)
in := &compositor.EvidenceIn{ | ||
ContentType: formatOut.Formats[0].ContentType, | ||
Nonce: nonce, | ||
Options: string(params), |
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.
The JSON raw message is a []byte, so there should be no need to wrap it into a string.
}{ | ||
{ | ||
"no params", | ||
fmt.Sprintf("{\"nonce\": \"%s\"}", validNonce), |
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.
You can avoid escaping by using "backtick-strings”:
testMetaValid = []byte(`{
"signer": {
"name": "ACME Ltd signing key",
"uri": "https://acme.example"
},
"validity": {
"not-before": "2021-12-31T00:00:00Z",
"not-after": "2025-12-31T00:00:00Z"
}
}`)
It's not a simple task to deal with exposing the custom options for each attester. This PR assumes the users will know the input format of each attester beforehand. The following is an example of the request with the options
The selection of what goes into the EAT, however, is beyond the scope of this PR, and will be added soon.