Skip to content

Commit bda17f7

Browse files
authored
ci: scan main Docker image with Trivy (#207)
1 parent 8e03145 commit bda17f7

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

.github/workflows/scans.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,56 @@ jobs:
5252
/action/lib/linter.sh || ( echo "❗ [CT222] Super linter found an issue (possibly Hadolint)" && exit 1 )
5353
echo "✅ [CT222] Hadolint Dockerfile check passed"
5454
55+
- name: Run Trivy vulnerability scanner on repo
56+
uses: aquasecurity/trivy-action@f9424c10c36e288d5fa79bd3dfd1aeb2d6eae808 # master
57+
with:
58+
scan-type: config
59+
scan-ref: .
60+
output: repo_scan_trivy_report.txt
61+
62+
- name: Upload Trivy Report
63+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
64+
with:
65+
path: repo_scan_trivy_report.txt
66+
name: trivy_repo_report
67+
68+
scan_main_container:
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Harden Runner
72+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
73+
with:
74+
egress-policy: audit
75+
76+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
77+
with:
78+
fetch-depth: 0
79+
lfs: false
80+
81+
- name: Setup Docker
82+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
83+
84+
- name: Build Image
85+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
86+
with:
87+
load: true
88+
tags: tsffs:latest
89+
cache-to: type=gha,mode=max
90+
cache-from: type=gha
91+
92+
- name: Run Trivy vulnerability scanner
93+
uses: aquasecurity/trivy-action@f9424c10c36e288d5fa79bd3dfd1aeb2d6eae808 # master
94+
with:
95+
image-ref: tsffs:latest
96+
output: main_container_trivy_report.txt
97+
skip-dirs: /workspace/simics
98+
99+
- name: Upload Trivy Report
100+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
101+
with:
102+
path: main_container_trivy_report.txt
103+
name: trivy_container_report
104+
55105
scan_x86_64_breakpoint_uefi_edk2_container:
56106
runs-on: ubuntu-latest
57107
steps:

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,5 @@ FROM fedora:42@sha256:469a32aab897bfd91f6fde78bd8f0b07507879fc63fe19d69b5298a70f
167167
COPY --from=tsffs-base /workspace/projects /workspace/projects
168168
COPY --from=tsffs-base /workspace/simics /workspace/simics
169169
COPY --from=tsffs-base /root/.bashrc /root/.bashrc
170-
COPY --from=tsffs-base /root/.cargo /root/.cargo
171170

172171
WORKDIR /workspace/projects/example

0 commit comments

Comments
 (0)