Skip to content
Open
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
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ if [ "${format}" == "sarif" ] && [ "${limitSeveritiesForSARIF}" != "true" ]; the
trivy --quiet ${scanType} --format sarif --output ${output} $SARIF_ARGS ${artifactRef}
elif [ $trivyConfig ]; then
echo "Running Trivy with trivy.yaml config from: " $trivyConfig
trivy --config $trivyConfig ${scanType} ${ARGS}" ${artifactRef}
trivy --config $trivyConfig ${scanType} ${ARGS} ${artifactRef}
Copy link
Copy Markdown

@aitrics-ray aitrics-ray Apr 26, 2024

Choose a reason for hiding this comment

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

While we're at it, it'd be nice to meet conventions.

Suggested change
trivy --config $trivyConfig ${scanType} ${ARGS} ${artifactRef}
echo "Running Trivy with trivy.yaml config from: ${trivyConfig}"
trivy --config "${trivyConfig}" "${scanType}" "${ARGS}" "${artifactRef}"

FYI
https://google.github.io/styleguide/shellguide.html#s5.6-variable-expansion

Copy link
Copy Markdown

@AkselAllas AkselAllas Apr 26, 2024

Choose a reason for hiding this comment

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

Should be "${trivyConfig}" "${scanType}" "${ARGS}" "${artifactRef}" unless ARGS really needs to be unquoted.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agreed

else
echo "Running trivy with options: trivy ${scanType} ${ARGS}" "${artifactRef}"
echo "Global options: " "${GLOBAL_ARGS}"
Expand Down