-
Notifications
You must be signed in to change notification settings - Fork 564
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
Verify the certificate chain against the Fulcio root trust by default #2139
Conversation
I have two things to discuss:
|
Signed-off-by: Kazuma Watanabe <[email protected]>
d43c022
to
ce81d79
Compare
Codecov Report
@@ Coverage Diff @@
## main #2139 +/- ##
==========================================
- Coverage 26.28% 26.23% -0.06%
==========================================
Files 130 130
Lines 7602 7617 +15
==========================================
Hits 1998 1998
- Misses 5347 5362 +15
Partials 257 257
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same changes need to be made in https://cs.github.com/sigstore/cosign/blob/c5fda01a8ff33ca981f45a9f13e7fb6bd2080b94/cmd/cosign/cli/verify/verify_attestation.go?q=org%3Asigstore+CheckCertificatePolicy#L141 and https://cs.github.com/sigstore/cosign/blob/95b74db89941e8ec85e768f639efd4d948db06cd/cmd/cosign/cli/verify/verify.go?q=org%3Asigstore+CheckCertificatePolicy#L162
Testing is unfortunately a bit rough. Check out |
/hold, I want to give a bit more thought to this and will get back to you on Monday. cc @znewman01 |
…default Signed-off-by: Kazuma Watanabe <[email protected]>
…ust by default Signed-off-by: Kazuma Watanabe <[email protected]>
Fixed eda267b
Understood. I'll take a little deeper look at the |
Hey, thanks for this! (and thanks for looping me in, @haydentherapper) I haven't looked too closely at the code but this change seems like much better/safer default behavior. I just want to think through workarounds for anyone who was relying on the old behavior. The right thing to do in such a case is probably to provide the public key directly, rather than via a cert; this makes it much clearer what you're asking for. Maybe we should refer users to the Was there anything specific you wanted my feedback on? |
I'm probably mis-interpreting this, but for cases where the user has signed a blob with a user provided custom key, why would we want to verify against the fulcio root? |
@znewman01 Just looking for a second opinion! Generally this looked good to me, beyond the potentially breaking change. @patflynn One thought is a user is very unlikely to provide a certificate in that case (I think), they'd be providing a key. We've got a few options for providing verification material:
The workaround would either be extracting the key themselves (Like Zach mentioned) or providing the full certificate chain. |
@haydentherapper got it. that makes sense. Thanks for clarifying. |
@@ -37,7 +37,7 @@ var _ Interface = (*RekorOptions)(nil) | |||
// AddFlags implements Interface | |||
func (o *CertVerifyOptions) AddFlags(cmd *cobra.Command) { | |||
cmd.Flags().StringVar(&o.Cert, "certificate", "", | |||
"path to the public certificate") | |||
"path to the public certificate. The certificate will be verified against the Fulcio roots if the --certificate-chain option is not passed.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Fulcio root provided in the TUF root?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't mention it to TUF here because I have a concern about the description would be too long. If we should mention it, please let me know so I fix it.
LGTM, just need to fix the failing test. Thanks! |
The failure is unrelated and the fix is over here: sigstore/scaffolding#277 |
I'll merge while we wait for the fix. |
Summary
See #2134
Currently, the verification performed by
cosign verify-blob --cert
does not verify the certificate chain, so you cannot guarantee that the certificate was correctly issued by Fulcio. So you need to explicitly pass Fulcio's root certificate via the--cert-chain
option.However, this way of getting root certificates is not secure. Ideally, it should be retrieved by a TUF client. After discussing this matter in #2134, @haydentherapper says that there is room for changing the default behavior.
This PR will change the default behavior from not verifying the certificate chain if
--cert-chain
is not passed to verifying the certificate chain against the Fulcio root trust getting by a TUF client.Release Note
--cert-chain
is not passed to verifying the certificate chain against the Fulcio root trust getting by a TUF client.Documentation
--certificate
option needs to be changed.