From ad51217bd8819e72afd7aa39e49c374e7bd479d0 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 30 Sep 2021 12:08:19 +0200 Subject: [PATCH 1/3] Making scan-type.yaml files consistent 1. Replacing all ' with " 2. Replacing incorrect scanner image ".Chart.Version" with ".Chart.AppVersion" 3. Replacing array command for ncrack, nmap, test-scan, whatweb with single lines for each parameter 4. Removing redundant comments 5. Adding missing empty lines 6. Make order of variables consistent for all scanners Signed-off-by: Sebastian --- scanners/amass/templates/amass-scan-type.yaml | 3 +-- .../templates/git-repo-scanner-scan-type.yaml | 2 +- .../templates/kubehunter-scan-type.yaml | 14 +++++++------- .../templates/kubeaudit-scan-type.yaml | 2 +- scanners/ncrack/templates/ncrack-scan-type.yaml | 5 ++++- scanners/nikto/templates/nikto-scan-type.yaml | 16 +++++++--------- scanners/nmap/templates/nmap-scan-type.yaml | 5 ++++- scanners/nuclei/templates/nuclei-scan-type.yaml | 17 ++++++++--------- .../templates/screenshooter-scan-type.yaml | 4 ++-- scanners/sslyze/templates/sslyze-scan-type.yaml | 12 ++++++------ .../templates/test-scan-scan-type.yaml | 6 ++++-- .../templates/typo3scan-scan-type.yaml | 2 ++ .../whatweb/templates/whatweb-scan-type.yaml | 4 +++- .../templates/zap-advanced-scan-type.yaml | 2 +- 14 files changed, 51 insertions(+), 43 deletions(-) diff --git a/scanners/amass/templates/amass-scan-type.yaml b/scanners/amass/templates/amass-scan-type.yaml index ba009893ca..149578fb1a 100644 --- a/scanners/amass/templates/amass-scan-type.yaml +++ b/scanners/amass/templates/amass-scan-type.yaml @@ -1,14 +1,13 @@ # SPDX-FileCopyrightText: 2021 iteratec GmbH # # SPDX-License-Identifier: Apache-2.0 + apiVersion: "execution.securecodebox.io/v1" kind: ScanType metadata: name: "amass{{ .Values.scanner.nameAppend | default ""}}" spec: extractResults: - # amass saves it's result now in json but in "json lines" format - # http://jsonlines.org/ type: amass-jsonl location: "/home/securecodebox/amass-results.jsonl" jobTemplate: diff --git a/scanners/git-repo-scanner/templates/git-repo-scanner-scan-type.yaml b/scanners/git-repo-scanner/templates/git-repo-scanner-scan-type.yaml index f587c4d6ba..b598d4ed0c 100644 --- a/scanners/git-repo-scanner/templates/git-repo-scanner-scan-type.yaml +++ b/scanners/git-repo-scanner/templates/git-repo-scanner-scan-type.yaml @@ -24,7 +24,7 @@ spec: restartPolicy: OnFailure containers: - name: git-repo-scanner - image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.Version }}" + image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} command: - "python" diff --git a/scanners/kube-hunter/templates/kubehunter-scan-type.yaml b/scanners/kube-hunter/templates/kubehunter-scan-type.yaml index 7a2025e669..431ed28126 100644 --- a/scanners/kube-hunter/templates/kubehunter-scan-type.yaml +++ b/scanners/kube-hunter/templates/kubehunter-scan-type.yaml @@ -2,14 +2,14 @@ # # SPDX-License-Identifier: Apache-2.0 -apiVersion: 'execution.securecodebox.io/v1' +apiVersion: "execution.securecodebox.io/v1" kind: ScanType metadata: - name: 'kube-hunter{{ .Values.scanner.nameAppend | default ""}}' + name: "kube-hunter{{ .Values.scanner.nameAppend | default ""}}" spec: extractResults: type: kube-hunter-json - location: '/home/securecodebox/kube-hunter-results.json' + location: "/home/securecodebox/kube-hunter-results.json" jobTemplate: spec: {{- if .Values.scanner.ttlSecondsAfterFinished }} @@ -27,10 +27,10 @@ spec: image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} command: - - 'sh' - - '/wrapper.sh' - - '--report' - - 'json' + - "sh" + - "/wrapper.sh" + - "--report" + - "json" resources: {{- toYaml .Values.scanner.resources | nindent 16 }} securityContext: diff --git a/scanners/kubeaudit/templates/kubeaudit-scan-type.yaml b/scanners/kubeaudit/templates/kubeaudit-scan-type.yaml index 62efc84c64..ab2a34403d 100644 --- a/scanners/kubeaudit/templates/kubeaudit-scan-type.yaml +++ b/scanners/kubeaudit/templates/kubeaudit-scan-type.yaml @@ -46,5 +46,5 @@ spec: {{- toYaml .Values.scanner.extraContainers | nindent 12 }} {{- end }} volumes: - {{- toYaml .Values.scanner.extraVolumeMounts | nindent 12 }} + {{- toYaml .Values.scanner.extraVolumes | nindent 12 }} serviceAccountName: kubeaudit diff --git a/scanners/ncrack/templates/ncrack-scan-type.yaml b/scanners/ncrack/templates/ncrack-scan-type.yaml index 7515e3c720..8f389cc8ed 100644 --- a/scanners/ncrack/templates/ncrack-scan-type.yaml +++ b/scanners/ncrack/templates/ncrack-scan-type.yaml @@ -26,7 +26,10 @@ spec: - name: ncrack image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} - command: ["ncrack", "-oX", "/home/securecodebox/ncrack-results.xml"] + command: + - "ncrack" + - "-oX" + - "/home/securecodebox/ncrack-results.xml" resources: {{- toYaml .Values.scanner.resources | nindent 16 }} securityContext: diff --git a/scanners/nikto/templates/nikto-scan-type.yaml b/scanners/nikto/templates/nikto-scan-type.yaml index 0f2c447baa..e63ba0e16f 100644 --- a/scanners/nikto/templates/nikto-scan-type.yaml +++ b/scanners/nikto/templates/nikto-scan-type.yaml @@ -2,14 +2,14 @@ # # SPDX-License-Identifier: Apache-2.0 -apiVersion: 'execution.securecodebox.io/v1' +apiVersion: "execution.securecodebox.io/v1" kind: ScanType metadata: - name: 'nikto{{ .Values.scanner.nameAppend | default ""}}' + name: "nikto{{ .Values.scanner.nameAppend | default ""}}" spec: extractResults: type: nikto-json - location: '/home/securecodebox/nikto-results.json' + location: "/home/securecodebox/nikto-results.json" jobTemplate: spec: {{- if .Values.scanner.ttlSecondsAfterFinished }} @@ -27,12 +27,10 @@ spec: image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} command: - # Nikto Entrypoint Script to avoid problems nikto exiting with a non zero exit code - # This would cause the kubernetes job to fail no matter what - - 'sh' - - '/wrapper.sh' - - '-o' - - '/home/securecodebox/nikto-results.json' + - "sh" + - "/wrapper.sh" + - "-o" + - "/home/securecodebox/nikto-results.json" resources: {{- toYaml .Values.scanner.resources | nindent 16 }} securityContext: diff --git a/scanners/nmap/templates/nmap-scan-type.yaml b/scanners/nmap/templates/nmap-scan-type.yaml index 9559c67f9c..a033042075 100644 --- a/scanners/nmap/templates/nmap-scan-type.yaml +++ b/scanners/nmap/templates/nmap-scan-type.yaml @@ -26,7 +26,10 @@ spec: - name: nmap image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} - command: ["nmap", "-oX", "/home/securecodebox/nmap-results.xml"] + command: + - "nmap" + - "-oX" + - "/home/securecodebox/nmap-results.xml" resources: {{- toYaml .Values.scanner.resources | nindent 16 }} securityContext: diff --git a/scanners/nuclei/templates/nuclei-scan-type.yaml b/scanners/nuclei/templates/nuclei-scan-type.yaml index b6cbfd95a3..5b06813508 100644 --- a/scanners/nuclei/templates/nuclei-scan-type.yaml +++ b/scanners/nuclei/templates/nuclei-scan-type.yaml @@ -2,14 +2,14 @@ # # SPDX-License-Identifier: Apache-2.0 -apiVersion: 'execution.securecodebox.io/v1' +apiVersion: "execution.securecodebox.io/v1" kind: ScanType metadata: - name: 'nuclei{{ .Values.scanner.nameAppend | default ""}}' + name: "nuclei{{ .Values.scanner.nameAppend | default ""}}" spec: extractResults: type: nuclei-json - location: '/home/securecodebox/nuclei-results.jsonl' + location: "/home/securecodebox/nuclei-results.jsonl" jobTemplate: spec: {{- if .Values.scanner.ttlSecondsAfterFinished }} @@ -27,12 +27,11 @@ spec: image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} command: - - 'nuclei' - - '-no-update-templates' - - '-json' - # nuclei writes json lines: https://jsonlines.org/ - - '-output' - - '/home/securecodebox/nuclei-results.jsonl' + - "nuclei" + - "-no-update-templates" + - "-json" + - "-output" + - "/home/securecodebox/nuclei-results.jsonl" resources: {{- toYaml .Values.scanner.resources | nindent 16 }} securityContext: diff --git a/scanners/screenshooter/templates/screenshooter-scan-type.yaml b/scanners/screenshooter/templates/screenshooter-scan-type.yaml index a7f93ad93b..d014873d06 100644 --- a/scanners/screenshooter/templates/screenshooter-scan-type.yaml +++ b/scanners/screenshooter/templates/screenshooter-scan-type.yaml @@ -27,8 +27,8 @@ spec: image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.Version }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} command: - - 'sh' - - '/wrapper.sh' + - "sh" + - "/wrapper.sh" - "-screenshot" - "/home/securecodebox/screenshot.png" resources: diff --git a/scanners/sslyze/templates/sslyze-scan-type.yaml b/scanners/sslyze/templates/sslyze-scan-type.yaml index 085b34f334..65880dcd76 100644 --- a/scanners/sslyze/templates/sslyze-scan-type.yaml +++ b/scanners/sslyze/templates/sslyze-scan-type.yaml @@ -2,14 +2,14 @@ # # SPDX-License-Identifier: Apache-2.0 -apiVersion: 'execution.securecodebox.io/v1' +apiVersion: "execution.securecodebox.io/v1" kind: ScanType metadata: - name: 'sslyze{{ .Values.scanner.nameAppend | default ""}}' + name: "sslyze{{ .Values.scanner.nameAppend | default ""}}" spec: extractResults: type: sslyze-json - location: '/home/securecodebox/sslyze-results.json' + location: "/home/securecodebox/sslyze-results.json" jobTemplate: spec: {{- if .Values.scanner.ttlSecondsAfterFinished }} @@ -27,9 +27,9 @@ spec: image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} command: - - 'sslyze' - - '--json_out' - - '/home/securecodebox/sslyze-results.json' + - "sslyze" + - "--json_out" + - "/home/securecodebox/sslyze-results.json" resources: {{- toYaml .Values.scanner.resources | nindent 16 }} securityContext: diff --git a/scanners/test-scan/templates/test-scan-scan-type.yaml b/scanners/test-scan/templates/test-scan-scan-type.yaml index 9f5242993a..c8a9f91019 100644 --- a/scanners/test-scan/templates/test-scan-scan-type.yaml +++ b/scanners/test-scan/templates/test-scan-scan-type.yaml @@ -24,9 +24,11 @@ spec: restartPolicy: OnFailure containers: - name: test-scan - image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.Version }}" - command: ["touch", "/home/securecodebox/hello-world.txt"] + image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} + command: + - "touch" + - "/home/securecodebox/hello-world.txt" resources: {{- toYaml .Values.scanner.resources | nindent 16 }} securityContext: diff --git a/scanners/typo3scan/templates/typo3scan-scan-type.yaml b/scanners/typo3scan/templates/typo3scan-scan-type.yaml index a7cf4c45f1..66e97f6164 100644 --- a/scanners/typo3scan/templates/typo3scan-scan-type.yaml +++ b/scanners/typo3scan/templates/typo3scan-scan-type.yaml @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: 2021 iteratec GmbH # # SPDX-License-Identifier: Apache-2.0 + apiVersion: "execution.securecodebox.io/v1" kind: ScanType metadata: @@ -24,6 +25,7 @@ spec: containers: - name: typo3scan image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} command: - "python3" - "/home/typo3scan/typo3scan.py" diff --git a/scanners/whatweb/templates/whatweb-scan-type.yaml b/scanners/whatweb/templates/whatweb-scan-type.yaml index 08fcfbffb4..a575bf3f09 100644 --- a/scanners/whatweb/templates/whatweb-scan-type.yaml +++ b/scanners/whatweb/templates/whatweb-scan-type.yaml @@ -26,7 +26,9 @@ spec: - name: whatweb image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} - command: ["whatweb", "--log-json=/home/securecodebox/whatweb-results.json"] + command: + - "whatweb" + - "--log-json=/home/securecodebox/whatweb-results.json" resources: {{- toYaml .Values.scanner.resources | nindent 16 }} securityContext: diff --git a/scanners/zap-advanced/templates/zap-advanced-scan-type.yaml b/scanners/zap-advanced/templates/zap-advanced-scan-type.yaml index 1c1853f68f..fec86687a9 100644 --- a/scanners/zap-advanced/templates/zap-advanced-scan-type.yaml +++ b/scanners/zap-advanced/templates/zap-advanced-scan-type.yaml @@ -39,7 +39,7 @@ spec: restartPolicy: Never containers: - name: zap-advanced-scan - image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.Version }}" + image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} command: - "python3" From 411db641fcf81729fa6b5cd99749a4f43ae0c3cc Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 11 Oct 2021 14:23:20 +0200 Subject: [PATCH 2/3] Setting back to image: ".. | default .Chart.Version }}" This is done because these are our own scanners (SCB scanners) that follow our release versioning system. Regarding consistency, an issue was created to keep this in mind. Signed-off-by: Sebastian --- .../git-repo-scanner/templates/git-repo-scanner-scan-type.yaml | 2 +- scanners/test-scan/templates/test-scan-scan-type.yaml | 2 +- scanners/zap-advanced/templates/zap-advanced-scan-type.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scanners/git-repo-scanner/templates/git-repo-scanner-scan-type.yaml b/scanners/git-repo-scanner/templates/git-repo-scanner-scan-type.yaml index b598d4ed0c..f587c4d6ba 100644 --- a/scanners/git-repo-scanner/templates/git-repo-scanner-scan-type.yaml +++ b/scanners/git-repo-scanner/templates/git-repo-scanner-scan-type.yaml @@ -24,7 +24,7 @@ spec: restartPolicy: OnFailure containers: - name: git-repo-scanner - image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" + image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.Version }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} command: - "python" diff --git a/scanners/test-scan/templates/test-scan-scan-type.yaml b/scanners/test-scan/templates/test-scan-scan-type.yaml index c8a9f91019..3a4dcd16b5 100644 --- a/scanners/test-scan/templates/test-scan-scan-type.yaml +++ b/scanners/test-scan/templates/test-scan-scan-type.yaml @@ -24,7 +24,7 @@ spec: restartPolicy: OnFailure containers: - name: test-scan - image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" + image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.Version }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} command: - "touch" diff --git a/scanners/zap-advanced/templates/zap-advanced-scan-type.yaml b/scanners/zap-advanced/templates/zap-advanced-scan-type.yaml index bbc8f43cc9..2799d2a496 100644 --- a/scanners/zap-advanced/templates/zap-advanced-scan-type.yaml +++ b/scanners/zap-advanced/templates/zap-advanced-scan-type.yaml @@ -46,7 +46,7 @@ spec: restartPolicy: Never containers: - name: zap-advanced-scan - image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" + image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.Version }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} command: - "python3" From 7872ee0902907ed857949ef976b51248cd29265f Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 13 Oct 2021 15:00:27 +0200 Subject: [PATCH 3/3] Fixing " in gitleaks scan type Signed-off-by: Sebastian --- scanners/gitleaks/templates/gitleaks-scan-type.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scanners/gitleaks/templates/gitleaks-scan-type.yaml b/scanners/gitleaks/templates/gitleaks-scan-type.yaml index 769dd04b54..d388efac01 100644 --- a/scanners/gitleaks/templates/gitleaks-scan-type.yaml +++ b/scanners/gitleaks/templates/gitleaks-scan-type.yaml @@ -27,8 +27,8 @@ spec: image: "{{ .Values.scanner.image.repository }}:{{ .Values.scanner.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.scanner.image.pullPolicy }} command: - - 'sh' - - '/wrapper.sh' + - "sh" + - "/wrapper.sh" - "--verbose" - "--format" - "json"