@@ -11,6 +11,7 @@ import (
11
11
"errors"
12
12
"fmt"
13
13
"os"
14
+ "strings"
14
15
"time"
15
16
16
17
cjson "github.com/docker/go/canonical/json"
@@ -168,7 +169,7 @@ func verifyTlogEntry(ctx context.Context, rekorClient *client.Rekor, uuid string
168
169
}
169
170
}
170
171
if entryVerError != nil {
171
- return nil , fmt .Errorf ("%w: %s" , err , "error verifying root hash" )
172
+ return nil , fmt .Errorf ("%w: %s" , entryVerError , "error verifying root hash" )
172
173
}
173
174
174
175
// Verify the entry's inclusion
@@ -341,18 +342,25 @@ func FindSigningCertificate(ctx context.Context, uuids []string, dssePayload dss
341
342
// * Verify dsse envelope signature against signing certificate.
342
343
// * Check signature expiration against IntegratedTime in entry.
343
344
// * If all succeed, return the signing certificate.
345
+ var errs []string
344
346
for _ , uuid := range uuids {
345
347
entry , err := verifyTlogEntryByUUID (ctx , rClient , uuid )
346
348
if err != nil {
349
+ // this is unexpected, hold on to this error.
350
+ errs = append (errs , fmt .Sprintf ("%s: verifying tlog entry %s" , err , uuid ))
347
351
continue
348
352
}
349
353
cert , err := extractCert (entry )
350
354
if err != nil {
355
+ // this is unexpected, hold on to this error.
356
+ errs = append (errs , fmt .Sprintf ("%s: extracting certificate from %s" , err , uuid ))
351
357
continue
352
358
}
353
359
354
360
roots , err := fulcio .GetRoots ()
355
361
if err != nil {
362
+ // this is unexpected, hold on to this error.
363
+ errs = append (errs , fmt .Sprintf ("%s: retrieving fulcio root" , err ))
356
364
continue
357
365
}
358
366
co := & cosign.CheckOpts {
@@ -383,5 +391,5 @@ func FindSigningCertificate(ctx context.Context, uuids []string, dssePayload dss
383
391
return cert , nil
384
392
}
385
393
386
- return nil , ErrorNoValidRekorEntries
394
+ return nil , fmt . Errorf ( "%w: got unexpected errors %s" , ErrorNoValidRekorEntries , strings . Join ( errs , ", " ))
387
395
}
0 commit comments