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 ContainerImageSignature type to verifier client #521

Merged
merged 3 commits into from
Jan 17, 2025
Merged

Conversation

jessieqliu
Copy link
Contributor

@jessieqliu jessieqliu commented Jan 2, 2025

OCI signatures are converted to a different structure in the Rest client for GCA. With the addition of ITA, we want to send a similar structure, so the conversion should be done at a higher level - the agent - rather than being verifier-specific.

The verifier client package will have its own ContainerSignature type - which contains only the fields that will be sent to verifier services - rather than using the full oci.Signature object.

fakesignature is also updated to remove implementations for PublicKey and SigningAlgorthm since the corresponding fakeverifier will use the new ContainerSignature type that lacks these methods. Instead, fakeverifier will parse the pubkey and sigalg from the payload - similar to how this is done in the actual verification process.

  • In verifier/client, VerifyAttestationRequest.ContainerImageSignatures type is changed from []ociSignature to []*ContainerSignature
  • In verifier/fake, verifyContainerImageSignature() is changed to extractClaims()
  • In verifier/oci/cosign/fakesignature, fakeSig.PublicKey() and fakeSig.SigningAlgorithm now return "not implemented" errors. Additionally, fakeSig.Payload() returns "f.data,f.sigAlg" rather than the data alone.
  • In verifier/rest, convertOCISignatureToREST is removed

@jessieqliu
Copy link
Contributor Author

/gcbrun

2 similar comments
@jessieqliu
Copy link
Contributor Author

/gcbrun

@jessieqliu
Copy link
Contributor Author

/gcbrun

@jessieqliu jessieqliu changed the title Move OCI signature conversion to agent Add ContainerImageSignature type to verifier client Jan 3, 2025
@jessieqliu jessieqliu requested review from jkl73 and yawangwang and removed request for jkl73 January 3, 2025 22:02
launcher/agent/agent.go Outdated Show resolved Hide resolved
Comment on lines 200 to 229
verifierSigs, err := convertToContainerSignatures(signatures)
if err != nil {
return nil, fmt.Errorf("error converting container signatures: %v", err)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The current behavior of converting sigs seems to return on error. However, this violates the previous behavior which is logging on error and sending any valid signature found to verifier. We don't want a single failure of conversion to break the entire signature verification process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Changed the conversion function to be for one signature (not the full list) and log/continue on error instead of returning.

@jessieqliu
Copy link
Contributor Author

/gcbrun

@jessieqliu jessieqliu enabled auto-merge (squash) January 17, 2025 18:29
@jessieqliu jessieqliu disabled auto-merge January 17, 2025 18:29
@jessieqliu
Copy link
Contributor Author

/gcbrun

@jessieqliu jessieqliu merged commit 0b0e421 into tdx_rtmr Jan 17, 2025
13 checks passed
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