Skip to content

feat(attestation): preserve chainloop.* annotations in NormalizedMaterial#2874

Open
migmartri wants to merge 3 commits intochainloop-dev:mainfrom
migmartri:worktree-miguel/2872
Open

feat(attestation): preserve chainloop.* annotations in NormalizedMaterial#2874
migmartri wants to merge 3 commits intochainloop-dev:mainfrom
migmartri:worktree-miguel/2872

Conversation

@migmartri
Copy link
Member

Summary

  • normalizeMaterial() was stripping all chainloop.* prefixed annotations from NormalizedMaterial.Annotations, making internal system annotations (e.g. chainloop.material.size, chainloop.material.cas, chainloop.material.tool.name) unavailable to downstream consumers
  • Removed the continue that skipped chainloop.* keys so all annotations flow through to the map
  • Added a structValueToString helper to correctly serialize all structpb value types — necessary because some annotations like chainloop.material.cas are stored as BoolValue (for which GetStringValue() returns "")

Closes #2872

…rial

Previously, normalizeMaterial() stripped all chainloop.* prefixed
annotations from NormalizedMaterial.Annotations. This made internal
system annotations (e.g. chainloop.material.size, chainloop.material.cas,
chainloop.material.tool.name) unavailable to downstream consumers such as
the attestation service, graph view, and policy evaluation.

Remove the continue that skipped chainloop.* keys and add a
structValueToString helper to correctly convert all structpb value types
(string, bool, number) since some annotations like chainloop.material.cas
are stored as BoolValue, for which GetStringValue() returns "".

Fixes: chainloop-dev#2872
Signed-off-by: Miguel Martinez Trivino <[email protected]>
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="pkg/attestation/renderer/chainloop/v02.go">

<violation number="1" location="pkg/attestation/renderer/chainloop/v02.go:532">
P2: `structValueToString` still drops non-scalar annotation values by converting them to an empty string.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

…ToString

JSON-marshal StructValue and ListValue types instead of returning an
empty string, so annotations stored as complex types are preserved.

Signed-off-by: Miguel Martinez Trivino <[email protected]>
Update plugin SDK summary table golden files to include the newly
preserved chainloop.* annotations in material output.

Signed-off-by: Miguel Martinez Trivino <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve chainloop.* annotations in NormalizedMaterial during normalization

3 participants