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

Remove SHA256 assumption in sign-blob/verify-blob #4050

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

ret2libc
Copy link
Contributor

@ret2libc ret2libc commented Feb 6, 2025

Summary

See #3271 .

Release Note

  • Use sigstore/sigstore signature.LoadSignerVerifierFromPrivateKey to load default verifiers given a private key.

Documentation

@ret2libc ret2libc requested review from a team as code owners February 6, 2025 16:19
@ret2libc
Copy link
Contributor Author

ret2libc commented Feb 6, 2025

cc @haydentherapper

Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 40.93567% with 101 lines in your changes missing coverage. Please review.

Project coverage is 36.56%. Comparing base (2ef6022) to head (1bc2269).
Report is 341 commits behind head on main.

Files with missing lines Patch % Lines
pkg/cosign/keys.go 35.71% 33 Missing and 3 partials ⚠️
cmd/cosign/cli/sign/sign_blob.go 43.75% 21 Missing and 6 partials ⚠️
cmd/cosign/cli/sign/sign.go 14.28% 18 Missing ⚠️
pkg/cosign/tlog.go 46.15% 14 Missing ⚠️
...cosign/cli/fulcio/fulcioverifier/fulcioverifier.go 0.00% 3 Missing ⚠️
pkg/signature/keys.go 71.42% 2 Missing ⚠️
internal/pkg/cosign/common.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4050      +/-   ##
==========================================
- Coverage   40.10%   36.56%   -3.54%     
==========================================
  Files         155      210      +55     
  Lines       10044    13557    +3513     
==========================================
+ Hits         4028     4957     +929     
- Misses       5530     7975    +2445     
- Partials      486      625     +139     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ret2libc ret2libc marked this pull request as draft February 7, 2025 17:14
@ret2libc
Copy link
Contributor Author

ret2libc commented Feb 7, 2025

I'm going to add a few tests to this.

@ret2libc ret2libc force-pushed the use-load-options branch 2 times, most recently from 958259e to 753bfc0 Compare February 11, 2025 11:03
@ret2libc ret2libc marked this pull request as ready for review February 11, 2025 11:03
@ret2libc ret2libc marked this pull request as draft February 13, 2025 11:02
@haydentherapper
Copy link
Contributor

What do you think about limiting this to code under the --new-bundle-format flag, where VerifyBundle is called? Then most changes only need to occur in sigstore-go, we won't have to be concerned about unexpectedly breakages for current users, and we know the code will carry on to cosign 3.x.

@ret2libc
Copy link
Contributor Author

What do you think about limiting this to code under the --new-bundle-format flag, where VerifyBundle is called? Then most changes only need to occur in sigstore-go, we won't have to be concerned about unexpectedly breakages for current users, and we know the code will carry on to cosign 3.x.

Sounds good, but we still want to modify the "sign"/"sign-blob" flow, don't we? At least to test the signing process through cosign and then the verification process in the new bundle format, correct?

@haydentherapper
Copy link
Contributor

The sign-blob flow, yes, where we also use the new-bundle-format flag. We don’t have to include sign at the moment since we don’t yet support the new bundle format.

Copy link
Contributor

@haydentherapper haydentherapper left a comment

Choose a reason for hiding this comment

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

Reviewed this for the Fulcio PR. This LGTM and I realize my comment about sign-blob isn't immediately relevant as we need to make all these changes first.

Algorithm: swag.String(models.HashedrekordV001SchemaDataHashAlgorithmSha256),
needs to be updated as well.

@haydentherapper
Copy link
Contributor

If we do the Fulcio change to accept ecdsa-p384-sha-384 and ecdsa-p521-sha-512, I'd add an end-to-end test that verifies signing and verification with these keys. You can generate a key, import it into the Cosign key format, then sign with IssueCertificate:true.

@ret2libc ret2libc requested a review from haydentherapper March 5, 2025 08:36
@ret2libc ret2libc changed the title Add support for passing different SignerVerifier LoadOptions Remove SHA256 assumption in sign-blob/verify-blob Mar 5, 2025
@ret2libc ret2libc marked this pull request as ready for review March 12, 2025 15:56
@ret2libc
Copy link
Contributor Author

@haydentherapper could you approve the workflows please?

Copy link
Contributor

@haydentherapper haydentherapper left a comment

Choose a reason for hiding this comment

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

Overall LGTM

Signed-off-by: Riccardo Schirone <riccardo.schirone@trailofbits.com>
Signed-off-by: Riccardo Schirone <riccardo.schirone@trailofbits.com>
Signed-off-by: Riccardo Schirone <riccardo.schirone@trailofbits.com>
Signed-off-by: Riccardo Schirone <riccardo.schirone@trailofbits.com>
Signed-off-by: Riccardo Schirone <riccardo.schirone@trailofbits.com>
Signed-off-by: Riccardo Schirone <riccardo.schirone@trailofbits.com>
Signed-off-by: Riccardo Schirone <riccardo.schirone@trailofbits.com>
Signed-off-by: Riccardo Schirone <riccardo.schirone@trailofbits.com>
Signed-off-by: Riccardo Schirone <riccardo.schirone@trailofbits.com>
Signed-off-by: Riccardo Schirone <riccardo.schirone@trailofbits.com>
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.

2 participants