diff --git a/core/cautils/datastructuresmethods.go b/core/cautils/datastructuresmethods.go index 86523b84..0191edf3 100644 --- a/core/cautils/datastructuresmethods.go +++ b/core/cautils/datastructuresmethods.go @@ -3,7 +3,6 @@ package cautils import ( "golang.org/x/mod/semver" - "github.com/armosec/utils-go/boolutils" "github.com/kubescape/opa-utils/reporthandling" "github.com/kubescape/opa-utils/reporthandling/apis" ) @@ -33,7 +32,7 @@ func (policies *Policies) Set(frameworks []reporthandling.Framework, version str } } - if !ruleWithKSOpaDependency(frameworks[i].Controls[j].Rules[r].Attributes) && isRuleKubescapeVersionCompatible(frameworks[i].Controls[j].Rules[r].Attributes, version) && isControlFitToScanScope(frameworks[i].Controls[j], scanningScope) { + if isRuleKubescapeVersionCompatible(frameworks[i].Controls[j].Rules[r].Attributes, version) && isControlFitToScanScope(frameworks[i].Controls[j], scanningScope) { compatibleRules = append(compatibleRules, frameworks[i].Controls[j].Rules[r]) } } @@ -55,18 +54,6 @@ func (policies *Policies) Set(frameworks []reporthandling.Framework, version str } } -func ruleWithKSOpaDependency(attributes map[string]interface{}) bool { - if attributes == nil { - return false - } - if val, ok := attributes["armoOpa"]; ok { // TODO - make global - if s, ok := val.(string); ok { - return boolutils.StringToBool(s) - } - } - return false -} - // Checks that kubescape version is in range of use for this rule // In local build (BuildNumber = ""): // returns true only if rule doesn't have the "until" attribute diff --git a/core/cautils/datastructuresmethods_test.go b/core/cautils/datastructuresmethods_test.go index 45f9322a..1c02b36e 100644 --- a/core/cautils/datastructuresmethods_test.go +++ b/core/cautils/datastructuresmethods_test.go @@ -9,37 +9,6 @@ import ( "github.com/stretchr/testify/assert" ) -func TestRuleWithKSOpaDependency(t *testing.T) { - t.Run("return false when attributes is nil", func(t *testing.T) { - result := ruleWithKSOpaDependency(nil) - assert.False(t, result) - }) - - t.Run("returns false when attributes does not contain armoOpa key", func(t *testing.T) { - attributes := map[string]interface{}{ - "key": "value", - } - result := ruleWithKSOpaDependency(attributes) - assert.False(t, result) - }) - - t.Run("returns false when attributes contain armoOpa key with non bool value", func(t *testing.T) { - attributes := map[string]interface{}{ - "armoOpa": true, - } - result := ruleWithKSOpaDependency(attributes) - assert.False(t, result) - }) - - t.Run("returns true when attributes contain armoOpa key with value true", func(t *testing.T) { - attributes := map[string]interface{}{ - "armoOpa": "true", - } - result := ruleWithKSOpaDependency(attributes) - assert.True(t, result) - }) -} - func TestIsScanningScopeMatchToControlScope(t *testing.T) { tests := []struct { scanScope reporthandling.ScanningScopeType