Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 4fd5021

Browse files
committed
Change the FindingStats Object structure
This'll allow it to be included in Other CRDs like Scheduled Scans and Targets
1 parent eb58fdc commit 4fd5021

File tree

3 files changed

+70
-43
lines changed

3 files changed

+70
-43
lines changed

operator/apis/execution/v1/scan_types.go

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,33 @@ type ScanStatus struct {
4343

4444
StartTime *metav1.Time `json:"startTime,omitempty"`
4545

46-
// FindingCount indicates how many findings were identified in total
47-
FindingCount uint64 `json:"findingCount,omitempty"`
46+
Findings FindingStats `json:"findings,omitempty"`
47+
}
48+
49+
// FindingStats contains the general stats about the results of the scan
50+
type FindingStats struct {
51+
// Count indicates how many findings were identified in total
52+
Count uint64 `json:"count,omitempty"`
4853
// FindingSeverities indicates the count of finding with the respective severity
49-
FindingSeverities FindingSeverities `json:"findingSeverities,omitempty"`
54+
FindingSeverities FindingSeverities `json:"severities,omitempty"`
5055
// FindingCategories indicates the count of finding broken down by their categories
51-
FindingCategories map[string]uint64 `json:"findingCategories,omitempty"`
56+
FindingCategories map[string]uint64 `json:"categories,omitempty"`
5257
}
5358

5459
// FindingSeverities indicates the count of finding with the respective severity
5560
type FindingSeverities struct {
56-
InformationalCount uint64 `json:"informationalCount,omitempty"`
57-
LowCount uint64 `json:"lowCount,omitempty"`
58-
MediumCount uint64 `json:"mediumCount,omitempty"`
59-
HighCount uint64 `json:"highCount,omitempty"`
61+
Informational uint64 `json:"informational,omitempty"`
62+
Low uint64 `json:"low,omitempty"`
63+
Medium uint64 `json:"medium,omitempty"`
64+
High uint64 `json:"high,omitempty"`
6065
}
6166

6267
// +kubebuilder:object:root=true
6368
// +kubebuilder:subresource:status
6469
// +kubebuilder:printcolumn:name="UID",type=string,JSONPath=`.metadata.uid`,description="K8s Resource UID",priority=1
6570
// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.scanType`,description="Scan Type"
6671
// +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state`,description="Scan State"
67-
// +kubebuilder:printcolumn:name="Findings",type=string,JSONPath=`.status.findingCount`,description="Total Finding Count"
72+
// +kubebuilder:printcolumn:name="Findings",type=string,JSONPath=`.status.findings.count`,description="Total Finding Count"
6873
// +kubebuilder:printcolumn:name="Parameters",type=string,JSONPath=`.spec.parameters`,description="Arguments passed to the Scanner",priority=1
6974

7075
// Scan is the Schema for the scans API
@@ -78,6 +83,7 @@ type Scan struct {
7883

7984
// +kubebuilder:object:root=true
8085

86+
// ScanList type wrapping multiple Scans
8187
type ScanList struct {
8288
metav1.TypeMeta `json:",inline"`
8389
metav1.ListMeta `json:"metadata,omitempty"`

operator/apis/execution/v1/zz_generated.deepcopy.go

Lines changed: 24 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

operator/config/crd/bases/execution.experimental.securecodebox.io_scans.yaml

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
description: Scan State
2323
name: State
2424
type: string
25-
- JSONPath: .status.findingCount
25+
- JSONPath: .status.findings.count
2626
description: Total Finding Count
2727
name: Findings
2828
type: string
@@ -69,34 +69,39 @@ spec:
6969
status:
7070
description: ScanStatus defines the observed state of Scan
7171
properties:
72-
findingCategories:
73-
additionalProperties:
74-
format: int64
75-
type: integer
76-
description: FindingCategories indicates the count of finding broken
77-
down by their categories
78-
type: object
79-
findingCount:
80-
description: FindingCount indicates how many findings were identified
81-
in total
82-
format: int64
83-
type: integer
84-
findingSeverities:
85-
description: FindingSeverities indicates the count of finding with the
86-
respective severity
72+
findings:
73+
description: FindingStats contains the general stats about the results
74+
of the scan
8775
properties:
88-
highCount:
89-
format: int64
90-
type: integer
91-
informationalCount:
92-
format: int64
93-
type: integer
94-
lowCount:
95-
format: int64
96-
type: integer
97-
mediumCount:
76+
categories:
77+
additionalProperties:
78+
format: int64
79+
type: integer
80+
description: FindingCategories indicates the count of finding broken
81+
down by their categories
82+
type: object
83+
count:
84+
description: Count indicates how many findings were identified in
85+
total
9886
format: int64
9987
type: integer
88+
severities:
89+
description: FindingSeverities indicates the count of finding with
90+
the respective severity
91+
properties:
92+
high:
93+
format: int64
94+
type: integer
95+
informational:
96+
format: int64
97+
type: integer
98+
low:
99+
format: int64
100+
type: integer
101+
medium:
102+
format: int64
103+
type: integer
104+
type: object
100105
type: object
101106
rawResultFile:
102107
description: RawResultFile Filename of the result file of the scanner.

0 commit comments

Comments
 (0)