Conversation
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
shellcheck
📝 [shellcheck] reported by reviewdog 🐶
Expressions don't expand in single quotes, use double quotes for that. SC2016
BP-TRIVY-STEP/imageTrivyScanner.sh
Line 52 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
BP-TRIVY-STEP/imageTrivyScanner.sh
Line 52 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
BP-TRIVY-STEP/imageTrivyScanner.sh
Line 52 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
BP-TRIVY-STEP/imageTrivyScanner.sh
Line 52 in 1086936
Declare and assign separately to avoid masking return values. SC2155
BP-TRIVY-STEP/imageTrivyScanner.sh
Line 74 in 1086936
[shellcheck] reported by reviewdog 🐶
Use $(...) notation instead of legacy backticks .... SC2006
BP-TRIVY-STEP/imageTrivyScanner.sh
Line 74 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
BP-TRIVY-STEP/imageTrivyScanner.sh
Line 90 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
BP-TRIVY-STEP/imageTrivyScanner.sh
Line 107 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
BP-TRIVY-STEP/imageTrivyScanner.sh
Line 110 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
BP-TRIVY-STEP/imageTrivyScanner.sh
Line 114 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091
Line 3 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/mi-functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091
Line 4 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/log-functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091
Line 5 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/str-functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091
Line 6 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/file-functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091
Line 7 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/aws-functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091
Line 8 in 1086936
📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/getDataFile.sh: openBinaryFile: does not exist (No such file or directory) SC1091
Line 9 in 1086936
| @@ -0,0 +1,10 @@ | |||
| awk 'BEGIN { FS="[:,]"; OFS="," } | |||
| #!/bin/bash | ||
| source functions.sh | ||
|
|
||
| source /opt/buildpiper/shell-functions/functions.sh |
| source functions.sh | ||
|
|
||
| source /opt/buildpiper/shell-functions/functions.sh | ||
| source /opt/buildpiper/shell-functions/mi-functions.sh |
|
|
||
| source /opt/buildpiper/shell-functions/functions.sh | ||
| source /opt/buildpiper/shell-functions/mi-functions.sh | ||
| source /opt/buildpiper/shell-functions/log-functions.sh |
| source /opt/buildpiper/shell-functions/functions.sh | ||
| source /opt/buildpiper/shell-functions/mi-functions.sh | ||
| source /opt/buildpiper/shell-functions/log-functions.sh | ||
| source /opt/buildpiper/shell-functions/str-functions.sh |
| mkdir -p reports | ||
| trivy image -q --severity ${SCAN_SEVERITY} --exit-code 1 ${FORMAT_ARG} ${OUTPUT_ARG} ${IMAGE_NAME}:${IMAGE_TAG} | ||
|
|
||
| logInfoMessage "Executing trivy image -q --severity ${SCAN_SEVERITY} --exit-code 1 --format template --template '{{- $critical := 0 }}{{- $high := 0 }}{{- range . }}{{- range .Vulnerabilities }}{{- if eq .Severity "CRITICAL" }}{{- $critical = add $critical 1 }}{{- end }}{{- if eq .Severity "HIGH" }}{{- $high = add $high 1 }}{{- end }}{{- end }}{{- end }}Critical: {{ $critical }}, High: {{ $high }}' ${OUTPUT_ARG} ${IMAGE_NAME}:${IMAGE_TAG}" |
| mkdir -p reports | ||
| trivy image -q --severity ${SCAN_SEVERITY} --exit-code 1 ${FORMAT_ARG} ${OUTPUT_ARG} ${IMAGE_NAME}:${IMAGE_TAG} | ||
|
|
||
| logInfoMessage "Executing trivy image -q --severity ${SCAN_SEVERITY} --exit-code 1 --format template --template '{{- $critical := 0 }}{{- $high := 0 }}{{- range . }}{{- range .Vulnerabilities }}{{- if eq .Severity "CRITICAL" }}{{- $critical = add $critical 1 }}{{- end }}{{- if eq .Severity "HIGH" }}{{- $high = add $high 1 }}{{- end }}{{- end }}{{- end }}Critical: {{ $critical }}, High: {{ $high }}' ${OUTPUT_ARG} ${IMAGE_NAME}:${IMAGE_TAG}" |
| mkdir -p reports | ||
| trivy image -q --severity ${SCAN_SEVERITY} --exit-code 1 ${FORMAT_ARG} ${OUTPUT_ARG} ${IMAGE_NAME}:${IMAGE_TAG} | ||
|
|
||
| logInfoMessage "Executing trivy image -q --severity ${SCAN_SEVERITY} --exit-code 1 --format template --template '{{- $critical := 0 }}{{- $high := 0 }}{{- range . }}{{- range .Vulnerabilities }}{{- if eq .Severity "CRITICAL" }}{{- $critical = add $critical 1 }}{{- end }}{{- if eq .Severity "HIGH" }}{{- $high = add $high 1 }}{{- end }}{{- end }}{{- end }}Critical: {{ $critical }}, High: {{ $high }}' ${OUTPUT_ARG} ${IMAGE_NAME}:${IMAGE_TAG}" |
| mkdir -p reports | ||
| trivy image -q --severity ${SCAN_SEVERITY} --exit-code 1 ${FORMAT_ARG} ${OUTPUT_ARG} ${IMAGE_NAME}:${IMAGE_TAG} | ||
|
|
||
| logInfoMessage "Executing trivy image -q --severity ${SCAN_SEVERITY} --exit-code 1 --format template --template '{{- $critical := 0 }}{{- $high := 0 }}{{- range . }}{{- range .Vulnerabilities }}{{- if eq .Severity "CRITICAL" }}{{- $critical = add $critical 1 }}{{- end }}{{- if eq .Severity "HIGH" }}{{- $high = add $high 1 }}{{- end }}{{- end }}{{- end }}Critical: {{ $critical }}, High: {{ $high }}' ${OUTPUT_ARG} ${IMAGE_NAME}:${IMAGE_TAG}" |
|
|
||
| logInfoMessage "Executing trivy image -q --severity ${SCAN_SEVERITY} --exit-code 1 --format template --template '{{- $critical := 0 }}{{- $high := 0 }}{{- range . }}{{- range .Vulnerabilities }}{{- if eq .Severity "CRITICAL" }}{{- $critical = add $critical 1 }}{{- end }}{{- if eq .Severity "HIGH" }}{{- $high = add $high 1 }}{{- end }}{{- end }}{{- end }}Critical: {{ $critical }}, High: {{ $high }}' ${OUTPUT_ARG} ${IMAGE_NAME}:${IMAGE_TAG}" | ||
|
|
||
| trivy image -q --severity ${SCAN_SEVERITY} --exit-code 1 --format template --template '{{- $critical := 0 }}{{- $high := 0 }}{{- range . }}{{- range .Vulnerabilities }}{{- if eq .Severity "CRITICAL" }}{{- $critical = add $critical 1 }}{{- end }}{{- if eq .Severity "HIGH" }}{{- $high = add $high 1 }}{{- end }}{{- end }}{{- end }}Critical: {{ $critical }}, High: {{ $high }}' ${OUTPUT_ARG} ${IMAGE_NAME}:${IMAGE_TAG} |
highandcriticalseverities. Default values forSCANNER,SCAN_SEVERITY,FORMAT_ARG, andOUTPUT_ARGare set in the Dockerfile.SOURCE_KEYis no longer required, simplifying configuration.#15