Skip to content

fix(cli): fail attestation add on a duplicate material name - #3826

Merged
migmartri merged 1 commit into
chainloop-dev:mainfrom
migmartri:fix/attestation-add-duplicate-material
Nov 19, 2026
Merged

migmartri merged 1 commit into
chainloop-dev:mainfrom
migmartri:fix/attestation-add-duplicate-material

Conversation

@migmartri

@migmartri migmartri commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

chainloop attestation add silently overwrote a material when another material with the same name was added to the same attestation. Only the last piece of evidence was kept.

With this change, adding a material whose name is already in the attestation fails with an error that tells the user to use a different --name or to pass --replace. The new --replace flag on attestation add keeps the previous overwrite behavior on purpose, the same way attestation init --replace does. The rule applies to materials in the contract, to materials not in the contract, and to materials whose kind is detected automatically. The duplicate is rejected before anything is uploaded.

Evidence that the CLI generates by itself (PR/MR metadata, AI agent configuration, and Chainloop Trace materials) keeps overwriting by name, so its behavior does not change.

Closes #3824

This contribution was made with AI assistance (Claude Code).

View guided diff

@migmartri migmartri self-assigned this Nov 17, 2026
@chainloop-platform

chainloop-platform Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR validation — ✅ 3 passing

Status Policy Material Messages
✅ Passed pr-min-approvals pr-info -
✅ Passed pr-description-required pr-info -
✅ Passed pr-user-story-linked pr-info -

View attestation ↗

AI Session Checks — ⚠️ no AI session found

Missing AI Coding Sessions

This organization requires every PR to be backed by a Chainloop Trace AI coding session, and none was found for this one.

Please make sure the AI coding session evidence has been sent by the Chainloop CLI, or add the skip-ai-session label to this PR to bypass this check.

Learn more about Chainloop Trace.

Security Checks — ✅ 5 passing

✅ secret-scan

Status Policy Messages
✅ Passed secrets-detection -

✅ sast-scan

Status Policy Messages
✅ Passed owasp-top10-2025 -
✅ Passed sast -
✅ Passed cwe-top25 -
✅ Passed cwe-top26-40-cusp -
Scans not applied (3)
Scan Reason
vulnerability-scan no manifest/lockfile changed
github-actions-scan no workflow files changed
iac-scan no IaC files changed

View attestation ↗


Powered by Chainloop and Chainloop Trace

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 8 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread app/cli/pkg/action/attestation_add.go Resolved
Adding a material with a name that is already in the attestation silently
overwrote the previous one. It now fails and tells the user to use a
different --name, or to pass the new --replace flag to overwrite it.

Closes chainloop-dev#3824

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: c0141405-13fa-4976-8c09-9cbdb55cdc07
@migmartri
migmartri force-pushed the fix/attestation-add-duplicate-material branch from ca0f5d9 to 73eb044 Compare November 17, 2026 12:26
@migmartri
migmartri requested a review from a team November 17, 2026 15:38
@migmartri
migmartri merged commit 99480ea into chainloop-dev:main Nov 19, 2026
16 of 17 checks passed
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.

attestation add silently overwrites a material with the same name

2 participants