Skip to content

Commit

Permalink
temporary fix for k8s policy filtering issue (tenable#963)
Browse files Browse the repository at this point in the history
  • Loading branch information
patilpankaj212 authored Aug 6, 2021
1 parent c1b2d57 commit a3e0b6e
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 r.PolicyType == "k8s" && strings.Contains(strings.ToLower(rs.resourceType), "kubernetes") {
return true
}

return rs.resourceType == r.ResourceType
}

Expand Down

0 comments on commit a3e0b6e

Please sign in to comment.