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

Commit f5c4fd2

Browse files
committed
Add status fields for findings and added additional kubectl printcolumns
1 parent 3893d91 commit f5c4fd2

File tree

3 files changed

+78
-1
lines changed

3 files changed

+78
-1
lines changed

operator/api/v1/scan_types.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,30 @@ type ScanStatus struct {
4040
RawResultType string `json:"rawResultType,omitempty"`
4141
// RawResultFile Filename of the result file of the scanner. e.g. `nmap-result.xml`
4242
RawResultFile string `json:"rawResultFile,omitempty"`
43+
44+
// FindingCount indicates how many findings were identified in total
45+
FindingCount uint64 `json:"findingCount,omitempty"`
46+
// FindingSeverities indicates the count of finding with the respective severity
47+
FindingSeverities FindingSeverities `json:"findingSeverities,omitempty"`
48+
// FindingCategories indicates the count of finding broken down by their categories
49+
FindingCategories map[string]uint64 `json:"findingCategories,omitempty"`
50+
}
51+
52+
// FindingSeverities indicates the count of finding with the respective severity
53+
type FindingSeverities struct {
54+
InformationalCount uint64 `json:"informationalCount,omitempty"`
55+
LowCount uint64 `json:"lowCount,omitempty"`
56+
MediumCount uint64 `json:"mediumCount,omitempty"`
57+
HighCount uint64 `json:"highCount,omitempty"`
4358
}
4459

4560
// +kubebuilder:object:root=true
4661

4762
// Scan is the Schema for the scans API
4863
// +kubebuilder:subresource:status
64+
// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.scanType`,description="Scan Type"
4965
// +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state`,description="Scan State"
66+
// +kubebuilder:printcolumn:name="Findings",type=string,JSONPath=`.status.findingCount`,description="Total Finding Count"
5067
type Scan struct {
5168
metav1.TypeMeta `json:",inline"`
5269
metav1.ObjectMeta `json:"metadata,omitempty"`

operator/api/v1/zz_generated.deepcopy.go

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

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@ metadata:
77
name: scans.scans.experimental.securecodebox.io
88
spec:
99
additionalPrinterColumns:
10+
- JSONPath: .spec.scanType
11+
description: Scan Type
12+
name: Type
13+
type: string
1014
- JSONPath: .status.state
1115
description: Scan State
1216
name: State
1317
type: string
18+
- JSONPath: .status.findingCount
19+
description: Total Finding Count
20+
name: Findings
21+
type: string
1422
group: scans.experimental.securecodebox.io
1523
names:
1624
kind: Scan
@@ -47,6 +55,35 @@ spec:
4755
status:
4856
description: ScanStatus defines the observed state of Scan
4957
properties:
58+
findingCategories:
59+
additionalProperties:
60+
format: int64
61+
type: integer
62+
description: FindingCategories indicates the count of finding broken
63+
down by their categories
64+
type: object
65+
findingCount:
66+
description: FindingCount indicates how many findings were identified
67+
in total
68+
format: int64
69+
type: integer
70+
findingSeverities:
71+
description: FindingSeverities indicates the count of finding with the
72+
respective severity
73+
properties:
74+
highCount:
75+
format: int64
76+
type: integer
77+
informationalCount:
78+
format: int64
79+
type: integer
80+
lowCount:
81+
format: int64
82+
type: integer
83+
mediumCount:
84+
format: int64
85+
type: integer
86+
type: object
5087
rawResultFile:
5188
description: RawResultFile Filename of the result file of the scanner.
5289
e.g. `nmap-result.xml`

0 commit comments

Comments
 (0)