Skip to content

Commit c09ae47

Browse files
support related objects (kubescape#112)
* add type field to framework Signed-off-by: YiscahLevySilas1 <[email protected]> * add list of types to framework and control obj Signed-off-by: YiscahLevySilas1 <[email protected]> * change field names Signed-off-by: YiscahLevySilas1 <[email protected]> * undo field typeTags in controls Signed-off-by: YiscahLevySilas1 <[email protected]> * support related objects in failed resources Signed-off-by: YiscahLevySilas1 <[email protected]> --------- Signed-off-by: YiscahLevySilas1 <[email protected]>
1 parent ed1678a commit c09ae47

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

reporthandling/datastructuresv1.go

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,26 @@ const (
2121

2222
// RegoResponse the expected response of single run of rego policy
2323
type RuleResponse struct {
24-
AlertMessage string `json:"alertMessage"`
25-
FailedPaths []string `json:"failedPaths"` // path in yaml that led to failure of this resource
26-
FixPaths []armotypes.FixPath `json:"fixPaths"` // path in yaml to be added to fix this resource
27-
FixCommand string `json:"fixCommand,omitempty"` // command to fix this resource
28-
RuleStatus string `json:"ruleStatus"`
29-
PackageName string `json:"packagename"`
30-
AlertScore AlertScore `json:"alertScore"`
31-
AlertObject AlertObject `json:"alertObject"`
32-
Context []string `json:"context,omitempty"` // TODO - Remove
33-
Rulename string `json:"rulename,omitempty"` // TODO - Remove
34-
Exception *armotypes.PostureExceptionPolicy `json:"exception,omitempty"`
24+
AlertMessage string `json:"alertMessage"`
25+
FailedPaths []string `json:"failedPaths"` // path in yaml that led to failure of this resource
26+
FixPaths []armotypes.FixPath `json:"fixPaths"` // path in yaml to be added to fix this resource
27+
FixCommand string `json:"fixCommand,omitempty"` // command to fix this resource
28+
RuleStatus string `json:"ruleStatus"`
29+
PackageName string `json:"packagename"`
30+
AlertScore AlertScore `json:"alertScore"`
31+
AlertObject AlertObject `json:"alertObject"`
32+
RelatedObjects []RelatedObject `json:"relatedObjects,omitempty"`
33+
Context []string `json:"context,omitempty"` // TODO - Remove
34+
Rulename string `json:"rulename,omitempty"` // TODO - Remove
35+
Exception *armotypes.PostureExceptionPolicy `json:"exception,omitempty"`
36+
}
37+
38+
// RelatedObjects - resource that is related to the failure of the main resource
39+
type RelatedObject struct {
40+
Object map[string]interface{} `json:"object"`
41+
FailedPaths []string `json:"failedPaths"` // path in yaml that led to failure of this resource
42+
FixPaths []armotypes.FixPath `json:"fixPaths"` // path in yaml to be added to fix this resource
43+
FixCommand string `json:"fixCommand,omitempty"` // command to fix this resource
3544
}
3645

3746
type AlertObject struct {

reporthandling/results/v1/resourcesresults/datastructures.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ type ResourceAssociatedRule struct {
3232
SubStatus apis.ScanningSubStatus `json:"subStatus"`
3333
Paths []armotypes.PosturePaths `json:"paths,omitempty"`
3434
Exception []armotypes.PostureExceptionPolicy `json:"exception,omitempty"`
35+
RelatedResourcesIDs []string `json:"relatedResourcesIDs,omitempty"`
3536
}

0 commit comments

Comments
 (0)