Skip to content

Commit 03d110d

Browse files
committed
ci: scan vulnerability
Signed-off-by: Kentaro Hayashi <[email protected]>
1 parent addb2b8 commit 03d110d

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/scan-images.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Scan image vulnerability
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
schedule:
8+
# Sunday, 18:00 JST
9+
- cron: '0 9 * * 0'
10+
11+
concurrency:
12+
group: ${{ github.head_ref || github.sha }}-${{ github.workflow }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
debian:
17+
name: Scan debian image with grype
18+
strategy:
19+
fail-fast: false
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Pull and scan upstream trixie image
23+
run: |
24+
docker pull debian:trixie
25+
echo "# Scan debian image with grype (filter)" >> $GITHUB_STEP_SUMMARY
26+
echo "|NAME | INSTALLED | FIXED | IN | TYPE | VULNERABILITY | SEVERITY | EPSS | RISK | |" >> $GITHUB_STEP_SUMMARY
27+
echo "|---| ---|---|---|----|---|---|---|---|---|" >> $GITHUB_STEP_SUMMARY
28+
docker run --rm anchore/grype:latest debian:trixie | sed -e "s/won't fix/won'tfix/g" | grep -v Negligible | grep -v "won't" | grep -v "^NAME" | sed 's/^/|/; s/ */ | /g; s/$/ |/' >> $GITHUB_STEP_SUMMARY
29+
echo "# Scan debian image with grype" >> $GITHUB_STEP_SUMMARY
30+
echo "|NAME | INSTALLED | FIXED | IN | TYPE | VULNERABILITY | SEVERITY | EPSS | RISK | |" >> $GITHUB_STEP_SUMMARY
31+
echo "|---| ---|---|---|----|---|---|---|---|---|" >> $GITHUB_STEP_SUMMARY
32+
docker run --rm anchore/grype:latest debian:trixie | sed -e "s/won't fix/won'tfix/g" | grep -v "^NAME" | sed 's/^/|/; s/ */ | /g; s/$/ |/' >> $GITHUB_STEP_SUMMARY
33+
ruby:
34+
name: Scan Ruby image with grype
35+
strategy:
36+
fail-fast: false
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Pull and scan upstream Ruby image
40+
run: |
41+
docker pull ruby:3.4-slim
42+
echo "# Scan Ruby image with grype (filter)" >> $GITHUB_STEP_SUMMARY
43+
echo "|NAME | INSTALLED | FIXED | IN | TYPE | VULNERABILITY | SEVERITY | EPSS | RISK | |" >> $GITHUB_STEP_SUMMARY
44+
echo "|---| ---|---|---|----|---|---|---|---|---|" >> $GITHUB_STEP_SUMMARY
45+
docker run --rm anchore/grype:latest ruby:3.4-slim | sed -e "s/won't fix/won'tfix/g" | grep -v Negligible | grep -v "won't" | grep -v "^NAME" | sed 's/^/|/; s/ */ | /g; s/$/ |/' >> $GITHUB_STEP_SUMMARY
46+
echo "# Scan Ruby image with grype" >> $GITHUB_STEP_SUMMARY
47+
echo "|NAME | INSTALLED | FIXED | IN | TYPE | VULNERABILITY | SEVERITY | EPSS | RISK | |" >> $GITHUB_STEP_SUMMARY
48+
echo "|---| ---|---|---|----|---|---|---|---|---|" >> $GITHUB_STEP_SUMMARY
49+
docker run --rm anchore/grype:latest ruby:3.4-slim | sed -e "s/won't fix/won'tfix/g" | grep -v "^NAME" | sed 's/^/|/; s/ */ | /g; s/$/ |/' >> $GITHUB_STEP_SUMMARY
50+
fluentd:
51+
name: Scan Fluentd image with grype
52+
strategy:
53+
fail-fast: false
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v6
57+
- name: Pull and scan Fluentd image
58+
run: |
59+
# v1.19.1-debian-amd64
60+
IMAGE=$(make echo-all-images | cut -d' ' -f1|cut -d',' -f3)
61+
echo "# Scan Fluentd image with grype (filter)" >> $GITHUB_STEP_SUMMARY
62+
echo "|NAME | INSTALLED | FIXED | IN | TYPE | VULNERABILITY | SEVERITY | EPSS | RISK | |" >> $GITHUB_STEP_SUMMARY
63+
echo "|---| ---|---|---|----|---|---|---|---|---|" >> $GITHUB_STEP_SUMMARY
64+
docker run --rm anchore/grype:latest fluent/fluentd:$IMAGE | sed -e "s/won't fix/won'tfix/g" | grep -v Negligible | grep -v "won't" | grep -v "^NAME" | sed 's/^/|/; s/ */ | /g; s/$/ |/' >> $GITHUB_STEP_SUMMARY
65+
echo "# Scan Fluentd image with grype" >> $GITHUB_STEP_SUMMARY
66+
echo "|NAME | INSTALLED | FIXED | IN | TYPE | VULNERABILITY | SEVERITY | EPSS | RISK | |" >> $GITHUB_STEP_SUMMARY
67+
echo "|---| ---|---|---|----|---|---|---|---|---|" >> $GITHUB_STEP_SUMMARY
68+
docker run --rm anchore/grype:latest fluent/fluentd:$IMAGE | sed -e "s/won't fix/won'tfix/g" | grep -v "^NAME" | sed 's/^/|/; s/ */ | /g; s/$/ |/' >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)