Skip to content

Commit 0dedf6f

Browse files
docs(notation): add comments around what is happening in checkOutcome
Signed-off-by: Jason <[email protected]>
1 parent c3a89f4 commit 0dedf6f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

internal/oci/notation/notation.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,28 +252,37 @@ func (v *NotationVerifier) checkOutcome(outcomes []*notation.VerificationOutcome
252252
return oci.VerificationResultFailed, fmt.Errorf("signature verification failed for all the signatures associated with %s", url)
253253
}
254254

255+
// should only ever be one item in the outcomes slice
255256
outcome := outcomes[0]
256257

258+
// if the verification level is set to skip, we ignore the verification result
259+
// as there should be no verification results in outcome and we do not want
260+
// to mark the result as verified
257261
if outcome.VerificationLevel == trustpolicy.LevelSkip {
258262
return oci.VerificationResultIgnored, nil
259263
}
260264

261265
ignore := false
262266

267+
// loop through verification results to check for errors
263268
for _, i := range outcome.VerificationResults {
269+
// error if action is not marked as `skip` and there is an error
264270
if i.Error != nil {
271+
// flag to ignore the verification result if the error is related to type `authenticity`
265272
if i.Type == trustpolicy.TypeAuthenticity {
266273
ignore = true
267274
}
268-
275+
// log results of error
269276
v.logger.Info(fmt.Sprintf("verification check for type %s failed for %s with message %s", i.Type, url, i.Error.Error()))
270277
}
271278
}
272279

280+
// if the ignore flag is set, we ignore the verification result so not to mark as verified
273281
if ignore {
274282
return oci.VerificationResultIgnored, nil
275283
}
276284

285+
// result is okay to mark as verified
277286
return oci.VerificationResultSuccess, nil
278287
}
279288

0 commit comments

Comments
 (0)