(ref *v1.PolicyEvaluation_Reference)
| 453 | } |
| 454 | |
| 455 | func renderReference(ref *v1.PolicyEvaluation_Reference) (*intoto.ResourceDescriptor, error) { |
| 456 | // skip empty references |
| 457 | if ref == nil { |
| 458 | return nil, nil |
| 459 | } |
| 460 | |
| 461 | annotations, err := structpb.NewStruct(map[string]interface{}{"name": ref.GetName(), "organization": ref.GetOrgName()}) |
| 462 | if err != nil { |
| 463 | // Struct raise errors in some conditions (when a field is not UTF8, for example). We need to handle them, although it's a remote possibility |
| 464 | return nil, err |
| 465 | } |
| 466 | return &intoto.ResourceDescriptor{ |
| 467 | Name: ref.GetName(), |
| 468 | Uri: ref.GetUri(), |
| 469 | Digest: map[string]string{ |
| 470 | "sha256": strings.TrimPrefix(ref.GetDigest(), "sha256:"), |
| 471 | }, |
| 472 | Annotations: annotations, |
| 473 | }, nil |
| 474 | } |
| 475 | |
| 476 | func outputMaterials(att *v1.Attestation, onlyOutput bool) ([]*intoto.ResourceDescriptor, error) { |
| 477 | // Sort material keys to stabilize output |
no test coverage detected