Skip to content

fix(materials): guard legacy tool annotations against empty values#2881

Merged
jiparis merged 2 commits into
chainloop-dev:mainfrom
jiparis:jiparis/pfm-5009-investigate
Mar 19, 2026
Merged

fix(materials): guard legacy tool annotations against empty values#2881
jiparis merged 2 commits into
chainloop-dev:mainfrom
jiparis:jiparis/pfm-5009-investigate

Conversation

@jiparis

@jiparis jiparis commented Mar 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Guard all legacy tool annotation assignments (chainloop.material.tool.name, chainloop.material.tool.version) with non-empty checks across all material crafters (CycloneDX, SPDX, SARIF, CSAF)
  • Prevents SBOM uploads from failing when a tool entry has an empty version string

Fixes #2880

SBOM uploads fail when a tool entry has an empty version string because
the legacy annotation is set to "" and then rejected by the crafter
validation. Guard all legacy annotation assignments with non-empty
checks across all material crafters.

Fixes chainloop-dev#2880

Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 issues found across 9 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/crafter/materials/csaf.go">

<violation number="1" location="pkg/attestation/crafter/materials/csaf.go:152">
P2: Add a CSAF test for empty `generator.engine.name` / `version` values; the new guard changes annotation behavior but is not covered.

(Based on your team's feedback about adding or updating tests for new paths.) [FEEDBACK_USED]</violation>
</file>

<file name="pkg/attestation/crafter/materials/spdxjson.go">

<violation number="1" location="pkg/attestation/crafter/materials/spdxjson.go:94">
P3: Add a SPDX JSON craft test case where the first tool has an empty name to exercise the new guard and assert the legacy name annotation is omitted.

(Based on your team's feedback about adding/updating tests for new paths.) [FEEDBACK_USED]</violation>
</file>

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

Comment thread pkg/attestation/crafter/materials/csaf.go
Comment thread pkg/attestation/crafter/materials/spdxjson.go
@jiparis jiparis requested review from javirln and migmartri March 18, 2026 17:56
Add test for CSAF tool annotation assertions and SPDX empty tool name
case to cover the new guards added in the previous commit.

Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
@jiparis jiparis merged commit 6e42538 into chainloop-dev:main Mar 19, 2026
15 checks passed
@jiparis jiparis deleted the jiparis/pfm-5009-investigate branch March 19, 2026 08:43
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.

fix: empty tool version annotation blocks SBOM uploads

3 participants