-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (75 loc) · 2.46 KB
/
security.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
77
78
name: "Security"
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '30 12 * * 3'
jobs:
gosec:
name: gosec check
runs-on: ubuntu-latest
# Skip any created PR or push by dependabot to avoid permission issues
if: github.actor != 'dependabot[bot]'
env:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Run gosec security scanner
uses: securego/gosec@v2.21.4
with:
# with '-no-fail' we let the report trigger content trigger a failure using the GitHub Security features.
args: "-no-fail -fmt sarif -out gosec.sarif ./..."
- name: Upload SARIF file for GitHub Advanced Security Dashboard
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: gosec.sarif
semgrep:
name: semgrep scan
runs-on: ubuntu-latest
# Skip any created PR or push by dependabot to avoid permission issues
if: github.actor != 'dependabot[bot]'
container:
image: returntocorp/semgrep:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# we let the report trigger content trigger a failure using the GitHub Security features.
# see https://semgrep.dev/docs/cli-usage/#exit-codes for more details.
- name: Run semgrep security scanner
run: |
cat << 'EOF' | bash
semgrep ci --config=auto --sarif --output=semgrep.sarif --max-target-bytes=2MB
EXIT_CODE=$?
if [ "$EXIT_CODE" = "0" ] || [ "$EXIT_CODE" = "1" ]
then
exit 0
else
exit $EXIT_CODE
fi
EOF
- name: Upload SARIF file for GitHub Advanced Security Dashboard
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: semgrep.sarif
vuln-scan:
name: Vulnerability scanner
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5.2.0
with:
go-version: 1.23.x
check-latest: true
cache: true
- name: Run go list
run: go list -json -deps ./... > go.list
- name: Nancy
uses: sonatype-nexus-community/nancy-github-action@v1.0.3
- name: govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest && govulncheck ./...