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

Token not specified in kbs_types #682

Closed
tylerfanelli opened this issue Jan 30, 2025 · 7 comments
Closed

Token not specified in kbs_types #682

tylerfanelli opened this issue Jan 30, 2025 · 7 comments

Comments

@tylerfanelli
Copy link
Contributor

tylerfanelli commented Jan 30, 2025

The token returned by the kbs/attest endpoint is not defined in kbs_types. It is defined in the guest_components repository, however.

For clients looking to avoid having to use that repository, a similar definition for Token (or some standardization of what a token actually contains, rather than just three separate base64-encoded strings that are comma separated) with serde::{Deserialize, Serialize} in kbs_types would be useful.

@mythi
Copy link
Contributor

mythi commented Jan 30, 2025

(or some standardization of what a token actually contains, rather than just three separate base64-encoded strings that are comma separated)

The token returned is a JSON Web Token.

@tylerfanelli
Copy link
Contributor Author

tylerfanelli commented Jan 30, 2025

(or some standardization of what a token actually contains, rather than just three separate base64-encoded strings that are comma separated)

The token returned is a JSON Web Token.

Thanks for clarifying.

Will a JWK be the only response every found in the /attest endpoint? If so, it may be able to return something that implements serde::{Deserialize, Serialize} like so:

AttestationResponse {
    token: Jwk,
}

You can then sync the response expected between client and server with a shared type. I'm trying to avoid the case where something changes on server side that isn't subsequently changed in client.

Just a suggestion. If the only response ever from the server is a JWK (and is expected to stay that way) then I guess this can be worked around.

@Xynnn007
Copy link
Member

Xynnn007 commented Feb 5, 2025

There are some things that are not explicitly mentioned in the protocol documentation, but are present in the code implementation.

The actual communication steps in code is

  1. Client sends Request to KBS
  2. KBS response Challenge to Client
  3. Client sends Attestation to KBS based on Challenge
    4. KBS returns a thing to Client. This thing is not defined in the document and now a plaintext of JWT in implementation.
  4. KBS replies to that request with an Attestation Results Token.
  5. Client requests for a resource.
  6. KBS returns the resource in Response shape (JWE).

I suppose that you are thinking of what step 4 returns.

The KBS protocol is designed for generic remote attestation requests, which means that the response it ultimately returns does not necessarily have to be an Attestation Token; it could be anything else. Therefore, I don't really recommend adding this specific implementation to the kbs-types library. It still can be anything. wdyt?

@mythi
Copy link
Contributor

mythi commented Feb 5, 2025

4. KBS returns a thing to Client. This thing is not defined in the document and now a plaintext of JWT in implementation.

It is: "If the attestation was successful, the KBS replies to that request with an Attestation Results Token."

@tylerfanelli
Copy link
Contributor Author

So because it's defined, should it be included? Or do you still feel the same way, that it should be left up to user?

@Xynnn007

@Xynnn007
Copy link
Member

Xynnn007 commented Feb 6, 2025

I prefer to leave to user. Now the core logic of the protocol is

  1. return an endorsed public share of a tee key. Now it is in an attestation token (JWT)'s claims
  2. Use the endorsed tee key to encrypt the secret from KBS.

So it doesn't matter what form the public key is returned in. This means that users can define how to return the public key used to encrypt resources. They can return it directly, or they can embed the key in the Attestation Token like the current KBS, or any way else.

@tylerfanelli
Copy link
Contributor Author

Sounds good, thanks. Closed.

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

No branches or pull requests

3 participants