Skip to content

V3 mi#16

Open
mukulmj wants to merge 8 commits into
mainfrom
v3-mi
Open

V3 mi#16
mukulmj wants to merge 8 commits into
mainfrom
v3-mi

Conversation

@mukulmj
Copy link
Copy Markdown

@mukulmj mukulmj commented Mar 31, 2025

Version Added Improved Bug Resolved Date
0.5.11-mi Python dependency added to execute a script for viewing data in CSV format. Pushes data for both high and critical severities. Default values for SCANNER, SCAN_SEVERITY, FORMAT_ARG, and OUTPUT_ARG are set in the Dockerfile. SOURCE_KEY is no longer required, simplifying configuration. March 31, 2025

#15

@mukulmj mukulmj added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Mar 31, 2025
@mukulmj mukulmj requested a review from deepakgupta97 March 31, 2025 10:56
@mukulmj mukulmj self-assigned this Mar 31, 2025
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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}


📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

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}


📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

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}


📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

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}


⚠️ [shellcheck] reported by reviewdog 🐶
Declare and assign separately to avoid masking return values. SC2155

export base64EncodedResponse=`encodeFileContent reports/trivy_mi.csv`


[shellcheck] reported by reviewdog 🐶
Use $(...) notation instead of legacy backticks .... SC2006

export base64EncodedResponse=`encodeFileContent reports/trivy_mi.csv`


📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

if ! sendMIData trivy.mi ${MI_SERVER_ADDRESS}; then


📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

generateOutput ${ACTIVITY_SUB_TASK_CODE} true "Congratulations! Trivy scan succeeded!"


📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

generateOutput ${ACTIVITY_SUB_TASK_CODE} false "Trivy scan failed!"


📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

generateOutput ${ACTIVITY_SUB_TASK_CODE} true "Trivy scan failed!"


📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091

source /opt/buildpiper/shell-functions/functions.sh


📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/mi-functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091

source /opt/buildpiper/shell-functions/mi-functions.sh


📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/log-functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091

source /opt/buildpiper/shell-functions/log-functions.sh


📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/str-functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091

source /opt/buildpiper/shell-functions/str-functions.sh


📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/file-functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091

source /opt/buildpiper/shell-functions/file-functions.sh


📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/aws-functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091

source /opt/buildpiper/shell-functions/aws-functions.sh


📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/getDataFile.sh: openBinaryFile: does not exist (No such file or directory) SC1091

source /opt/buildpiper/shell-functions/getDataFile.sh

Comment thread template2CSV.sh
@@ -0,0 +1,10 @@
awk 'BEGIN { FS="[:,]"; OFS="," }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [shellcheck] reported by reviewdog 🐶
Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. SC2148

Comment thread imageTrivyScanner.sh
#!/bin/bash
source functions.sh

source /opt/buildpiper/shell-functions/functions.sh
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091

Comment thread imageTrivyScanner.sh
source functions.sh

source /opt/buildpiper/shell-functions/functions.sh
source /opt/buildpiper/shell-functions/mi-functions.sh
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/mi-functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091

Comment thread imageTrivyScanner.sh

source /opt/buildpiper/shell-functions/functions.sh
source /opt/buildpiper/shell-functions/mi-functions.sh
source /opt/buildpiper/shell-functions/log-functions.sh
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/log-functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091

Comment thread imageTrivyScanner.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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Not following: /opt/buildpiper/shell-functions/str-functions.sh: openBinaryFile: does not exist (No such file or directory) SC1091

Comment thread imageTrivyScanner.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}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
critical is referenced but not assigned. SC2154

Comment thread imageTrivyScanner.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}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
high is referenced but not assigned. SC2154

Comment thread imageTrivyScanner.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}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A"B"C"? SC2140

Comment thread imageTrivyScanner.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}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A"B"C"? SC2140

Comment thread imageTrivyScanner.sh

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}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

Comment thread build.sh
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

generateOutput ${ACTIVITY_SUB_TASK_CODE} true "Please check incompatible scanner passed!!!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants