feat(sign): support for keyless signing and offline verification#4891
feat(sign): support for keyless signing and offline verification#4891brandtkeller wants to merge 31 commits into
Conversation
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
…o 2805_keyless_signing
…tion Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
✅ Deploy Preview for zarf-docs canceled.
|
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
| #!/usr/bin/env bash | ||
| # Refresh the embedded Sigstore TrustedRoot used for keyless verification. | ||
| # Run before each release. Commit the result. | ||
|
|
There was a problem hiding this comment.
Making a mental note to schedule daily checks and notify the zarf channel using this process. A lag in releasing new trusted roots won't be critical but should be nice to have.
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
AustinAbro321
left a comment
There was a problem hiding this comment.
Excited how signing is taking shape, no doubt this will improve the UX
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
| ) | ||
|
|
||
| // GetCosignArtifacts returns signatures and attestations for the given image. | ||
| func GetCosignArtifacts(image string) ([]string, error) { |
There was a problem hiding this comment.
I kept this function in utils - it is not soo much a signing function as it is a helper for signature/attestation retrieval.
Co-authored-by: Austin Abro <37223396+AustinAbro321@users.noreply.github.com> Signed-off-by: Brandt Keller <43887158+brandtkeller@users.noreply.github.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
| // BundleInfo contains parsed metadata from a Sigstore bundle file. | ||
| type BundleInfo struct { | ||
| // Method is "keyless" for Fulcio-issued certificate bundles, "key" for public-key bundles. | ||
| Method string |
There was a problem hiding this comment.
nit: can we make this an enum
|
|
||
| // Keyless signatures require bundle format — the cert chain cannot be stored in the | ||
| // legacy .sig file. For key-based signing, respect the BundleSignature feature flag. | ||
| bundleEnabled := feature.IsEnabled(feature.BundleSignature) || opts.Keyless |
There was a problem hiding this comment.
nit: I think it makes more sense to error if the feature is not enabled and keyless is true. Probably doesn't matter much now that we're enabled by default, but that's the preferred pattern for the codebase imo
| // ReadKeylessIdentityFromBundle parses a Sigstore bundle file and returns the | ||
| // signer identity (cert SAN) and OIDC issuer claim. Returns an error if the | ||
| // bundle does not contain a certificate (i.e. is not a keyless signature). | ||
| func ReadKeylessIdentityFromBundle(bundlePath string) (identity, issuer string, err error) { |
There was a problem hiding this comment.
This function is not used
| // extractIdentityFromCert extracts the signer identity (cert SAN) and OIDC issuer | ||
| // from a Fulcio-issued X.509 certificate using Sigstore OID extensions. | ||
| // SAN priority: email > URI > DNS. OID priority: V2 > legacy. | ||
| func extractIdentityFromCert(cert *x509.Certificate) (identity, issuer string) { |
There was a problem hiding this comment.
I believe we can replace this function with github.com/sigstore/sigstore-go/pkg/fulcio/certificate.SummarizeCertificate
| if o.keyless && !cmd.Flags().Changed("tlog-upload") { | ||
| signOpts.TlogUpload = true | ||
| } |
There was a problem hiding this comment.
Is the current plan to support tsa using the same enable flag if keyless method? Cosign does use tsa by default and our default trusted root has the timestampAuthorities field
Description
Note - Breaking Changes
cosignfunctionality undersrc/pkg/utilshas been moved to `src/pkg/signingsigning.Sign|VerifyBlobOptionshave been updated to align with cosign.This PR enables the use of connected keyless signing workflows and offline-compatible verification for a keyless signed package via an embedded trusted root.
This uses the previously implemented
zarf tools trusted-root createcommand to refresh the embedded trusted root. Think of this as a mechanism to streamline the UX of enabling offline verification of keyless-signed packages so that users are not required to bring additional verification material by default - but of which they can overwrite as required.Additionally this PR enables the bundlesignature feature by default. Note that the
VersionRequirementfor a package with a bundle signature isv0.71.0which is the version that introduced the ability to load packages with the bundle file. The feature flag gates are retained such that users who cannot use the bundle still have an opportunity to opt-out until we fully remove.One early improvement is the UX of retrieving the keyless-signed identity and issuer. These are retrieved on
package signso that we can log the entries that package creators need to provide to those who want to verify - but additionally I believe we could add azarf package inspect signature <package>command to make this discoverable. We can't place it directly in the build data because it is only accessible post-signing - whereby the zarf definition can no longer be modified without invalidating the signature.Best practices documentation to follow.
Try it Yourself
Related Issue
Fixes #2805
Fixes #4571
Relates to #
Checklist before merging