check for sigstore-go validation errs

Signed-off-by: Meredith Lancaster <malancas@github.com>
This commit is contained in:
Meredith Lancaster 2024-09-10 07:54:45 -06:00
parent 70e935ba95
commit 83519e4e92

View file

@ -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)
}