Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .templates/new-scanner/integration-tests/jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
40 changes: 40 additions & 0 deletions .templates/new-scanner/integration-tests/new-scanner.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0

const {scan} = require("../../helpers");

jest.retryTimes(3);

test(
"localhost scan should find at least one finding",
async () => {
const { categories, severities, count } = await scan(
"new-scanner-localhost",
"new-scanner",
["localhost"],
90
);

// TODO: Implement at least one scanner specific integration test
expect(count).toBeGreaterThanOrEqual(1);
expect(severities).toMatchInlineSnapshot(`
Object {
"INFORMATIONAL": 1,
}
`);
},
3 * 60 * 1000
);

test(
"invalid scan parameters should be marked as errored",
async () => {
await expect(
scan("new-scanner-localhost", "new-scanner", ["-invalidFlag", "localhost"], 90)
).rejects.toThrow(
'Scan failed with description "Failed to run the Scan Container, check k8s Job and its logs for more details"'
);
},
3 * 60 * 1000
);
2 changes: 2 additions & 0 deletions .templates/new-scanner/templates/new-scanner-scan-type.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ spec:
{{- toYaml .Values.scanner.affinity | nindent 12 }}
tolerations:
{{- toYaml .Values.scanner.tolerations | nindent 12 }}
securityContext:
{{- toYaml .Values.scanner.podSecurityContext | nindent 12 }}
containers:
- name: new-scanner
image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}"
Expand Down
8 changes: 7 additions & 1 deletion .templates/new-scanner/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ imagePullSecrets: []
parser:
image:
# parser.image.repository -- Parser image repository
repository: docker.io/securecodebox/scanner-new-scanner
repository: docker.io/securecodebox/parser-new-scanner
# parser.image.tag -- Parser image tag
# @default -- defaults to the charts version
tag: null
Expand All @@ -17,6 +17,7 @@ parser:

# parser.ttlSecondsAfterFinished -- seconds after which the kubernetes job for the parser will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/
ttlSecondsAfterFinished: null

# parser.env -- Optional environment variables mapped into each parseJob (see: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/)
env: []

Expand Down Expand Up @@ -75,6 +76,11 @@ scanner:
# scanner.extraContainers -- Optional additional Containers started with each scanJob (see: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/)
extraContainers: []

# scanner.podSecurityContext -- Optional securityContext set on scanner pod (see: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
podSecurityContext:
{}
# fsGroup: 2000

# scanner.securityContext -- Optional securityContext set on scanner container (see: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
securityContext:
# scanner.securityContext.runAsNonRoot -- Enforces that the scanner image is run as a non root user
Expand Down