MCPcopy Create free account
hub / github.com/cli/cli / getBundleIssuer

Function getBundleIssuer

pkg/cmd/attestation/verification/sigstore.go:188–204  ·  view source on GitHub ↗
(b *bundle.Bundle)

Source from the content-addressed store, hash-verified

186}
187
188func getBundleIssuer(b *bundle.Bundle) (string, error) {
189 if !b.MinVersion("0.2") {
190 return "", fmt.Errorf("unsupported bundle version: %s", b.MediaType)
191 }
192 verifyContent, err := b.VerificationContent()
193 if err != nil {
194 return "", fmt.Errorf("failed to get bundle verification content: %v", err)
195 }
196 leafCert := verifyContent.Certificate()
197 if leafCert == nil {
198 return "", fmt.Errorf("leaf cert not found")
199 }
200 if len(leafCert.Issuer.Organization) != 1 {
201 return "", fmt.Errorf("expected the leaf certificate issuer to only have one organization")
202 }
203 return leafCert.Issuer.Organization[0], nil
204}
205
206func (v *LiveSigstoreVerifier) chooseVerifier(issuer string) (*verify.Verifier, error) {
207 // if no custom trusted root is set, return either the Public Good or GitHub verifier

Callers 1

verifyMethod · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected