Skip to content

Commit 8e30f13

Browse files
authored
Update batch.go
1 parent ec5900d commit 8e30f13

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

internal/verify/batch.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type DirOptions struct {
1414
Dir string
1515
SchemaPath string
1616
PublicKeyPath string
17+
PublicKeyDir string
1718
StrictHashes bool
1819
StrictSignature bool
1920
StrictApprovals bool
@@ -37,7 +38,6 @@ func VerifyDir(opts DirOptions) (*DirResult, error) {
3738
opts.SchemaPath = filepath.Join("spec", "receipt.schema.json")
3839
}
3940

40-
// For “enterprise serious” posture, chain implies strict leaf validation.
4141
if opts.StrictChain {
4242
opts.StrictHashes = true
4343
opts.StrictSignature = true
@@ -48,13 +48,11 @@ func VerifyDir(opts DirOptions) (*DirResult, error) {
4848
return nil, err
4949
}
5050

51-
// Build resolver once (used for chain checks).
5251
resolver, err := receipt.NewDirResolver(dir)
5352
if err != nil {
5453
return nil, err
5554
}
5655

57-
// Collect JSON files deterministically.
5856
var files []string
5957
walkErr := filepath.WalkDir(dir, func(path string, d fs.DirEntry, werr error) error {
6058
if werr != nil {
@@ -81,17 +79,18 @@ func VerifyDir(opts DirOptions) (*DirResult, error) {
8179
StrictSignature: opts.StrictSignature,
8280
StrictApprovals: opts.StrictApprovals,
8381
PublicKeyPath: opts.PublicKeyPath,
82+
PublicKeyDir: opts.PublicKeyDir,
8483
})
8584
return err
8685
}
8786

88-
// Parent validator is always strict when StrictChain is on (and includes approvals if requested).
8987
validateParentStrict := func(r receipt.Receipt) error {
9088
_, _, _, err := ValidateReceiptObject(r, schema, ReceiptValidationOptions{
9189
StrictHashes: true,
9290
StrictSignature: true,
9391
StrictApprovals: opts.StrictApprovals,
9492
PublicKeyPath: opts.PublicKeyPath,
93+
PublicKeyDir: opts.PublicKeyDir,
9594
})
9695
return err
9796
}

0 commit comments

Comments
 (0)