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

Function newCustomVerifier

pkg/cmd/attestation/verification/sigstore.go:314–335  ·  view source on GitHub ↗
(trustedRoot *root.TrustedRoot)

Source from the content-addressed store, hash-verified

312}
313
314func newCustomVerifier(trustedRoot *root.TrustedRoot) (*verify.Verifier, error) {
315 // All we know about this trust root is its configuration so make some
316 // educated guesses as to what the policy should be.
317 verifierConfig := []verify.VerifierOption{}
318 // This requires some independent corroboration of the signing certificate
319 // (e.g. from Sigstore Fulcio) time, one of:
320 // - a signed timestamp from a timestamp authority in the trusted root
321 // - a transparency log entry (e.g. from Sigstore Rekor)
322 verifierConfig = append(verifierConfig, verify.WithObserverTimestamps(1))
323
324 // Infer verification options from contents of trusted root
325 if len(trustedRoot.RekorLogs()) > 0 {
326 verifierConfig = append(verifierConfig, verify.WithTransparencyLog(1))
327 }
328
329 gv, err := verify.NewVerifier(trustedRoot, verifierConfig...)
330 if err != nil {
331 return nil, fmt.Errorf("failed to create custom verifier: %v", err)
332 }
333
334 return gv, nil
335}
336
337func newGitHubVerifier(trustDomain string, tufMetadataDir o.Option[string], hc *http.Client) (*verify.Verifier, error) {
338 var tr string

Callers 1

createCustomVerifiersFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected