Skip to content

Commit

Permalink
check for sigstore-go validation errs
Browse files Browse the repository at this point in the history
Signed-off-by: Meredith Lancaster <malancas@github.com>
  • Loading branch information
malancas committed Sep 10, 2024
1 parent 70e935b commit 83519e4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/cmd/attestation/verification/attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,15 @@ func loadBundlesFromJSONLinesFile(path string) ([]*api.Attestation, error) {
decoder := json.NewDecoder(bytes.NewReader(fileContent))

for decoder.More() {
var bundle bundle.Bundle
bundle.Bundle = new(protobundle.Bundle)
if err := decoder.Decode(&bundle); err != nil {
return nil, fmt.Errorf("failed to unmarshal bundle from JSON: %v", err)
var b bundle.Bundle
b.Bundle = new(protobundle.Bundle)
if err := decoder.Decode(&b); err != nil {
if errors.Is(err, bundle.ErrValidation) {
return nil, err
}
return nil, fmt.Errorf("failed to unmarshal bundle from JSON")
}
a := api.Attestation{Bundle: &bundle}
a := api.Attestation{Bundle: &b}
attestations = append(attestations, &a)
}

Expand Down

0 comments on commit 83519e4

Please sign in to comment.