-
Notifications
You must be signed in to change notification settings - Fork 51
Description
Problem
normalizeMaterial() in pkg/attestation/renderer/chainloop/v02.go (lines 436-440) strips all annotations with the chainloop. prefix from materials:
for k, v := range mAnnotationsMap {
if strings.HasPrefix(k, v1.AnnotationPrefix) {
continue
}
m.Annotations[k] = v.GetStringValue()
}System annotations like chainloop.material.size, chainloop.material.cas, chainloop.material.type, etc. are used to populate dedicated struct fields (UploadedToCAS, Type, Name, etc.) but are then discarded from the Annotations map.
This causes issues downstream when consumers need access to these annotations. For example, chainloop.material.size is needed by the frontend to perform a pre-fetch size check — without it, the content viewer downloads the full file before discovering it exceeds the size limit.
Proposed fix
Preserve chainloop.* annotations in NormalizedMaterial.Annotations alongside the dedicated struct fields. The annotations should be kept as-is in the map rather than being stripped during normalization.
Alternatively, we could expose them through another method in the interface