@@ -71,7 +71,7 @@ func WithInsecureRegistry(insecure bool) Options {
71
71
// WithTrustStore sets the trust store configuration.
72
72
func WithTrustStore (trustStore * trustpolicy.Document ) Options {
73
73
return func (opts * options ) {
74
- opts .trustPolicy = trustStore
74
+ opts .trustPolicy = cleanTrustPolicy ( trustStore , opts . logger )
75
75
}
76
76
}
77
77
@@ -165,7 +165,7 @@ func NewNotationVerifier(opts ...Options) (*NotationVerifier, error) {
165
165
cert : o .rootCertificate ,
166
166
}
167
167
168
- trustpolicy := cleanTrustPolicy ( o .trustPolicy , o . logger )
168
+ trustpolicy := o .trustPolicy
169
169
if trustpolicy == nil {
170
170
return nil , fmt .Errorf ("trust policy cannot be empty" )
171
171
}
@@ -185,15 +185,15 @@ func NewNotationVerifier(opts ...Options) (*NotationVerifier, error) {
185
185
}, nil
186
186
}
187
187
188
- // cleanTrustPolicy cleans the given trust policy by removing trust stores and trusted identities
188
+ // CleanTrustPolicy cleans the given trust policy by removing trust stores and trusted identities
189
189
// for trust policy statements that are set to skip signature verification but still have configured trust stores and/or trusted identities.
190
190
// It takes a pointer to a trustpolicy.Document and a logger from the logr package as input parameters.
191
191
// If the trustPolicy is nil, it returns nil.
192
192
// Otherwise, it iterates over the trustPolicy.TrustPolicies and checks if each trust policy statement's
193
193
// SignatureVerification.VerificationLevel is set to trustpolicy.LevelSkip.Name.
194
194
// If it is, it logs a warning message and removes the trust stores and trusted identities for that trust policy statement.
195
195
// Finally, it returns the modified trustPolicy.
196
- func cleanTrustPolicy (trustPolicy * trustpolicy.Document , logger logr.Logger ) * trustpolicy.Document {
196
+ func CleanTrustPolicy (trustPolicy * trustpolicy.Document , logger logr.Logger ) * trustpolicy.Document {
197
197
if trustPolicy == nil {
198
198
return nil
199
199
}
0 commit comments