-
Notifications
You must be signed in to change notification settings - Fork 148
76 lines (66 loc) · 2.57 KB
/
trivy_scan.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Trivy Scan (Repo)
on:
workflow_dispatch:
pull_request:
push:
branches:
- 'main'
- 'release/*'
concurrency:
group: trivy_scan_${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
scan-repo-trivy:
env:
TRIVY_REPORT_PREFIX: trivy-report-concrete
# used by aquasecurity/trivy-action
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db:1
runs-on: ubuntu-latest
steps:
- name: Checkout parent Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- name: Export DateTime
run: |
fullnumericdate=$(date +%Y%m%d%H%M%S)
echo "DATE_FULL=$fullnumericdate" >> "$GITHUB_ENV"
- name: Scan repo (json)
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # 0.29.0
with:
scan-type: fs
scanners: vuln,secret,misconfig
scan-ref: ./
format: json
output: ${{ env.TRIVY_REPORT_PREFIX }}-${{ env.DATE_FULL }}.json
- name: Scan repo (sarif)
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # 0.29.0
with:
scan-type: fs
scanners: vuln,secret,misconfig
scan-ref: ./
format: sarif
output: ${{ env.TRIVY_REPORT_PREFIX }}-${{ env.DATE_FULL }}.sarif
- name: Download Trivy HTML template
run: |
wget -q https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/html.tpl -P trivy_contrib/
- name: Scan repo (html)
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # 0.29.0
with:
scan-type: fs
scanners: vuln,secret,misconfig
scan-ref: ./
format: template
template: '@trivy_contrib/html.tpl'
output: ${{ env.TRIVY_REPORT_PREFIX }}-${{ env.DATE_FULL }}.html
- name: Upload scan results as artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: ${{ env.TRIVY_REPORT_PREFIX }}-all-${{ env.DATE_FULL }}
path: ${{ env.TRIVY_REPORT_PREFIX }}-${{ env.DATE_FULL }}.*
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@dd7559424621a6dd0b32ababe9e4b271a87f78d2 # v3.27.6
with:
sarif_file: ${{ env.TRIVY_REPORT_PREFIX }}-${{ env.DATE_FULL }}.sarif
category: sca-trivy-repo