Skip to content

Commit

Permalink
temporary fix for k8s policy filtering issue
Browse files Browse the repository at this point in the history
  • Loading branch information
patilpankaj212 committed Aug 5, 2021
1 parent 11db729 commit 28b1a1f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/filters/filter-specs.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package filters

import (
"strings"

"github.com/accurics/terrascan/pkg/policy"
"github.com/accurics/terrascan/pkg/utils"
"go.uber.org/zap"
Expand Down Expand Up @@ -48,6 +50,14 @@ func (rs ResourceTypeFilterSpecification) IsSatisfied(r *policy.RegoMetadata) bo
if len(r.ResourceType) < 1 {
return true
}

// temporary fix for kubernetes policies (https://github.com/accurics/terrascan/issues/946)
// TODO: modification in policy metadata (resource type (string) => resource type (map<string,bool))
// accordingly modify the filter specification
if strings.Contains(strings.ToLower(rs.resourceType), "kubernetes") && r.PolicyType == "k8s" {
return true
}

return rs.resourceType == r.ResourceType
}

Expand Down

0 comments on commit 28b1a1f

Please sign in to comment.