Skip to content

Commit 85792de

Browse files
Add option to ignore CVEs found by Trivy (#1300)
1 parent 0a358cb commit 85792de

5 files changed

Lines changed: 36 additions & 1 deletion

File tree

.github/actions/image_scan/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ inputs:
1111
severity:
1212
required: true
1313
description: "List of severities that will cause a failure"
14+
trivyignore-file:
15+
required: false
16+
default: ''
17+
description: "Path to the .trivyignore.yaml file to use for this scan"
1418
logout:
1519
required: true
1620
description: |
@@ -36,4 +40,6 @@ runs:
3640
with:
3741
image-ref: ${{ inputs.image-ref }}
3842
severity: ${{ inputs.severity }}
39-
exit-code: '1'
43+
exit-code: '1'
44+
env:
45+
TRIVY_IGNOREFILE: ${{ inputs.trivyignore-file }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Trivy ignore file for daily scans.
5+
# This file is intentionally empty. Daily scans should flag all CVEs.
6+
# See: https://aquasecurity.github.io/trivy/latest/docs/configuration/filtering/
7+
8+
# Format:
9+
# - id: <CVE-###>
10+
# statement: "<Why are we excluding?> <link to CVE where we can we status>"
11+
# expired_at: <required - YYYY-MM-DD>
12+
13+
vulnerabilities: []
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# See: https://aquasecurity.github.io/trivy/latest/docs/configuration/filtering/
5+
6+
# Format:
7+
# - id: <CVE-###>
8+
# statement: "<Why are we excluding?> <link to CVE where we can we status>"
9+
# expired_at: <required - YYYY-MM-DD>
10+
11+
vulnerabilities: []

.github/workflows/daily-scan.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ jobs:
9595
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v1.33.0"
9696
severity: 'CRITICAL,HIGH'
9797
logout: 'false'
98+
trivyignore-file: .github/trivy/daily-scan.trivyignore.yaml
9899

99100
- name: Perform low image scan on v1
100101
if: always()
@@ -104,6 +105,7 @@ jobs:
104105
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v1.33.0"
105106
severity: 'MEDIUM,LOW,UNKNOWN'
106107
logout: 'false'
108+
trivyignore-file: .github/trivy/daily-scan.trivyignore.yaml
107109

108110
- name: Perform high image scan on v2
109111
if: always()
@@ -113,6 +115,7 @@ jobs:
113115
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.20.0"
114116
severity: 'CRITICAL,HIGH'
115117
logout: 'false'
118+
trivyignore-file: .github/trivy/daily-scan.trivyignore.yaml
116119

117120
- name: Perform low image scan on v2
118121
if: always()
@@ -122,6 +125,7 @@ jobs:
122125
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.20.0"
123126
severity: 'MEDIUM,LOW,UNKNOWN'
124127
logout: 'false'
128+
trivyignore-file: .github/trivy/daily-scan.trivyignore.yaml
125129

126130
- name: Configure AWS Credentials for emitting metrics
127131
if: always()

.github/workflows/pr-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ jobs:
236236
image-ref: ${{ env.TEST_TAG }}
237237
severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN'
238238
logout: 'true'
239+
trivyignore-file: .github/trivy/pr-build.trivyignore.yaml
239240

240241
- name: Test docker image
241242
if: ${{ matrix.os == 'ubuntu-latest' }}

0 commit comments

Comments
 (0)