Skip to content

Commit

Permalink
exporter: make attestation validation public
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Chadwell <[email protected]>
  • Loading branch information
jedevc committed Dec 16, 2022
1 parent 3bc2aa6 commit 3fab94f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions exporter/attestation/unbundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ func Unbundle(ctx context.Context, s session.Group, bundled []exporter.Attestati
for _, atts := range unbundled {
joined = append(joined, atts...)
}
for _, att := range joined {
if err := validate(att); err != nil {

if err := Validate(joined); err != nil {
return nil, err
}
}
return joined, nil
}

Expand Down Expand Up @@ -129,6 +128,15 @@ func unbundle(ctx context.Context, root string, bundle exporter.Attestation) ([]
return unbundled, nil
}

func Validate(atts []exporter.Attestation) error {
for _, att := range atts {
if err := validate(att); err != nil {
return err
}
}
return nil
}

func validate(att exporter.Attestation) error {
if att.Path == "" {
return errors.New("attestation does not have set path")
Expand Down

0 comments on commit 3fab94f

Please sign in to comment.