Skip to content

Commit 24807f5

Browse files
committed
attestation: validate attestations before unbundling as well
Signed-off-by: Justin Chadwell <[email protected]>
1 parent 3fab94f commit 24807f5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

exporter/attestation/unbundle.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ import (
2020
// Unbundle iterates over all provided result attestations and un-bundles any
2121
// bundled attestations by loading them from the provided refs map.
2222
func Unbundle(ctx context.Context, s session.Group, bundled []exporter.Attestation) ([]exporter.Attestation, error) {
23+
if err := Validate(bundled); err != nil {
24+
return nil, err
25+
}
26+
2327
eg, ctx := errgroup.WithContext(ctx)
2428
unbundled := make([][]exporter.Attestation, len(bundled))
2529

@@ -138,7 +142,7 @@ func Validate(atts []exporter.Attestation) error {
138142
}
139143

140144
func validate(att exporter.Attestation) error {
141-
if att.Path == "" {
145+
if att.Kind != gatewaypb.AttestationKindBundle && att.Path == "" {
142146
return errors.New("attestation does not have set path")
143147
}
144148
if att.Ref == nil && att.ContentFunc == nil {

0 commit comments

Comments
 (0)