@@ -63,30 +63,39 @@ func NewLiveSigstoreVerifier(config SigstoreConfig) (*LiveSigstoreVerifier, erro
6363 Logger : config .Logger ,
6464 NoPublicGood : config .NoPublicGood ,
6565 }
66- // if a custom trusted root is set, configure custom verifiers
66+ // if a custom trusted root is set, configure custom verifiers and assume no Public Good or GitHub verifiers
67+ // are needed
6768 if config .TrustedRoot != "" {
6869 customVerifiers , err := createCustomVerifiers (config .TrustedRoot , config .NoPublicGood )
6970 if err != nil {
70- return nil , err
71+ return nil , fmt . Errorf ( "error creating custom verifiers: %s" , err )
7172 }
7273 liveVerifier .Custom = customVerifiers
7374 return liveVerifier , nil
7475 }
76+
77+ // No custom trusted root is set, so configure Public Good and GitHub verifiers
7578 if ! config .NoPublicGood {
7679 publicGoodVerifier , err := newPublicGoodVerifier (config .TUFMetadataDir , config .HttpClient )
7780 if err != nil {
7881 // Log warning but continue - PGI unavailability should not block GitHub attestation verification
79- config .Logger .VerbosePrintf ("Warning: failed to initialize Public Good verifier: %v\n " , err )
82+ config .Logger .VerbosePrintf ("Warning: failed to initialize Sigstore Public Good verifier: %v\n " , err )
8083 config .Logger .VerbosePrintf ("Continuing without Public Good Instance verification\n " )
8184 } else {
8285 liveVerifier .PublicGood = publicGoodVerifier
8386 }
8487 }
88+
8589 github , err := newGitHubVerifier (config .TrustDomain , config .TUFMetadataDir , config .HttpClient )
8690 if err != nil {
87- return nil , err
91+ config .Logger .VerbosePrintf ("Warning: failed to initialize GitHub verifier: %v\n " , err )
92+ } else {
93+ liveVerifier .GitHub = github
94+ }
95+
96+ if liveVerifier .noVerifierSet () {
97+ return nil , fmt .Errorf ("no valid Sigstore verifiers could be initialized" )
8898 }
89- liveVerifier .GitHub = github
9099
91100 return liveVerifier , nil
92101}
@@ -378,3 +387,7 @@ func newPublicGoodVerifierWithTrustedRoot(trustedRoot *root.TrustedRoot) (*verif
378387
379388 return sv , nil
380389}
390+
391+ func (v * LiveSigstoreVerifier ) noVerifierSet () bool {
392+ return v .PublicGood == nil && v .GitHub == nil && len (v .Custom ) == 0
393+ }
0 commit comments