File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
pkg/attestation/renderer/chainloop Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,23 @@ type NormalizedMaterial struct {
7575 EmbeddedInline bool
7676 // Custom annotations
7777 Annotations map [string ]string
78+ // Referenced source component, for SBOMs, SARIF files, etc
79+ ReferencedSourceComponent * ReferencedSourceComponent
80+ }
81+
82+ // Some materials such as SBOMs might have been generated from a source component
83+ // For example, you might have generated an SBOM for a container image and this is the ifnormation
84+ // name": "ghcr.io/chainloop-dev/chainloop/cli",
85+ // type": "container",
86+ // version": "sha256:bbfd27fcdb15c8082951dc59be2310a2a2e6b95e11002f8411e5918887faa607",
87+ type ReferencedSourceComponent struct {
88+ // i.e container, file
89+ Type string `json:"type"`
90+ // i.e ghcr.io/chainloop-dev/chainloop/cli
91+ Name string `json:"name"`
92+ // i.e sha256:bbfd27fcdb15c8082951dc59be2310a2a2e6b95e11002f8411e5918887faa607
93+ // or a tag i.e v0.1.0
94+ Version string `json:"version"`
7895}
7996
8097type ProvenancePredicateCommon struct {
Original file line number Diff line number Diff line change @@ -471,6 +471,21 @@ func normalizeMaterial(material *intoto.ResourceDescriptor) (*NormalizedMaterial
471471 m .Tag = v .GetStringValue ()
472472 }
473473
474+ // Extract the referenced source component
475+ if v , ok := mAnnotationsMap [v1 .AnnotationsSBOMMainComponentName ]; ok && v .GetStringValue () != "" {
476+ m .ReferencedSourceComponent = & ReferencedSourceComponent {
477+ Name : v .GetStringValue (),
478+ }
479+
480+ if v , ok := mAnnotationsMap [v1 .AnnotationsSBOMMainComponentVersion ]; ok && v .GetStringValue () != "" {
481+ m .ReferencedSourceComponent .Version = v .GetStringValue ()
482+ }
483+
484+ if v , ok := mAnnotationsMap [v1 .AnnotationsSBOMMainComponentType ]; ok && v .GetStringValue () != "" {
485+ m .ReferencedSourceComponent .Type = v .GetStringValue ()
486+ }
487+ }
488+
474489 // In the case of an artifact type or derivative the filename is set and the inline content if any
475490 if m .EmbeddedInline || m .UploadedToCAS {
476491 m .Filename = material .Name
You can’t perform that action at this time.
0 commit comments