Conversation
7fe70e2 to
c2a8440
Compare
|
@Hayden-IO Just removing the check for the certificate chain here seems a bit too permissive. This could potential have effects for clients using a PGI-like deployment (such as GitHub) which operates under the same semantics. However, I still don't think this would work as IIRC chain building ignores what's in the bundle, it only relies on the intermediates from the bundle: sigstore-go/pkg/root/certificate_authority.go Lines 47 to 50 in 3f2ee9e |
|
+1 to @kommendorkapten, I agree this is too permissive. I'd be open to some sort of a policy flag that allows this check to be bypassed when set explicitly by the calling library, though off the top of my head I'm not sure the best way to cleanly do this. |
@Hayden-IO and @kommendorkapten pushed an update to support passing verification options through the bundle. If we want this to be opt-in, we’d need a corresponding change in cosign to add a flag through cosign for verification (e.g. cosign verify \
--insecure-ignore-tlog \
--insecure-ignore-sct \
--check-claims=true \
--certificate-identity example.com \
--certificate-oidc-issuer-regexp ".*" \
--trusted-root trusted-roots.json \
--new-bundle-format \
--use-signed-timestamps \
--experimental-oci11 \
--allow-certificate-chain \
{OCI IMAGE} |
|
Sorry for a late response but having an explicit parameter |
|
LGTM to this approach as well. I've asked @yangkenneth to file an issue on sigstore/sigstore-conformance to start the discussion with other clients about whether or not we want this standardized across clients. |
woodruffw
left a comment
There was a problem hiding this comment.
I'm not a maintainer of sigstore-go so my opinion isn't binding here, but IMO this would be a problematic addition: it effectively punches a hole in the v2/v3 bundle distinction for a use case that is best solved by using the v2 bundle format directly (since it isn't deprecated or obsolete, and is intended for this kind of X.509 topology).
(xref sigstore/sigstore-conformance#342 (comment) for related)
Appreciate the insight @woodruffw; the blocker that I originally ran into was because the current release for cosign does not allow bundle versions under v0.3. This seems to leave us with a few potential paths forward:
Would appreciate hearing both your and @Hayden-IO's opinions here on what the best path forward is. |
|
Yeah, I think option 1 probably makes the most sense.
This would effectively be a significant semantic change, which IMO would mean it would need to be v4 instead of v3. The protobuf-specs themselves also don't proscribe things like opt-in flags, so I think this would be a bit of a mismatch. |
|
I'm going to move the conversation back over to conformance to make sure we can get some of the other clients to chime in as well, we'll hold off on making changes to sigstore-go until we have some consensus. |
|
@yangkenneth Would you be able to make the update to sigstore/cosign#4614 that demonstrates how this will be used? It'd be helpful to review both this PR and Cosign at the same time. You can temporarily As discussed in the client meeting, we'll allow this with the proposed flag. |
f514db4 to
698232f
Compare
|
@yangkenneth just let me know when this PR and the Cosign PR are ready for review! |
Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>
Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>
Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>
Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>
Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>
Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>
Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>
Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>
f0661d0 to
80344ca
Compare
@Hayden-IO ready for a review whenever you have capacity; have the associated changes in sigstore/cosign#4614 which should work if you replace the sigstore-go package with this build. Let me know if you have any questions but thanks again for the help here! |
| if err != nil { | ||
| return nil, ErrValidationError(err) | ||
| } | ||
| if intermediate.IsCA { |
There was a problem hiding this comment.
We should have a check here to not include root certificates (self signed) as that's prohibited by the spec. Possibly even reject the bundle. What do you think @Hayden-IO ?
There was a problem hiding this comment.
+1 to rejecting the bundle if it includes self-signed certificates.
There was a problem hiding this comment.
Made some changes where during the generation of the bundle we fail if a self-signed certificate exists but during verification we ignore based on the protobuf-spec to maintain backwards compatibility.
| if opts.CertificateProvider != nil { | ||
| switch { | ||
| case opts.CertificateChainProvider != nil: | ||
| certificateChain, err := opts.CertificateChainProvider.GetCertificateChain(opts.Context, keypair, opts.CertificateProviderOptions) |
There was a problem hiding this comment.
Are we sure here that the root cert is not included?
There was a problem hiding this comment.
The provider returns the full certificate chain, but based on the protobuf-spec and the points you and @Hayden-IO raised where we should not include any self-signed CA within the bundle I've added a check to support this pattern.
| chains, err := ca.Verify(leafCert, observerTimestamp) | ||
| caToVerify := ca | ||
| if fca, ok := ca.(*root.FulcioCertificateAuthority); ok && len(intermediates) > 0 { | ||
| withIntermediates := *fca |
There was a problem hiding this comment.
nit but this assignment feels unnecessary?
Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>
|
@Hayden-IO @kommendorkapten made some updates based on the feedback, seeing if you al have another change to review so we can get this pushed through. Thanks! |
kommendorkapten
left a comment
There was a problem hiding this comment.
Looks good, thanks! Waiting for @Hayden-IO to take a look as well.
Hey @Hayden-IO 👋 just bumping this if you have some time to review, thanks! |
|
yep, it's on my plate, sorry for the delay! will look before eow |
Hayden-IO
left a comment
There was a problem hiding this comment.
Appreciate the patience in getting this reviewed! Just a few small comments, otherwise LGTM. Can you also rebase?
| if err != nil { | ||
| return nil, ErrValidationError(err) | ||
| } | ||
| if intermediate.IsCA && !verify.IsSelfSigned(intermediate) { |
There was a problem hiding this comment.
Should this check throw an error rather than silently skip the certificate? Otherwise, an invalid chain might be constructed.
| @@ -0,0 +1,27 @@ | |||
| // Copyright 2023 The Sigstore Authors. | |||
There was a problem hiding this comment.
| // Copyright 2023 The Sigstore Authors. | |
| // Copyright 2026 The Sigstore Authors. |
| return nil, errors.New("leaf certificate verification failed") | ||
| } | ||
|
|
||
| func IsSelfSigned(certificate *x509.Certificate) bool { |
There was a problem hiding this comment.
Can this function be under internal in a new package? Want to avoid exporting any additional functions.
Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>
Thanks for the review @Hayden-IO! Addressed your comments (08626ba) and tested the changes as well. |
| } | ||
| // protobuf-specs does not allow signers to include self-signed certificates, | ||
| // but allows verifiers to tolerate non-compliant bundles for backwards compatibility. | ||
| if certificate.IsSelfSigned(intermediate) { |
There was a problem hiding this comment.
Why should this not return an error as well?
There was a problem hiding this comment.
If I recall correctly v0.2 and older bundles can contain self-signed certificates within the protobuf bundle. Only within v0.3 did the requirements tighten and self-signed certificates cannot be included within the bundle during the signing process.
If we have an enforcement where allowCertificateChain can only be used for v0.3+ then throwing an error here should be fine, otherwise I added this for backwards compatibility in case older versions can use this path as well. Let me know if you want me to add an explicit error here since the expectation should be that we use this verification path for v0.3+ bundle versions.
There was a problem hiding this comment.
Self-signed would be fine but only if it were at the end of the chain, which is what the comment was referring to iirc. One of the related issues is that the trust root chain really shouldn't be a chain, it should be a bundle of certificates with chain building being the responsibility of the verification library, not the client's responsibility, at which point we could just skip over superfluous certs.
Anywho, let's constrain this just for v0.3+, since that is the current bundle revision and what the current library will only produce. We can revisit this if it comes up that someone wants to use an older version, though I doubt it will.
There was a problem hiding this comment.
Sounds good! Added the enforcement and validation check c5fd166 👍
Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>
Hayden-IO
left a comment
There was a problem hiding this comment.
Thanks for all your work on this! Will get the Cosign change in much faster.
|
@woodruffw Did you have anything you wanted to add, since you had left a review? |
|
@Hayden-IO @kommendorkapten thank you both for the reviews and getting this through! Would it be possible to cut out a new release so I can reference this version within the follow-up |
|
yep, will cut v1.2.2 momentarily. feel free to use the latest commit hash for now in the pr |
Summary
--allow-certificate-chainflag we load the Intermediate Certificate Authorities that are exist within the Sigstore bundle to establish the Trust Store.cosign verify \ --insecure-ignore-tlog \ --insecure-ignore-sct \ --check-claims=true \ --certificate-identity example.com \ --certificate-oidc-issuer-regexp ".*" \ --trusted-root trusted-roots.json \ --new-bundle-format \ --use-signed-timestamps \ --experimental-oci11 \ {OCI IMAGE} WARNING: Skipping tlog verification is an insecure practice that lacks transparency and auditability verification for the signature. Error: no signatures found error during command execution: no signatures foundcosign verify \ --insecure-ignore-tlog \ --insecure-ignore-sct \ --check-claims=true \ --certificate-identity example.com \ --certificate-oidc-issuer-regexp ".*" \ --trusted-root trusted-roots.json \ --new-bundle-format \ --use-signed-timestamps \ --experimental-oci11 \ --allow-certificate-chain \ {OCI IMAGE} The following checks were performed on each of these signatures: - The cosign claims were validated - Existence of the claims in the transparency log was verified offline - The code-signing certificate was verified using trusted certificate authority certificatesRelease Note
Documentation