-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (126 loc) · 4.83 KB
/
continuous-security.yml
File metadata and controls
146 lines (126 loc) · 4.83 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Continuous Security
on:
schedule:
- cron: '30 2 * * 2'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
scheduled-scans:
name: Weekly Deep Scans
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
actions: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
cache: true
# ---- Govulncheck ----
- name: Govulncheck (scheduled)
uses: golang/govulncheck-action@b625fbe08f3bccbe446d94fbf87fcc875a4f50ee # v1.0.4
with:
repo-checkout: false
go-version-file: go.mod
go-package: ./...
output-format: sarif
output-file: govulncheck.sarif
# - name: Upload Govulncheck SARIF
# if: always() && hashFiles('govulncheck.sarif') != ''
# uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v4
# with:
# sarif_file: govulncheck.sarif
# category: '/tool:govulncheck'
# # ---- Semgrep via container (no pip) ----
# - name: Semgrep (security audit)
# continue-on-error: true
# run: |
# docker run --rm -v "$PWD:/src" -w /src returntocorp/semgrep:1.102.0 \
# semgrep scan --config p/security-audit \
# --sarif --sarif-output semgrep.sarif \
# --metrics=off
# - name: Upload Semgrep SARIF
# if: always() && hashFiles('semgrep.sarif') != ''
# uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v4
# with:
# sarif_file: semgrep.sarif
# category: '/tool:semgrep'
# ---- Trivy: FS ----
- name: Trivy filesystem scan (full)
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # 0.35.0
with:
scan-type: fs
format: sarif
output: trivy-fs.sarif
severity: MEDIUM,HIGH,CRITICAL
ignore-unfixed: true
# - name: Upload Trivy FS SARIF
# if: always() && hashFiles('trivy-fs.sarif') != ''
# uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v4
# with:
# sarif_file: trivy-fs.sarif
# category: '/tool:trivy-fs'
# ---- Trivy: Config ----
- name: Trivy config scan (Helm/K8s)
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # 0.35.0
with:
scan-type: config
format: sarif
output: trivy-config.sarif
severity: MEDIUM,HIGH,CRITICAL
ignore-unfixed: true
# - name: Upload Trivy config SARIF
# if: always() && hashFiles('trivy-config.sarif') != ''
# uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v4
# with:
# sarif_file: trivy-config.sarif
# category: '/tool:trivy-config'
# ---- Build image + Trivy image scan ----
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Build controller image (scheduled)
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: false
load: true
tags: pangolin-kube-controller:security
- name: Trivy image scan (scheduled)
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # 0.35.0
with:
image-ref: pangolin-kube-controller:security
format: sarif
output: trivy-image.sarif
severity: MEDIUM,HIGH,CRITICAL
ignore-unfixed: true
# - name: Upload Trivy image SARIF
# if: always() && hashFiles('trivy-image.sarif') != ''
# uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v4
# with:
# sarif_file: trivy-image.sarif
# category: '/tool:trivy-image'
# ---- SBOM (Syft) ----
- name: Generate SBOM (Syft)
uses: anchore/sbom-action@17ae1740179002c89186b61233e0f892c3118b11 # v0.23.0
with:
image: pangolin-kube-controller:security
upload-artifact: false
output-file: weekly-sbom.spdx.json
- name: Upload SBOM artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: weekly-sbom
path: weekly-sbom.spdx.json