Skip to content

feat: add RATSD token library V1 #68

Open
cowbon wants to merge 5 commits into
mainfrom
ratsd-token-v2-pr
Open

feat: add RATSD token library V1 #68
cowbon wants to merge 5 commits into
mainfrom
ratsd-token-v2-pr

Conversation

@cowbon

@cowbon cowbon commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add token version 1 support
  • add unit tests for token generation, token decoding

Testing

  • GOFLAGS=-mod=mod go test ./...

@thomas-fossati thomas-fossati left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work! I have left a couple of comments inline.

I am slightly confused about how this relates to #65?

Comment thread api/server.go Outdated
Comment thread docs/api/ratsd.yaml Outdated
Comment thread tokens/ratsd.go Outdated

@yogeshbdeshpande yogeshbdeshpande left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some fundamental changes required, before we can proceed with this...

Comment thread tokens/ratsd.go Outdated
return nil, err
}

key, err := loadPrivateKey(keyPath)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not clear why you are assuming a private key to be loaded from a path. In fact, we should provide a method to share the Leaf Certificate and Certificate Chain to be added into the Header.

We need an API to provide a signer to the Evidence Collection

@cowbon cowbon Apr 24, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @yogeshbdeshpande, thanks for the review. I wonder when you said we need an API to provide the signer, does it mean to a POST method to upload the certificate chain to ratsd, or it's something else? Currently, this PR use a x509 certificate from the path to sign the CBOR

@cowbon cowbon Apr 25, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just revisited the ratsd-token branch you're working on, and it seems you prefer to use go-cose to do the signing. But it's still ratsd to provide the certificates and call go-cose to sign it. As mentioned earlier, should we provide a new API to set the certificates for signing? Also, the format of Evidence defined in your commit WIP: token code look different from docs/ratsd-token.cddl, while this PR is simply derived from what Thomas put in the CDDL.

I appreciate the token library you're working on, but this PR has a different purpose. Once it's ready, we can rework on this PR to have it based on token library you are going to add.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure let us proceed now. I will review it one more time...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Yogesh, can you check if the most recent change is on the right track. If so, we might start from there and match against the requirements mentioned in #65

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cowbon : This is a good start but we want a separate folder and a new package separate from existing tokens, which could the package for individual tokens such as tsm etc.

As a result, I have moved the code base to the new folder known as ratsd-token

Let us evolve their and it is fine, to use this branch.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK the tokens.tsm is also used by Services to support SEV-SNP. With this PR, as both ratsd-token.Evidence and tokens.tsm are used publicly, I'm not sure if it's still worth to separate it out.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cowbon We need a new package for overall new token, which should be seperate from the other tokens fetched by RATSD. We can discuss this when you are back from holidays!

@cowbon cowbon force-pushed the ratsd-token-v2-pr branch 2 times, most recently from b243fd3 to bda8555 Compare April 24, 2026 16:36
@cowbon cowbon requested a review from yogeshbdeshpande May 9, 2026 23:11
@yogeshbdeshpande

Copy link
Copy Markdown
Contributor

I have added more logic to how we should insert a Claim as UCCS inside RATSD/V2 token
Have a look at:

6393ec4

cowbon and others added 5 commits May 11, 2026 20:59
Signed-off-by: Ian Chin Wang <ian.chin.wang@oracle.com>
Signed-off-by: Ian Chin Wang <ian.chin.wang@oracle.com>
Add a reusable Evidence builder for RATSD tokens with go-cose based signing, verification, and unmarshaling.

Refactor /ratsd/chares to use the new builder while preserving the existing legacy and v2 wire formats and their test coverage.

Signed-off-by: Ian Chin Wang <ian.chin.wang@oracle.com>
Signed-off-by: Yogesh Deshpande <yogesh.deshpande@arm.com>
Signed-off-by: Yogesh Deshpande <yogesh.deshpande@arm.com>
@cowbon cowbon force-pushed the ratsd-token-v2-pr branch from 15a8919 to 8d3748e Compare May 12, 2026 01:15
@yogeshbdeshpande

Copy link
Copy Markdown
Contributor

The V2 API will follow from branch: https://github.com/veraison/ratsd/commits/ratsd-token/
For V2 we will create another Pull Request (from the branch: ratsd-token).

The V1 API will be developed using this PR , i.e PR #681

@yogeshbdeshpande yogeshbdeshpande changed the title feat: add signed RATSD token v2 responses feat: add RATSD token library V1 May 19, 2026
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.

3 participants