Skip to content

Commit 2ee9aae

Browse files
committed
fix(runners): record unavailable for a given verification without a status
A given verification with no status, or with the unspecified status, carries no result. The runner now records the unavailable status for it, as it does for a value without a verification. Before, the attestation recorded the unspecified status. Assisted-by: Claude Code Signed-off-by: Javier Rodriguez <javier@chainloop.dev> Chainloop-Trace-Sessions: 4503bdcc-d428-4e05-ade6-966360bf5543
1 parent 751a61d commit 2ee9aae

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎pkg/attestation/crafter/runners/chainloopsandbox.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@ func (r *ChainloopSandbox) VerifyCommitSignature(_ context.Context, commitHash s
9292
return nil
9393
}
9494

95+
// A verification without a status carries no result, the same as a missing one.
9596
var given SandboxCommitVerification
96-
if err := json.Unmarshal([]byte(raw), &given); err != nil || given.Verification == nil {
97+
if err := json.Unmarshal([]byte(raw), &given); err != nil || given.Verification == nil ||
98+
given.Verification.Status == commitverification.VerificationStatusUnspecified {
9799
return &commitverification.CommitVerification{
98100
Attempted: true,
99101
Status: commitverification.VerificationStatusUnavailable,

‎pkg/attestation/crafter/runners/chainloopsandbox_test.go‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,18 @@ func (s *chainloopSandboxSuite) TestVerifyCommitSignature() {
182182
commit: commit,
183183
want: invalid,
184184
},
185+
{
186+
name: "verification without a status",
187+
env: `{"commit":"` + commit + `","verification":{"attempted":true,"platform":"gitlab"}}`,
188+
commit: commit,
189+
want: invalid,
190+
},
191+
{
192+
name: "unspecified status",
193+
env: `{"commit":"` + commit + `","verification":{"attempted":true,"status":"unspecified"}}`,
194+
commit: commit,
195+
want: invalid,
196+
},
185197
}
186198

187199
for _, tc := range testCases {

0 commit comments

Comments
 (0)