Skip to content

Commit 7581f69

Browse files
move cleanUpTrustpolicy call to Options func.
Signed-off-by: Jagpreet Singh Tamber <[email protected]>
1 parent f396630 commit 7581f69

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

internal/controller/helmchart_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1402,12 +1402,12 @@ func (r *HelmChartReconciler) makeVerifiers(ctx context.Context, obj *helmv1.Hel
14021402
}
14031403

14041404
defaultNotaryOciOpts := []notation.Options{
1405+
notation.WithLogger(ctrl.LoggerFrom(ctx)),
14051406
notation.WithTrustStore(&doc),
14061407
notation.WithRemoteOptions(verifyOpts...),
14071408
notation.WithAuth(clientOpts.Authenticator),
14081409
notation.WithKeychain(clientOpts.Keychain),
14091410
notation.WithInsecureRegistry(clientOpts.Insecure),
1410-
notation.WithLogger(ctrl.LoggerFrom(ctx)),
14111411
}
14121412

14131413
for k, data := range pubSecret.Data {

internal/controller/ocirepository_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,12 +730,12 @@ func (r *OCIRepositoryReconciler) verifySignature(ctx context.Context, obj *ociv
730730
verifiedResult := soci.VerificationResultFailed
731731

732732
defaultNotationOciOpts := []notation.Options{
733+
notation.WithLogger(ctrl.LoggerFrom(ctx)),
733734
notation.WithTrustStore(&doc),
734735
notation.WithRemoteOptions(opt...),
735736
notation.WithAuth(auth),
736737
notation.WithKeychain(keychain),
737738
notation.WithInsecureRegistry(obj.Spec.Insecure),
738-
notation.WithLogger(ctrl.LoggerFrom(ctx)),
739739
}
740740

741741
for k, data := range pubSecret.Data {

internal/oci/notation/notation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func WithInsecureRegistry(insecure bool) Options {
7171
// WithTrustStore sets the trust store configuration.
7272
func WithTrustStore(trustStore *trustpolicy.Document) Options {
7373
return func(opts *options) {
74-
opts.trustPolicy = trustStore
74+
opts.trustPolicy = cleanTrustPolicy(trustStore, opts.logger)
7575
}
7676
}
7777

@@ -165,7 +165,7 @@ func NewNotationVerifier(opts ...Options) (*NotationVerifier, error) {
165165
cert: o.rootCertificate,
166166
}
167167

168-
trustpolicy := cleanTrustPolicy(o.trustPolicy, o.logger)
168+
trustpolicy := o.trustPolicy
169169
if trustpolicy == nil {
170170
return nil, fmt.Errorf("trust policy cannot be empty")
171171
}

0 commit comments

Comments
 (0)