Skip to content

Commit

Permalink
#962: Use Trivy cache and updated Ubuntu packages (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomuben authored Sep 26, 2024
1 parent 6a49900 commit ca29b6f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
17 changes: 14 additions & 3 deletions ext/scripts/security_scan/run_trivy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,21 @@ if [ $# -lt 1 ]; then
exit 1
fi

TRIVY_CACHE_LOCATION="https://dli4ip9yror05.cloudfront.net"


mkdir -p "$HOME/.cache/"
pushd "$HOME/.cache/"

curl -s -o trivy_cache.tar.gz "${TRIVY_CACHE_LOCATION}/trivy_cache.tar.gz"
tar xf trivy_cache.tar.gz

popd

output_path=$1

trivy rootfs --no-progress --offline-scan --format json --ignore-policy /trivy.rego --output "$output_path/trivy_report.json" / > /dev/null
trivy rootfs --no-progress --offline-scan --format json --timeout 15m0s --skip-java-db-update --skip-db-update --ignore-policy /trivy.rego --output "$output_path/trivy_report.json" / > /dev/null
#run with format table and print to stdout
trivy rootfs --no-progress --offline-scan --format table --ignore-policy /trivy.rego --output "$output_path/trivy_report.txt" / > /dev/null
trivy rootfs --no-progress --offline-scan --format table --timeout 15m0s --skip-java-db-update --skip-db-update --ignore-policy /trivy.rego --output "$output_path/trivy_report.txt" / > /dev/null
#Force script to return with error if a high or critical issue is found
trivy rootfs --no-progress --offline-scan --ignore-policy /trivy.rego --show-suppressed --severity "HIGH,CRITICAL" --exit-code 1 /
trivy rootfs --no-progress --offline-scan --timeout 15m0s --skip-db-update --skip-java-db-update --ignore-policy /trivy.rego --show-suppressed --severity "HIGH,CRITICAL" --exit-code 1 /
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
coreutils|8.32-4.1ubuntu1.2
locales|2.35-0ubuntu3.8
curl|7.81.0-1ubuntu1.18
ca-certificates|20230311ubuntu0.22.04.1
ca-certificates|20240203~22.04.1
bzip2|1.0.8-5build1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
coreutils|8.32-4.1ubuntu1.2
locales|2.35-0ubuntu3.8
curl|7.81.0-1ubuntu1.18
ca-certificates|20230311ubuntu0.22.04.1
ca-certificates|20240203~22.04.1
bzip2|1.0.8-5build1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ca-certificates|20230311ubuntu0.22.04.1
ca-certificates|20240203~22.04.1
python3.10-dev|3.10.12-1~22.04.6
python3-distutils|3.10.8-1~22.04
curl|7.81.0-1ubuntu1.18

0 comments on commit ca29b6f

Please sign in to comment.