SetImageSignatureCheck sets the passed and result.message fields of the ImageSignatureCheck to the given values.
(err error)
| 115 | |
| 116 | // SetImageSignatureCheck sets the passed and result.message fields of the ImageSignatureCheck to the given values. |
| 117 | func (o *Output) SetImageSignatureCheckFromError(err error) { |
| 118 | metadata := map[string]interface{}{ |
| 119 | "code": "builtin.image.signature_check", |
| 120 | "title": "Image signature check passed", |
| 121 | "description": "The image signature matches available signing materials.", |
| 122 | } |
| 123 | var message string |
| 124 | |
| 125 | if err == nil { |
| 126 | o.ImageSignatureCheck.Passed = true |
| 127 | message = "Pass" |
| 128 | log.Debug("Image signature check passed") |
| 129 | } else { |
| 130 | o.ImageSignatureCheck.Passed = false |
| 131 | message = wrapCosignErrorMessage(err, "signature", o.Policy) |
| 132 | log.Debug(message) |
| 133 | } |
| 134 | result := &evaluator.Result{Message: message, Metadata: metadata} |
| 135 | if !o.Detailed { |
| 136 | keepSomeMetadataSingle(*result) |
| 137 | } |
| 138 | o.ImageSignatureCheck.Result = result |
| 139 | } |
| 140 | |
| 141 | // SetAttestationSignatureCheck sets the passed and result.message fields of the AttestationSignatureCheck to the given values. |
| 142 | func (o *Output) SetAttestationSignatureCheckFromError(err error) { |