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

[Signature discovery] Add a signature interface and a library to parse signature from image manifest #328

Merged
merged 3 commits into from
Aug 16, 2023

Conversation

yawangwang
Copy link
Collaborator

@yawangwang yawangwang commented Jul 5, 2023

Adding a signature interface and a cosign library that implements the interface to parse cosign-generated signature from OCI image manifest.

@google-cla
Copy link

google-cla bot commented Jul 5, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@yawangwang yawangwang force-pushed the parse-manifest branch 3 times, most recently from f5fd631 to 1b6d63e Compare July 8, 2023 08:24
@yawangwang yawangwang force-pushed the parse-manifest branch 2 times, most recently from e23b2e5 to 2a678b0 Compare July 14, 2023 23:54
@yawangwang yawangwang marked this pull request as ready for review July 14, 2023 23:55
@yawangwang yawangwang force-pushed the parse-manifest branch 2 times, most recently from e8be08b to 815dbde Compare July 29, 2023 00:33
@yawangwang yawangwang changed the title [Signature discovery] Add a signature interface and a library to parse signing materials from OCI image object [Signature discovery] Add a signature interface and a library to parse signature from image manifest Jul 29, 2023
launcher/internal/oci/interface.go Outdated Show resolved Hide resolved
launcher/internal/oci/interface.go Show resolved Hide resolved
launcher/internal/oci/interface.go Outdated Show resolved Hide resolved
launcher/internal/oci/cosign/signature.go Show resolved Hide resolved
@yawangwang yawangwang force-pushed the parse-manifest branch 2 times, most recently from 5de8d9b to 4664c9a Compare August 1, 2023 00:11
Copy link
Contributor

@jkl73 jkl73 left a comment

Choose a reason for hiding this comment

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

lgtm

launcher/internal/oci/cosign/signature.go Show resolved Hide resolved
launcher/internal/oci/cosign/signature.go Outdated Show resolved Hide resolved
launcher/internal/oci/interface.go Show resolved Hide resolved

const (
// RSASSAPSS2048SHA256 is RSASSA-PSS 2048 bit key with a SHA256 digest supported for cosign sign.
RSASSAPSS2048SHA256 SigningAlgorithm = "RSASSA_PSS_2048_SHA256"
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this match our API enum (google.cloud.confidentialcomputing.v1main.SigningAlgorithm)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, our API enum does not specify bit length for a RSA public key. Since the current implementations use Tink to verify signatures and Tink only accepts at least 2048 bit key, I think it would be good to imply this length restriction from the naming. But to align with our API enum, we can keep the naming but change the value to RSASSA_PSS_SHA256. Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

I actually was wondering about the other direction: should we update/change our API enum? It's confusing to put the key size here but not in the API

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For RSA keys generated by all cloud KMS providers, the bit length is at least 2048. For RSA keys generated by openssl, the bit length is by default 2048. So IMO maybe we don't actually have to update our API enums for this? We can provide a good documentation specifying the bit length restriction. Plus client side will get verification errors from attestation service if the key length is less than 2048.

launcher/internal/oci/cosign/signature.go Show resolved Hide resolved
launcher/internal/oci/cosign/signature.go Outdated Show resolved Hide resolved
launcher/internal/oci/cosign/signature.go Outdated Show resolved Hide resolved
launcher/internal/oci/cosign/signature.go Show resolved Hide resolved
launcher/internal/oci/cosign/signature.go Outdated Show resolved Hide resolved

func TestFetchImageSignaturesDockerPublic(t *testing.T) {
ctx := namespaces.WithNamespace(context.Background(), "test")
originalImageDesc := v1.Descriptor{Digest: "sha256:905a0f3b3d6d0fb37bfa448b9e78f833b73f0b19fc97fed821a09cf49e255df1"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the codelab project make this repo public? Otherwise, the test will fail for someone without permissions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this repo only grants roles/artifactregistry.reader permission to all users, so it is a public accessible repo.


const (
// RSASSAPSS2048SHA256 is RSASSA-PSS 2048 bit key with a SHA256 digest supported for cosign sign.
RSASSAPSS2048SHA256 SigningAlgorithm = "RSASSA_PSS_2048_SHA256"
Copy link
Contributor

Choose a reason for hiding this comment

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

I actually was wondering about the other direction: should we update/change our API enum? It's confusing to put the key size here but not in the API

@yawangwang yawangwang merged commit 9e1f35d into google:master Aug 16, 2023
yawangwang added a commit to yawangwang/go-tpm-tools that referenced this pull request Aug 16, 2023
Revert "Decrease MaxElapsedTime for retry backoff in tests (google#337)" (google#341)

This reverts commit 4a3d6e7.
This commit has made our CI flakey, and we do not need to enable this
test internally in g3.

[Signature discovery] Add a signature interface and a library to parse signature from image manifest (google#328)

* Adding a signature interface and its implementations to parse cosign-generated signatures from OCI image object

Integrate signature discovery client into attestation agent
alexmwu added a commit to alexmwu/go-tpm-tools that referenced this pull request Sep 15, 2023
New Features:
[launcher] Verify FS and mount before launch google#311
Integration of go-tpm-tools with go-tdx-guest google#347

Intra-version Breaking Changes:
Add launcherfile package for path and file consts google#356 breaks google#333
Bug Fixes:
[launcher] Update the token refresh logic google#325
[launcher] Fix logging blocking issue google#338

Other Changes:
[launcher] Add a new metadata flag of signedImageRepos google#320
Update go-sev-guest to v0.7.0 google#329
[launcher] Add SSH test for image. google#314
Add supported architectures to ci.yml google#330
Fix the go version number error google#326
[launcher] Signature discovery: fetch a signed image manifest at for parsing google#324
[launcher] Export attestation token filepath and filename google#333
[launcher] Increase the max file descriptor google#339
[launcher] Add a signature interface and a library to parse signature from image manifest google#328
Rename TdxVerify function to TdxQuote in server package. google#353
[launcher] Use V1 SDK in launcher verifier client google#305
Update and tidy dependencies google#344
@alexmwu alexmwu mentioned this pull request Sep 15, 2023
alexmwu added a commit that referenced this pull request Sep 15, 2023
New Features:
[launcher] Verify FS and mount before launch #311
Integration of go-tpm-tools with go-tdx-guest #347

Intra-version Breaking Changes:
Add launcherfile package for path and file consts #356 breaks #333
Bug Fixes:
[launcher] Update the token refresh logic #325
[launcher] Fix logging blocking issue #338

Other Changes:
[launcher] Add a new metadata flag of signedImageRepos #320
Update go-sev-guest to v0.7.0 #329
[launcher] Add SSH test for image. #314
Add supported architectures to ci.yml #330
Fix the go version number error #326
[launcher] Signature discovery: fetch a signed image manifest at for parsing #324
[launcher] Export attestation token filepath and filename #333
[launcher] Increase the max file descriptor #339
[launcher] Add a signature interface and a library to parse signature from image manifest #328
Rename TdxVerify function to TdxQuote in server package. #353
[launcher] Use V1 SDK in launcher verifier client #305
Update and tidy dependencies #344
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.

4 participants