Skip to content

Commit 567e5ac

Browse files
authored
fix(docker-build): update trivy-action to v0.34.1 and trivy to v0.69.2 (#103)
1 parent b49b605 commit 567e5ac

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ on:
3939
description: 'Security Report Mode (`"sarif"` | `"comment"`; ignored if `security-scan: false`)'
4040
default: "sarif"
4141
type: string
42+
trivy-version:
43+
description: "Trivy security scanner version"
44+
default: "v0.69.2"
45+
type: string
4246
hadolint:
4347
description: "Enable Hadolint"
4448
default: true
@@ -121,13 +125,15 @@ jobs:
121125
- name: Run Trivy vulnerability scanner
122126
id: trivy
123127
if: ${{ inputs.security-scan }}
124-
uses: aquasecurity/trivy-action@0.33.1
128+
uses: aquasecurity/trivy-action@0.34.1
125129
with:
126130
image-ref: ${{ inputs.image-name }}:${{ inputs.image-tag }}
127131
format: ${{ (inputs.security-report == 'sarif' && 'sarif') || 'table' }}
128132
vuln-type: "os,library"
129133
hide-progress: true
130134
output: ${{ (inputs.security-report == 'sarif' && 'trivy-results.sarif') || 'trivy.txt' }}
135+
# following https://github.com/aquasecurity/trivy/discussions/10265
136+
version: ${{ inputs.trivy-version }}
131137

132138
- name: Read Trivy report file
133139
id: read_trivy
@@ -217,7 +223,7 @@ jobs:
217223
218224
- name: Fail build on CRITICAL or HIGH vulnerabilities
219225
if: ${{ inputs.security-scan }}
220-
uses: aquasecurity/trivy-action@0.33.1
226+
uses: aquasecurity/trivy-action@0.34.1
221227
with:
222228
image-ref: ${{ inputs.image-name }}:${{ inputs.image-tag }}
223229
format: table
@@ -231,15 +237,15 @@ jobs:
231237
- name: Push Docker image
232238
if: ${{ inputs.push }}
233239
run: docker push "$OCI_IMAGE"
234-
240+
235241
- name: Compute checksum of the Docker image
236242
id: checksum
237243
run: |
238244
# Extract SHA256 digest and format as 0X...
239245
INSPECT=$(docker image inspect "$OCI_IMAGE")
240246
DIGEST=$(echo "$INSPECT" | jq -r 'if .[0].RepoDigests[0] then .[0].RepoDigests[0] | split("@sha256:")[1] else .[0].Id | split(":")[1] end')
241247
echo "checksum=0x${DIGEST}" >> "$GITHUB_OUTPUT"
242-
248+
243249
- name: Cleanup files
244250
if: always()
245251
run: |

docker-build/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ Perfect for teams looking to streamline their containerization workflow with min
1919

2020
> [!IMPORTANT]
2121
> Due to a limitation on Trivy analysis, the workflow targets a single platform.
22-
> A workflow instance should be configured for each intended targeted platform.
22+
> A workflow instance should be configured for each targeted platform.
2323
24-
## ⚙️ Inputs
24+
## ⚙️ Inputs
2525

2626
| Name | Description | Required | Default |
2727
| ----------------- | ---------------------------------------------------------------------------------- | -------- | --------------- |
@@ -36,6 +36,7 @@ Perfect for teams looking to streamline their containerization workflow with min
3636
| `registry` | Docker Registry | No | `"docker.io"` |
3737
| `security-report` | Security Report Mode (`"sarif"` \| `"comment"`; ignored if `security-scan: false`) | No | `"sarif"` |
3838
| `security-scan` | Enable Trivy Security Scan | No | `true` |
39+
| `trivy-version` | Override Trivy security scanner version | No | `v0.69.2` |
3940

4041
## 🔐 Secrets
4142

0 commit comments

Comments
 (0)