Skip to content

Commit a4c3a6c

Browse files
Support trivy allow lists per image
1 parent 33328d9 commit a4c3a6c

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

.github/workflows/stackhpc-container-image-build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ jobs:
145145
run: |
146146
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b /usr/local/bin v0.49.0
147147
148+
- name: Install yq
149+
run: |
150+
wget https://github.com/mikefarah/yq/releases/download/v4.42.1/yq_linux_amd64.tar.gz -O - | tar xz && sudo mv yq_linux_amd64 /usr/bin/yq
151+
148152
- name: Install Kayobe
149153
run: |
150154
mkdir -p venvs &&

etc/kayobe/trivy.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
###############################################################################
3+
# Trivy allowed vulnerabilities list
4+
5+
# Example allowed vulnerabilities file setup
6+
#
7+
# keystone_allowed_vulnerabilities:
8+
# CVE-2022-2447
9+
#
10+
# horizon_allowed_vulnerabilities:
11+
# CVE-2022-45582
12+
13+
###############################################################################
14+
# Dummy variable to allow Ansible to accept this file.
15+
workaround_ansible_issue_8743: yes

tools/scan-images.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ touch image-scan-output/clean-images.txt image-scan-output/dirty-images.txt
3333
# If there are vulnerabilities detected, add it to dirty-images.txt and
3434
# generate a csv summary
3535
for image in $images; do
36+
rm .trivyignore && touch .trivyignore
37+
for vulnerability in $(yq ${image}_allowed_vulnerabilities $KAYOBE_CONFIG_PATH/trivy.yml); do
38+
echo $vulnerability >> .trivyignore;
39+
done
3640
filename=$(basename $image | sed 's/:/\./g')
3741
if $(trivy image \
3842
--quiet \

0 commit comments

Comments
 (0)