Skip to content
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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Add attester specific option support #40

wants to merge 6 commits into from

Conversation

cowbon
Copy link
Collaborator

@cowbon cowbon commented Mar 13, 2025

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

"nonce": "base64urlencoded",

  "attester-selection": {
    "attester-id-1": {
      "param11name": "param11value",
      "param12name": "param12value"
    },
    "attester-id-2": {
      "param21name": "param21value"
    },
  }

The selection of what goes into the EAT, however, is beyond the scope of this PR, and will be added soon.

cowbon added 6 commits March 10, 2025 23:50
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]>
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]>
Copy link
Contributor

@thomas-fossati thomas-fossati left a 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)
Copy link
Contributor

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),
Copy link
Contributor

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),
Copy link
Contributor

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"
		}
	}`)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants