Skip to content

Commit 3fab94f

Browse files
committed
exporter: make attestation validation public
Signed-off-by: Justin Chadwell <[email protected]>
1 parent 3bc2aa6 commit 3fab94f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

exporter/attestation/unbundle.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,10 @@ func Unbundle(ctx context.Context, s session.Group, bundled []exporter.Attestati
6565
for _, atts := range unbundled {
6666
joined = append(joined, atts...)
6767
}
68-
for _, att := range joined {
69-
if err := validate(att); err != nil {
68+
69+
if err := Validate(joined); err != nil {
7070
return nil, err
7171
}
72-
}
7372
return joined, nil
7473
}
7574

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

131+
func Validate(atts []exporter.Attestation) error {
132+
for _, att := range atts {
133+
if err := validate(att); err != nil {
134+
return err
135+
}
136+
}
137+
return nil
138+
}
139+
132140
func validate(att exporter.Attestation) error {
133141
if att.Path == "" {
134142
return errors.New("attestation does not have set path")

0 commit comments

Comments
 (0)