You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/docs/api/crds/scan.md
+71-49Lines changed: 71 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ sidebar_position: 2
8
8
---
9
9
10
10
The Scan Custom Resource Definition (CRD) lets you define how a specific scan should be configured.
11
-
The secureCodeBox Operator will then use this specification to execute the scan.
11
+
The secureCodeBox Operator uses this specification to execute the scan.
12
12
13
13
## Specification (Spec)
14
14
@@ -18,16 +18,16 @@ The `scanType` references the **name** of a [ScanType Custom Resource](/docs/api
18
18
19
19
### Parameters (Required)
20
20
21
-
`parameters` is a string array of command line flags which are passed to the scanner.
21
+
`parameters` is a string array of command line flags that are passed to the scanner.
22
22
23
-
These usually contain scannerspecific configurations and target specification.
23
+
These typically contain scanner-specific configurations and target specifications.
24
24
25
25
### Env (Optional)
26
26
27
-
`env` lets you pass in custom environment variables to the scan container.
28
-
This can be useful to pass in secret values like login credentials scanner require without having to define them in plain text.
27
+
`env` lets you pass custom environment variables to the scan container.
28
+
This can be useful for passing secret values like login credentials that scanners require without defining them in plain text.
29
29
30
-
Env has the same API as "env" property on Kubernetes Pods.
30
+
The `env` field has the same API as the "env" property on Kubernetes Pods.
31
31
32
32
See:
33
33
@@ -36,9 +36,9 @@ See:
36
36
37
37
### Volumes (Optional)
38
38
39
-
`volumes` lets you specify Kubernetes volumes that you want to use and make available to the scan container.
40
-
Similarly to `env`, it can be used to pass data into a container.
41
-
It has to be combined with [`volumeMounts`](#volumemounts-optional) to be useful (see below).
39
+
`volumes` lets you specify Kubernetes volumes to make available to the scan container.
40
+
Similar to `env`, it can be used to pass data into a container.
41
+
It must be combined with [`volumeMounts`](#volumemounts-optional) to be useful (see below).
42
42
It can also be used in combination with `initContainers` to provision files, VCS repositories, or other content into a scanner - see [`initContainers`](#initcontainers-optional) for an example.
43
43
44
44
`volumes` has the same API as the `volumes` property on Kubernetes pods.
@@ -50,7 +50,7 @@ See:
50
50
51
51
### VolumeMounts (Optional)
52
52
53
-
`volumeMounts`let you specify where you want the previously-created volumes to be mounted inside the container.
53
+
`volumeMounts`lets you specify where previously-created volumes should be mounted inside the container.
54
54
It is used in combination with [`volumes`](#volumes-optional) (see above).
55
55
56
56
`volumeMounts` has the same API as the `volumeMounts` property on Kubernetes pods.
@@ -62,10 +62,10 @@ See:
62
62
63
63
### InitContainers (Optional)
64
64
65
-
`initContainers` lets you specify a (set of) container(s) that are run before the scan itself.
66
-
You can specify arbitrary containers with any command that you desire.
67
-
By default, init containers do not share a file system with the scan job.
68
-
If you want to use init containers to provision files or directories for the scan job, you need to explicitly create a volume and mount it to both the init container and the scan job itself (using the [`volumeMounts`](#volumemounts-optional) discussed above).
65
+
`initContainers` lets you specify one or more containers that run before the scan itself.
66
+
You can specify arbitrary containers with any commands you need.
67
+
By default, init containers do not share a filesystem with the scan job.
68
+
To use init containers for provisioning files or directories for the scan job, you must explicitly create a volume and mount it to both the init container and the scan job using [`volumeMounts`](#volumemounts-optional).
69
69
For example, if you want to download a file that contains a list of scan targets for nmap, you could configure the scan like this:
[`affinity`](https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/) and [`tolerations`](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) can be used to control which nodes the parser is executed on.
117
+
The `resourceMode` specifies whether the scan should use namespace-local or cluster-wide resources (ScanType vs. ClusterScanType). Valid values are:
118
+
119
+
- `"namespaceLocal"` (default): Uses ScanType resources from the same namespace
120
+
- `"clusterWide"`: Uses ClusterScanType resources available cluster-wide
121
+
122
+
### NodeSelector (Optional)
123
+
124
+
[`nodeSelector`](https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/) allows you to specify a simple node selection constraint to control which nodes the scan can be scheduled on.
125
+
126
+
```yaml
127
+
nodeSelector:
128
+
kubernetes.io/arch: amd64
129
+
node-type: scanner
130
+
```
131
+
132
+
### Affinity and Tolerations (Optional)
133
+
134
+
[`affinity`](https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/) and [`tolerations`](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) can be used to control which nodes the scan is executed on with more advanced rules than nodeSelector.
118
135
119
136
### Cascades (Optional)
120
137
121
138
`cascades`let you start new scans based on the results of the current scan.
122
139
123
140
The cascades config in the scans spec contains [Kubernetes Label Selectors](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/label-selector/) which allow you to select which [CascadingRule](https://www.securecodebox.io/docs/api/crds/cascading-rule) are allowed to be used by the cascading logic.
124
141
125
-
Furthermore, in the cascade config you can specify whether cascading scan should inherit parent fields:
142
+
Furthermore, in the cascade config you can specify whether cascading scans should inherit fields from the parent scan:
126
143
127
144
- `inheritLabels`: `true`
128
145
- `inheritAnnotations`: `true`
@@ -134,8 +151,8 @@ Furthermore, in the cascade config you can specify whether cascading scan should
134
151
- `inheritTolerations`: `true`
135
152
136
153
These fields will merge the parent's entries with entries defined in the cascading rules.
137
-
Entries defined in cascading rules will only apply to the current scan.
138
-
There are two exceptions to this rule: in the case of Affinity and Tolerations, entries will be replaced instead of merged, and will be used for all following scans.
154
+
Entries defined in cascading rules apply only to the current scan.
155
+
There are two exceptions: for Affinity and Tolerations, entries are replaced rather than merged and apply to all subsequent scans.
139
156
140
157
:::caution
141
158
Defining identical entries in both the Scan AND the Cascading Rule resource will lead to undefined behaviour.
@@ -147,9 +164,9 @@ For an example on how they can be used see the [Scanning Networks HowTo](https:/
147
164
148
165
#### ScopeLimiter (Optional)
149
166
150
-
`scopeLimiter`allows you to define certain rules to which cascading scans must comply before they may cascade.
151
-
For example, you can define that you can only trigger a follow-up scan against a host if its IP address is within your predefined IP range.
152
-
You can use Mustache templating in order to select certain properties from findings.
167
+
`scopeLimiter`allows you to define rules that cascading scans must comply with before they may cascade.
168
+
For example, you can define that follow-up scans against a host are only allowed if its IP address is within a predefined IP range.
169
+
You can use Mustache templating to select specific properties from findings.
153
170
154
171
Under `scopeLimiter`, you may specify `anyOf`, `noneOf`, and `allOf` with a selector to limit your scope.
155
172
If you specify multiple fields, all the rules must pass.
@@ -171,16 +188,18 @@ These annotations can only be added on the initial scan (i.e., they cannot be mo
171
188
172
189
`values`is a list of values for which the selector should pass.
173
190
191
+
The `validOnMissingRender` field in scopeLimiter defines whether a condition should match when a templating variable is not present in the finding. Defaults to `false`.
192
+
174
193
##### Selecting lists
175
194
176
195
A custom rendering function has been provided to select attributes in findings that are in a list. An example finding:
@@ -202,17 +221,17 @@ Some findings have data in lists of objects, such as the following:
202
221
203
222
```json title="Finding"
204
223
{
205
-
name: "Subdomains found",
206
-
category: "Subdomain"
207
-
attributes: {
208
-
addresses: [
224
+
"name": "Subdomains found",
225
+
"category": "Subdomain",
226
+
"attributes": {
227
+
"addresses": [
209
228
{
210
-
domain: "example.com",
211
-
ip: "127.0.0.1",
229
+
"domain": "example.com",
230
+
"ip": "127.0.0.1"
212
231
},
213
232
{
214
-
domain: "subdomain.example.com",
215
-
ip: "127.0.0.2",
233
+
"domain": "subdomain.example.com",
234
+
"ip": "127.0.0.2"
216
235
}
217
236
]
218
237
}
@@ -235,10 +254,10 @@ You can also manually split values from findings if your finding is like so:
235
254
236
255
```json title="Finding"
237
256
{
238
-
name: "Subdomains found",
239
-
category: "Subdomain"
240
-
attributes: {
241
-
domains: "example.com,subdomain.example.com",
257
+
"name": "Subdomains found",
258
+
"category": "Subdomain",
259
+
"attributes": {
260
+
"domains": "example.com,subdomain.example.com"
242
261
}
243
262
}
244
263
```
@@ -306,9 +325,9 @@ See the [Scope HowTo](/docs/how-tos/scope) for more information.
306
325
307
326
`hookSelector`allows you to select which hooks to run using [Kubernetes Label Selectors](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/label-selector/).
308
327
309
-
You can only select hooks in the namespace in which the scan is running.
328
+
You can only select hooks within the namespace where the scan is running.
310
329
311
-
Leaving this field undefined will select all available hooks in this namespace.
330
+
Leaving this field undefined selects all available hooks in the namespace.
312
331
313
332
```yaml
314
333
hookSelector:
@@ -328,7 +347,7 @@ For more examples on how this field can be used, see the [Hook HowTo](/docs/how-
328
347
329
348
### Resources (Optional)
330
349
331
-
`resources`lets you overwrite the resource limits and requests for the primary scanner container from the values defined in the [ScanType](./scan-type). See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
350
+
`resources`lets you override the resource limits and requests for the primary scanner container from the values defined in the [ScanType](./scan-type). See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
332
351
333
352
```yaml
334
353
resources:
@@ -348,7 +367,7 @@ ttlSecondsAfterFinished: 30 #deletes the scan after 30 seconds after completion
348
367
```
349
368
350
369
:::note
351
-
ttlSecondsAfterFinished can also be set for the scan (as part of the [jobTemplate](https://www.securecodebox.io/docs/api/crds/scan-type#jobtemplate-required)), [parser](https://www.securecodebox.io/docs/api/crds/parse-definition) and [hook](https://www.securecodebox.io/docs/api/crds/scan-completion-hook#ttlsecondsafterfinished-optional) jobs individually. Setting these will only deleted the jobs not the entire scan.
370
+
ttlSecondsAfterFinished can also be set for the scan (as part of the [jobTemplate](https://www.securecodebox.io/docs/api/crds/scan-type#jobtemplate-required)), [parser](https://www.securecodebox.io/docs/api/crds/parse-definition) and [hook](https://www.securecodebox.io/docs/api/crds/scan-completion-hook#ttlsecondsafterfinished-optional) jobs individually. Setting these will only delete the jobs, not the entire scan.
352
371
:::
353
372
354
373
## Metadata
@@ -358,7 +377,7 @@ Metadata is a standard field on Kubernetes resources. It contains multiple relev
358
377
## Status
359
378
360
379
Defines the observed state of a Scan. This will be filled by Kubernetes.
361
-
It contains (see: [Go Type ScanStatus](https://github.com/secureCodeBox/secureCodeBox/blob/main/operator/apis/execution/v1/scan_types.go#L49))
380
+
It contains (see: [Go Type ScanStatus](https://github.com/secureCodeBox/secureCodeBox/blob/main/operator/apis/execution/v1/scan_types.go#L169))
362
381
363
382
- `State`: State of the scan (See: [secureCodeBox | ScanControler](https://github.com/secureCodeBox/secureCodeBox/blob/main/operator/controllers/execution/scans/scan_controller.go#L105))
364
383
- `FinishedAt`: Time when scan, parsers and hooks for this scan are marked as 'Done'
@@ -367,22 +386,22 @@ It contains (see: [Go Type ScanStatus](https://github.com/secureCodeBox/secureCo
367
386
- `RawResultFile`: Filename of the result file of the scanner. e.g. `nmap-result.xml`
368
387
- `FindingDownloadLink`: Link to download the finding json file from. Valid for 7 days
369
388
- `RawResultDownloadLink`: RawResultDownloadLink link to download the raw result file from. Valid for 7 days
370
-
- `Findings`: FindingStats (See [Go Type FindingStats](https://github.com/secureCodeBox/secureCodeBox/blob/main/operator/apis/execution/v1/scan_types.go#L89))
389
+
- `Findings`: FindingStats (See [Go Type FindingStats](https://github.com/secureCodeBox/secureCodeBox/blob/main/operator/apis/execution/v1/scan_types.go#L218))
371
390
- `ReadAndWriteHookStatus`: Status of the Read and Write Hooks
372
391
373
392
## Example
374
393
375
394
```yaml
376
395
apiVersion: "execution.securecodebox.io/v1"
377
396
kind: Scan
378
-
status: # Set during runtime. Do not edit via values.yaml etc.
0 commit comments