Skip to content

Commit 51dcdfd

Browse files
committed
Add new security GitHub Action
Add a GitHub Action workflow file that runs govulncheck and Trivy in CI. Output results to CI job log and fail the job when issues are detected.
1 parent 82c8c8f commit 51dcdfd

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/security.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Security Scan
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
schedule:
9+
- cron: "0 3 * * *"
10+
11+
permissions:
12+
contents: read
13+
actions: read
14+
15+
concurrency:
16+
group: security-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
govulncheck:
21+
name: Go vulnerability check
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
25+
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
26+
with:
27+
go-version-file: go.mod
28+
- name: Run govulncheck
29+
uses: golang/govulncheck-action@b625fbe08f3bccbe446d94fbf87fcc875a4f50ee
30+
with:
31+
check-latest: true
32+
cache: false
33+
output-format: text
34+
35+
trivy:
36+
name: Trivy repo scan
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
40+
with:
41+
fetch-depth: 0
42+
- name: Trivy scan (table)
43+
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8
44+
with:
45+
scan-type: fs
46+
scanners: vuln,secret,misconfig
47+
ignore-unfixed: true
48+
format: table
49+
severity: MEDIUM,HIGH,CRITICAL
50+
exit-code: 1
51+
args: --no-progress

0 commit comments

Comments
 (0)