Skip to content

fix(cli): fail attestation verify when the bundle was never verified - #3398

Merged
jiparis merged 1 commit into
chainloop-dev:mainfrom
jiparis:jiparis/attestation-verify-exit-code
Sep 4, 2026
Merged

jiparis merged 1 commit into
chainloop-dev:mainfrom
jiparis:jiparis/attestation-verify-exit-code

Conversation

@jiparis

@jiparis jiparis commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Fixes #3397

chainloop attestation verify exited with code 0 while warning that the attestation couldn't be verified, so CI steps that gate on the exit code accepted bundles that were never verified. This happened when the bundle carries no verification material, and when the control plane has no trusted root configured.

The verify command now fails in both cases, with an error that distinguishes an attestation that was never verified from one that failed verification.

The strict and best-effort verification paths are separated, so workflow run describe keeps its current behaviour: an attestation that cannot be verified is reported as not verified without failing the command, and can still fall back to key-based envelope verification.

AI disclosure: this change was produced with the assistance of Claude Code.

Review in cubic

`chainloop attestation verify` exited 0 while warning that the attestation
couldn't be verified, so CI steps gating on the exit code accepted bundles
that carry no verification material, or that were checked against a control
plane with no trusted root configured.

The verify command now returns an error in both cases, and the strict and
best-effort verification paths are separated so `workflow run describe` keeps
reporting an unverifiable attestation as simply not verified.

Fixes chainloop-dev#3397

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

Chainloop-Trace-Sessions: 79994894-21cb-4afa-91e5-682eb64c2817
@chainloop-platform

chainloop-platform Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

AI Session Checks — 🟢 90% · ✅ 0 failing

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟢 90% 1 ✅ 0 100% AI / 0% Human 6 +237 / -28 2h59m48s

🟢 90% — 100% AI — ✅ All policies passing

Sep 4, 2026 11:51 UTC · 2h59m48s · $6.44 · 128 in / 36.8k out · claude-code 2.1.260 (claude-opus-5)

View session details ↗

Change Summary

  • Makes chainloop attestation verify fail when the bundle was never actually verified.
  • Adds a stricter verification path in app/cli/pkg/action while leaving workflow run describe behavior unchanged.
  • Adds focused CLI tests and three bundle fixtures covering success, missing material, missing root, and tampering.

AI Session Overall Score

🟢 90% — Clean focused fix with strong verification and no signs of drift or distrust.

AI Session Analysis Breakdown

🟢 93% · scope-discipline

No notes.

🟢 92% · user-trust-signal

🟢 The user never had to restate the ask and moved directly to shipping tasks. · Medium Impact

🟢 91% · solution-quality

🟢 The implementation fails closed while preserving workflow describe's best-effort path. · High Impact

🟢 90% · alignment

No notes.

🟢 88% · verification

🟢 AI added focused tests for valid, missing-material, no-root, and tampered-bundle cases. · High Impact

🟢 84% · context-and-planning

No notes.


File Attribution

████████████████████ 100% AI / 0% Human

Status Attribution File Lines
created ai app/cli/pkg/action/attestation_verify_test.go +143 / -0
modified ai app/cli/pkg/action/attestation_verify.go +44 / -20
created ai app/cli/pkg/action/testdata/bundle_invalid.json +17 / -0
created ai app/cli/pkg/action/testdata/bundle_valid.json +17 / -0
modified ai app/cli/cmd/attestation_verify.go +4 / -8
created ai app/cli/pkg/action/testdata/bundle_valid_nomaterial.json +12 / -0

Policies (4)

Status Policy Material Messages
✅ Passed ai-config-ai-agents-allowed ai-coding-session-799948 -
✅ Passed ai-config-no-dangerous-commands ai-coding-session-799948 -
✅ Passed ai-config-no-secrets ai-coding-session-799948 -
✅ Passed ai-config-mcp-servers-allowed ai-coding-session-799948 -

Security Checks — ✅ 8 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 -

✅ iac-scan

Status Policy Messages
✅ Passed iac-misconfiguration -

PR info

Status Policy Messages
✅ Passed pr-description-required -
✅ Passed pr-user-story-linked -

⏭️ 2 scans not applied

Scan Reason
vulnerability-scan no manifest/lockfile changed
github-actions-scan no workflow 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 6 files

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

Re-trigger cubic

Comment thread app/cli/pkg/action/attestation_verify.go
Comment thread app/cli/pkg/action/testdata/bundle_invalid.json
@jiparis
jiparis requested a review from a team September 4, 2026 15:14

@migmartri migmartri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks

@jiparis
jiparis merged commit 4afdffb into chainloop-dev:main Sep 4, 2026
20 of 21 checks passed
@jiparis
jiparis deleted the jiparis/attestation-verify-exit-code branch September 4, 2026 15:27
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 verify exits 0 when the bundle carries no verification material

2 participants