File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ set -e
4+
5+ echo " unpacking vulnerability db"
6+
7+ TRIVY_TEMP_DIR=$( mktemp -d)
8+ trivy --cache-dir $TRIVY_TEMP_DIR image --download-db-only
9+ tar -cf ./trivy-db/db.tar.gz -C $TRIVY_TEMP_DIR /db metadata.json trivy.db
10+ rm -rf $TRIVY_TEMP_DIR
Original file line number Diff line number Diff line change 1+ ---
2+ platform : linux
3+
4+ image_resource :
5+ type : registry-image
6+ source : {repository: aquasecurity/trivy}
7+
8+ inputs :
9+ - name : cf-cli-resource
10+
11+ outputs :
12+ - name : trivy-db
13+
14+ run :
15+ path : cf-cli-resource/tasks/extract-trivy-db
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ set -e
4+
5+ echo " unpacking vulnerability db"
6+ cache_dir=` pwd`
7+ mkdir -p " ${cache_dir} /db"
8+ tar -xvf trivy-db/db.tar.gz -C " ${cache_dir} /db"
9+
10+ ignore_policy=" "
11+ if [ -f " $IGNORE_POLICY_FILE " ]; then
12+ ignore_policy=" --ignore-policy $IGNORE_POLICY_FILE "
13+ fi
14+
15+ echo " scanning base os"
16+ trivy \
17+ --cache-dir " ${cache_dir} " \
18+ --quiet \
19+ image \
20+ --severity " HIGH,CRITICAL" \
21+ --ignore-unfixed \
22+ --exit-code 1 \
23+ --input image/image.tar \
24+ $ignore_policy
Original file line number Diff line number Diff line change 1+ ---
2+ platform : linux
3+
4+ image_resource :
5+ type : registry-image
6+ source : {repository: aquasec/trivy}
7+
8+ inputs :
9+ - name : cf-cli-resource
10+ - name : image
11+ - name : trivy-db
12+
13+ params :
14+ IGNORE_POLICY_FILE :
15+
16+ run :
17+ path : cf-cli-resource/tasks/scan-image
You can’t perform that action at this time.
0 commit comments