@@ -19,6 +19,8 @@ import (
19
19
"github.com/slsa-framework/slsa-verifier/v2/verifiers/internal/gha/slsaprovenance/common"
20
20
"github.com/slsa-framework/slsa-verifier/v2/verifiers/utils"
21
21
"github.com/slsa-framework/slsa-verifier/v2/verifiers/utils/container"
22
+
23
+ ociremote "github.com/sigstore/cosign/v2/pkg/oci/remote"
22
24
)
23
25
24
26
const VerifierName = "GHA"
@@ -252,11 +254,27 @@ func (v *GHAVerifier) VerifyImage(ctx context.Context,
252
254
if err != nil {
253
255
return nil , nil , err
254
256
}
257
+
258
+ // Parse any provenance target repository set using environment variable COSIGN_REPOSITORY
259
+ provenanceTargetRepository , err := ociremote .GetEnvTargetRepository ()
260
+ if err != nil {
261
+ return nil , nil , err
262
+ }
263
+
264
+ registryClientOpts := []ociremote.Option {}
265
+
266
+ // Append target repository to OCI Registry opts
267
+ // Must be authenticated against the specified target repository externally
268
+ if provenanceTargetRepository .Name () != "" {
269
+ registryClientOpts = append (registryClientOpts , ociremote .WithTargetRepository (provenanceTargetRepository ))
270
+ }
271
+
255
272
opts := & cosign.CheckOpts {
256
- RootCerts : trustedRoot .FulcioRoot ,
257
- IntermediateCerts : trustedRoot .FulcioIntermediates ,
258
- RekorPubKeys : trustedRoot .RekorPubKeys ,
259
- CTLogPubKeys : trustedRoot .CTPubKeys ,
273
+ RegistryClientOpts : registryClientOpts ,
274
+ RootCerts : trustedRoot .FulcioRoot ,
275
+ IntermediateCerts : trustedRoot .FulcioIntermediates ,
276
+ RekorPubKeys : trustedRoot .RekorPubKeys ,
277
+ CTLogPubKeys : trustedRoot .CTPubKeys ,
260
278
}
261
279
atts , _ , err := container .RunCosignImageVerification (ctx ,
262
280
artifactImage , opts )
0 commit comments