Skip to content

cliplugin: add VerifySignature#1944

Merged
bobcallaway merged 29 commits intosigstore:mainfrom
ramonpetgrave64:ramonpetgrave64-kms-plugin-cli-verifysignature
Jan 29, 2025
Merged

cliplugin: add VerifySignature#1944
bobcallaway merged 29 commits intosigstore:mainfrom
ramonpetgrave64:ramonpetgrave64-kms-plugin-cli-verifysignature

Conversation

@ramonpetgrave64
Copy link
Copy Markdown
Contributor

Summary

Adds the VerifySignature method.

Release Note

Adds the VerifySignature method.

Documentation

No new documentation.

Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
@ramonpetgrave64 ramonpetgrave64 marked this pull request as ready for review January 24, 2025 22:54
@ramonpetgrave64
Copy link
Copy Markdown
Contributor Author

@haydentherapper @loosebazooka

Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
}

// VerifyOptions contains the values for signature.VerifyOption.
type VerifyOptions struct {
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.

What is the motivation for defining another structure? Can we just have an Options structure with common options?

Copy link
Copy Markdown
Contributor Author

@ramonpetgrave64 ramonpetgrave64 Jan 27, 2025

Choose a reason for hiding this comment

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

We could, but then the JSON schema would also change, making things a bit more complicated for plugin authors of other languages that would need to parse the json objects directly.

In case that we add or remove any options, some options might no longer be common, but belong in other opts structs. keeping the opts separate minimizes that breakage, and I think keeps things simpler for sigstore maintainers.

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.

OK, I see you're mirroring the existing APIs as well.

Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Hayden-IO
Hayden-IO previously approved these changes Jan 27, 2025
}

// VerifyOptions contains the values for signature.VerifyOption.
type VerifyOptions struct {
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.

OK, I see you're mirroring the existing APIs as well.

// VerifyOptions contains the values for signature.VerifyOption.
type VerifyOptions struct {
RPCOptions RPCOptions `json:"rpcOptions"`
MessageOptions MessageOptions `json:"messageOptions"`
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.

To confirm, if I want to verify an object without passing its digest, this is passed over stdin?

Copy link
Copy Markdown
Contributor Author

@ramonpetgrave64 ramonpetgrave64 Jan 27, 2025

Choose a reason for hiding this comment

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

Yes. The message is the object to be verified, and it's sent to invokePlugin() as stdin.

DefaultAlgorithm: &DefaultAlgorithmResp{DefaultAlgorithm: "any-algo"},
CreateKey: &CreateKeyResp{PublicKeyPEM: []byte("mypem")},
SignMessage: &SignMessageResp{Signature: []byte("any-signature")},
DefaultAlgorithm: &DefaultAlgorithmResp{DefaultAlgorithm: testAlgorithm},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I feel like this test should test closer to what's expected rather than one big chunk? Can we split it in to parameterized testcases within this test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed.

opt.ApplyCryptoSignerOpts(&signerOpts)
}

if len(digest) == 0 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it's a bit confusing that the user can provide message or digest here. I would think it's one or the other?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

more specifically, I don't think the user should be able to specify both (because it could be error prone?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think I agree, but since the interface allows both, we have to respect that for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

alright, can we leave an issue open about this? I feel like if we're gonna muck with the API, now would be the time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

created #1949

Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
@bobcallaway bobcallaway merged commit dac6ce0 into sigstore:main Jan 29, 2025
9 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.

4 participants