From e0f1217b84f643eacb06a39bb8088601b5db0eff Mon Sep 17 00:00:00 2001 From: rcohencyberarmor Date: Mon, 17 Jul 2023 08:32:14 +0300 Subject: [PATCH 1/2] control fields for scanning scope Signed-off-by: rcohencyberarmor --- reporthandling/datastructures.go | 34 +++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/reporthandling/datastructures.go b/reporthandling/datastructures.go index 85ac930d..9da8c8eb 100644 --- a/reporthandling/datastructures.go +++ b/reporthandling/datastructures.go @@ -33,6 +33,21 @@ type ControlConfigInputs struct { Description string `json:"description" bson:"description"` } +type ScanningScopeType string + +const ( + ScopeCloudAKS ScanningScopeType = "AKS" + ScopeCloudGKE ScanningScopeType = "GKE" + ScopeCloudEKS ScanningScopeType = "EKS" + ScopeCloud ScanningScopeType = "cloud" + ScopeCluster ScanningScopeType = "cluster" + ScopeFile ScanningScopeType = "file" +) + +type ScanningScope struct { + Matches [][]ScanningScopeType `json:"matches"` +} + // PolicyRule represents single rule, the fundamental executable block of policy type PolicyRule struct { armotypes.PortalBase `json:",inline" bson:"inline"` @@ -56,15 +71,16 @@ type Control struct { FixedInput map[string][]string `json:"fixedInput,omitempty"` RulesIDs *[]string `json:"rulesIDs,omitempty" bson:"rulesIDs,omitempty"` armotypes.PortalBase `json:",inline" bson:"inline"` - Control_ID string `json:"id,omitempty" bson:"id,omitempty" ` - ControlID string `json:"controlID" bson:"controlID"` - CreationTime string `json:"creationTime" bson:"creationTime"` - Description string `json:"description" bson:"description"` - Remediation string `json:"remediation" bson:"remediation"` - Rules []PolicyRule `json:"rules" bson:"rules,omitempty"` - FrameworkNames []string `json:"frameworkNames,omitempty" bson:"frameworkNames,omitempty"` - BaseScore float32 `json:"baseScore,omitempty" bson:"baseScore,omitempty"` - ARMOImprovementFactor float32 `json:"ARMOImprovementFactor,omitempty" bson:"ARMOImprovementFactor,omitempty"` + Control_ID string `json:"id,omitempty" bson:"id,omitempty" ` + ControlID string `json:"controlID" bson:"controlID"` + CreationTime string `json:"creationTime" bson:"creationTime"` + Description string `json:"description" bson:"description"` + Remediation string `json:"remediation" bson:"remediation"` + Rules []PolicyRule `json:"rules" bson:"rules,omitempty"` + FrameworkNames []string `json:"frameworkNames,omitempty" bson:"frameworkNames,omitempty"` + BaseScore float32 `json:"baseScore,omitempty" bson:"baseScore,omitempty"` + ARMOImprovementFactor float32 `json:"ARMOImprovementFactor,omitempty" bson:"ARMOImprovementFactor,omitempty"` + ScanningScope ScanningScope `json:"scanningScope" bson:"scanningScope"` } type UpdatedControl struct { From 0b8953a7ceb6b0be29d8821a70195aa482bf36f4 Mon Sep 17 00:00:00 2001 From: rcohencyberarmor Date: Wed, 19 Jul 2023 11:49:04 +0300 Subject: [PATCH 2/2] change whitelist structure Signed-off-by: rcohencyberarmor --- reporthandling/datastructures.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reporthandling/datastructures.go b/reporthandling/datastructures.go index 9da8c8eb..37d6fc7a 100644 --- a/reporthandling/datastructures.go +++ b/reporthandling/datastructures.go @@ -45,7 +45,7 @@ const ( ) type ScanningScope struct { - Matches [][]ScanningScopeType `json:"matches"` + Matches []ScanningScopeType `json:"matches"` } // PolicyRule represents single rule, the fundamental executable block of policy