Skip to content

Commit 1f5d1bf

Browse files
authored
Merge pull request #33 from IABTechLab/tjm-UID2-2343-add-trivy-scanning-action
UID2-2343 Add Trivy scanning action
2 parents 256ac19 + ad99f7d commit 1f5d1bf

6 files changed

+56
-210
lines changed

.github/workflows/shared-build-and-test.yaml

+5-26
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,9 @@ jobs:
3535
name: code-coverage-report
3636
path: target/site/jacoco/*
3737

38-
- name: Generate Trivy vulnerability scan report
39-
uses: aquasecurity/[email protected]
40-
if: inputs.publish_vulnerabilities == 'true'
38+
- name: Vulnerability Scan
39+
uses: IABTechLab/uid2-shared-actions/actions/[email protected]
4140
with:
42-
scan-type: 'fs'
43-
format: 'sarif'
44-
exit-code: '0'
45-
ignore-unfixed: true
46-
severity: 'CRITICAL,HIGH'
47-
output: 'trivy-results.sarif'
48-
hide-progress: true
49-
50-
- name: Upload Trivy scan report to GitHub Security tab
51-
uses: github/codeql-action/upload-sarif@v2
52-
if: inputs.publish_vulnerabilities == 'true'
53-
with:
54-
sarif_file: 'trivy-results.sarif'
55-
56-
- name: Test with Trivy vulnerability scanner
57-
uses: aquasecurity/[email protected]
58-
with:
59-
scan-type: 'fs'
60-
format: 'table'
61-
exit-code: '1'
62-
ignore-unfixed: true
63-
severity: 'CRITICAL'
64-
hide-progress: true
41+
scan_severity: HIGH,CRITICAL
42+
failure_severity: CRITICAL
43+
publish_vulnerabilities: ${{ inputs.publish_vulnerabilities }}

.github/workflows/shared-java-publish-versioned-package.yaml

+4-26
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,11 @@ jobs:
5656
with:
5757
key: ${{ secrets.GPG_KEY }}
5858

59-
- name: Generate Trivy vulnerability scan report
60-
uses: aquasecurity/[email protected]
61-
if: inputs.publish_vulnerabilities == 'true'
59+
- name: Vulnerability Scan
60+
uses: IABTechLab/uid2-shared-actions/actions/[email protected]
6261
with:
63-
scan-type: 'fs'
64-
format: 'sarif'
65-
exit-code: '0'
66-
ignore-unfixed: true
67-
severity: 'CRITICAL,HIGH'
68-
output: 'trivy-results.sarif'
69-
hide-progress: true
70-
71-
- name: Upload Trivy scan report to GitHub Security tab
72-
uses: github/codeql-action/upload-sarif@v2
73-
if: inputs.publish_vulnerabilities == 'true'
74-
with:
75-
sarif_file: 'trivy-results.sarif'
76-
77-
- name: Test with Trivy vulnerability scanner
78-
uses: aquasecurity/[email protected]
79-
with:
80-
scan-type: 'fs'
81-
format: 'table'
82-
exit-code: '1'
83-
ignore-unfixed: true
84-
severity: 'CRITICAL'
85-
hide-progress: true
62+
scan_severity: HIGH,CRITICAL
63+
failure_severity: CRITICAL
8664

8765
- name: Set version number
8866
id: version

.github/workflows/shared-release-major-minor-patch.yaml

-113
This file was deleted.

.github/workflows/shared-validate-image.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ on:
33
workflow_call:
44
inputs:
55
failure_severity:
6-
description: 'Must be one of CRITICAL, HIGH, MEDIUM'
6+
description: 'Must be any of, or more than one of CRITICAL,HIGH,MEDIUM'
77
required: false
8-
default: 'HIGH'
8+
default: 'HIGH,CRITICAL'
99
type: string
1010
fail_on_error:
1111
description: 'If true, will fail the build if vulnerabilities are found'

.github/workflows/shared-vulnerability-scanning.yaml

-43
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Vulnerability Scanning
2+
description: Scans the file system for vulnerabilities
3+
inputs:
4+
scan_severity:
5+
description: 'The severity that will cause the action to report if a vulnerability at that level is detected. UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL'
6+
required: false
7+
default: 'CRITICAL,HIGH'
8+
failure_severity:
9+
description: 'The severity that will cause the action to fail if a vulnerability at that level is detected. UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL'
10+
required: false
11+
default: 'CRITICAL'
12+
publish_vulnerabilities:
13+
description: 'If true, will attempt to publish the results to the GitHub security tab'
14+
required: false
15+
default: 'true'
16+
runs:
17+
using: "composite"
18+
steps:
19+
- name: Generate Trivy vulnerability scan report
20+
uses: aquasecurity/[email protected]
21+
if: inputs.publish_vulnerabilities == 'true'
22+
with:
23+
scan-type: 'fs'
24+
format: 'sarif'
25+
exit-code: '0'
26+
ignore-unfixed: true
27+
severity: ${{ inputs.scan_severity }}
28+
output: 'trivy-results.sarif'
29+
hide-progress: true
30+
31+
- name: Upload Trivy scan report to GitHub Security tab
32+
uses: github/codeql-action/upload-sarif@v2
33+
if: inputs.publish_vulnerabilities == 'true'
34+
with:
35+
sarif_file: 'trivy-results.sarif'
36+
37+
- name: Test with Trivy vulnerability scanner
38+
uses: aquasecurity/[email protected]
39+
with:
40+
scan-type: 'fs'
41+
format: 'table'
42+
exit-code: '1'
43+
ignore-unfixed: true
44+
severity: ${{ inputs.failure_severity }}
45+
hide-progress: true

0 commit comments

Comments
 (0)