Skip to content

Commit a7a829a

Browse files
oranmoshaioranmoshaiknqyf263
authored
chore: update trivy version Dockerfile (#96)
* chore: update trivy version Dockerfile * Update readme for sarif deprecate aquasecurity/trivy#1571 * docs: revert template and remove sarif.tpl * fix: update condition to use format variable Co-authored-by: oranmoshai <oran.moshai@aquasec.com> Co-authored-by: knqyf263 <knqyf263@gmail.com>
1 parent 9c21d3c commit a7a829a

3 files changed

Lines changed: 13 additions & 21 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM aquasec/trivy:0.22.0
1+
FROM aquasec/trivy:0.23.0
22
COPY entrypoint.sh /
33
RUN apk --no-cache add bash
44
RUN chmod +x /entrypoint.sh

README.md

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ jobs:
7676
uses: aquasecurity/trivy-action@master
7777
with:
7878
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
79-
format: 'template'
80-
template: '@/contrib/sarif.tpl'
79+
format: 'sarif'
8180
output: 'trivy-results.sarif'
8281

8382
- name: Upload Trivy scan results to GitHub Security tab
@@ -112,8 +111,7 @@ jobs:
112111
uses: aquasecurity/trivy-action@master
113112
with:
114113
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
115-
format: 'template'
116-
template: '@/contrib/sarif.tpl'
114+
format: 'sarif'
117115
output: 'trivy-results.sarif'
118116

119117
- name: Upload Trivy scan results to GitHub Security tab
@@ -149,8 +147,7 @@ jobs:
149147
with:
150148
scan-type: 'fs'
151149
ignore-unfixed: true
152-
format: 'template'
153-
template: '@/contrib/sarif.tpl'
150+
format: 'sarif'
154151
output: 'trivy-results.sarif'
155152
severity: 'CRITICAL'
156153

@@ -185,8 +182,7 @@ jobs:
185182
scan-type: 'rootfs'
186183
scan-ref: 'rootfs-example-binary'
187184
ignore-unfixed: true
188-
format: 'template'
189-
template: '@/contrib/sarif.tpl'
185+
format: 'sarif'
190186
output: 'trivy-results.sarif'
191187
severity: 'CRITICAL'
192188

@@ -256,8 +252,7 @@ jobs:
256252
uses: aquasecurity/trivy-action@master
257253
with:
258254
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
259-
format: 'template'
260-
template: '@/contrib/sarif.tpl'
255+
format: 'sarif'
261256
output: 'trivy-results.sarif'
262257
env:
263258
TRIVY_USERNAME: Username
@@ -293,8 +288,7 @@ jobs:
293288
uses: aquasecurity/trivy-action@master
294289
with:
295290
image-ref: 'aws_account_id.dkr.ecr.region.amazonaws.com/imageName:${{ github.sha }}'
296-
format: 'template'
297-
template: '@/contrib/sarif.tpl'
291+
format: 'sarif'
298292
output: 'trivy-results.sarif'
299293
env:
300294
AWS_ACCESS_KEY_ID: key_id
@@ -330,8 +324,7 @@ jobs:
330324
uses: aquasecurity/trivy-action@master
331325
with:
332326
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
333-
format: 'template'
334-
template: '@/contrib/sarif.tpl'
327+
format: 'sarif'
335328
output: 'trivy-results.sarif'
336329
env:
337330
GOOGLE_APPLICATION_CREDENTIAL: /path/to/credential.json
@@ -364,8 +357,7 @@ jobs:
364357
uses: aquasecurity/trivy-action@master
365358
with:
366359
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
367-
format: 'template'
368-
template: '@/contrib/sarif.tpl'
360+
format: 'sarif'
369361
output: 'trivy-results.sarif'
370362
env:
371363
TRIVY_USERNAME: Username
@@ -389,8 +381,8 @@ Following inputs can be used as `step.with` keys:
389381
| `input` | String | | Tar reference, e.g. `alpine-latest.tar` |
390382
| `image-ref` | String | | Image reference, e.g. `alpine:3.10.2` |
391383
| `scan-ref` | String | `/github/workspace/` | Scan reference, e.g. `/github/workspace/` or `.`|
392-
| `format` | String | `table` | Output format (`table`, `json`, `template`) |
393-
| `template` | String | | Output template (`@/contrib/sarif.tpl`, `@/contrib/gitlab.tpl`, `@/contrib/junit.tpl`)|
384+
| `format` | String | `table` | Output format (`table`, `json`, `sarif`) |
385+
| `template` | String | | Output template (`@/contrib/gitlab.tpl`, `@/contrib/junit.tpl`)|
394386
| `output` | String | | Save results to a file |
395387
| `exit-code` | String | `0` | Exit code when specified vulnerabilities are found |
396388
| `ignore-unfixed` | Boolean | false | Ignore unpatched/unfixed vulnerabilities |

entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ returnCode=$?
138138
# SARIF is special. We output all vulnerabilities,
139139
# regardless of severity level specified in this report.
140140
# This is a feature, not a bug :)
141-
if [[ ${template} == *"sarif"* ]]; then
141+
if [[ "${format}" == "sarif" ]]; then
142142
echo "Building SARIF report with options: ${SARIF_ARGS}" "${artifactRef}"
143-
trivy --quiet ${scanType} --format template --template ${template} --output ${output} $SARIF_ARGS ${artifactRef}
143+
trivy --quiet ${scanType} --format sarif --output ${output} $SARIF_ARGS ${artifactRef}
144144
fi
145145

146146
exit $returnCode

0 commit comments

Comments
 (0)