-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (102 loc) · 3.06 KB
/
Copy pathsecurity.yml
File metadata and controls
116 lines (102 loc) · 3.06 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Security
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
trivy:
name: Trivy security scans
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Build local image
run: docker build -t local/testing-codeql:ci .
- name: Trivy secret scan
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: fs
scan-ref: .
scanners: secret
format: sarif
output: trivy-secrets.sarif
exit-code: 0
- name: Trivy Code Dependency Scan
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: fs
scan-ref: .
scanners: vuln
format: sarif
output: trivy-code.sarif
severity: CRITICAL,HIGH,MEDIUM
ignore-unfixed: true
exit-code: 0
- name: Trivy Dockerfile scan
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: config
scan-ref: .
format: sarif
output: trivy-dockerfile.sarif
severity: CRITICAL,HIGH,MEDIUM
exit-code: 0
- name: Trivy image scan
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: image
image-ref: local/testing-codeql:ci
format: sarif
output: trivy-image.sarif
severity: CRITICAL,HIGH
ignore-unfixed: true
vuln-type: os,library
exit-code: 0
- name: Label SARIF tool names
run: |
python - <<'PY'
import json, pathlib
for path, name in [
("trivy-secrets.sarif", "Trivy Secret Scanner"),
("trivy-code.sarif", "Trivy Code Dependency Scanner"),
("trivy-dockerfile.sarif", "Trivy Dockerfile Scanner"),
("trivy-image.sarif", "Trivy Image Scanner"),
]:
p = pathlib.Path(path)
d = json.loads(p.read_text())
for run in d.get("runs", []):
run.setdefault("tool", {}).setdefault("driver", {})["name"] = name
p.write_text(json.dumps(d))
PY
- name: Upload secrets SARIF
if: always()
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: trivy-secrets.sarif
category: trivy-secrets
- name: Upload code SARIF
if: always()
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: trivy-code.sarif
category: trivy-code
- name: Upload Dockerfile SARIF
if: always()
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: trivy-dockerfile.sarif
category: trivy-dockerfile
- name: Upload image SARIF
if: always()
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: trivy-image.sarif
category: trivy-image