Skip to content

Commit

Permalink
fix: use RegisteredRule from trivy-policies
Browse files Browse the repository at this point in the history
  • Loading branch information
nikpivkin committed Sep 19, 2023
1 parent 0aa9444 commit 30a23e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
1 change: 0 additions & 1 deletion pkg/scanners/dockerfile/scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ END REGO RESULTSET
`,
},
// TODO fix this test
{
name: "new schema selector but invalid",
inputRegoPolicy: `# METADATA
Expand Down
13 changes: 4 additions & 9 deletions pkg/scanners/terraform/executor/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ import (
"github.com/aquasecurity/trivy-policies/pkg/types"
)

type RegisteredRule interface {
GetRule() scan.Rule
Evaluate(s *state.State) scan.Results
}

type Pool struct {
size int
modules terraform.Modules
Expand Down Expand Up @@ -75,15 +70,15 @@ func (p *Pool) Run() (scan.Results, error) {
mod := *module
outgoing <- &hclModuleRuleJob{
module: &mod,
rule: &r,
rule: r,
ignoreErrors: p.ignoreErrors,
}
}
} else {
// run defsec rule
outgoing <- &infraRuleJob{
state: p.state,
rule: &r,
rule: r,
ignoreErrors: p.ignoreErrors,
}
}
Expand All @@ -109,14 +104,14 @@ type Job interface {

type infraRuleJob struct {
state *state.State
rule RegisteredRule
rule types.RegisteredRule

ignoreErrors bool
}

type hclModuleRuleJob struct {
module *terraform.Module
rule RegisteredRule
rule types.RegisteredRule
ignoreErrors bool
}

Expand Down

0 comments on commit 30a23e6

Please sign in to comment.