Skip to content

Commit 26289ce

Browse files
authored
Update verify.go
1 parent 5a5a52e commit 26289ce

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

internal/verify/verify.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ type Options struct {
1818
StrictSignature bool
1919
StrictApprovals bool
2020
PublicKeyPathOpt string
21+
PublicKeyDirOpt string
2122

2223
StrictChain bool
23-
ChainDir string // if empty and StrictChain=true, defaults to directory containing ReceiptPath
24+
ChainDir string
2425
}
2526

2627
type Result struct {
@@ -40,7 +41,6 @@ func Run(opts Options) (*Result, error) {
4041
opts.SchemaPath = filepath.Join("spec", "receipt.schema.json")
4142
}
4243

43-
// If we're doing strict chain validation, leaf must be strict too.
4444
if opts.StrictChain {
4545
opts.StrictHashes = true
4646
opts.StrictSignature = true
@@ -61,6 +61,7 @@ func Run(opts Options) (*Result, error) {
6161
StrictSignature: opts.StrictSignature,
6262
StrictApprovals: opts.StrictApprovals,
6363
PublicKeyPath: opts.PublicKeyPathOpt,
64+
PublicKeyDir: opts.PublicKeyDirOpt,
6465
})
6566
if err != nil {
6667
return nil, err
@@ -78,18 +79,18 @@ func Run(opts Options) (*Result, error) {
7879
return nil, err
7980
}
8081

81-
// Validate each parent strictly: schema + hashes + signature (+ approvals if requested).
8282
validateParent := func(pr receipt.Receipt) error {
8383
_, _, _, err := ValidateReceiptObject(pr, schema, ReceiptValidationOptions{
8484
StrictHashes: true,
8585
StrictSignature: true,
8686
StrictApprovals: opts.StrictApprovals,
8787
PublicKeyPath: opts.PublicKeyPathOpt,
88+
PublicKeyDir: opts.PublicKeyDirOpt,
8889
})
8990
return err
9091
}
9192

92-
c, err := receipt.ValidateChain(r, resolver, validateParent, receipt.ChainValidationOptions{Strict: true})
93+
c, err := receipt.ValidateChain(pr, resolver, validateParent, receipt.ChainValidationOptions{Strict: true})
9394
if err != nil {
9495
return nil, err
9596
}

0 commit comments

Comments
 (0)