-
Notifications
You must be signed in to change notification settings - Fork 104
77 lines (67 loc) · 1.96 KB
/
security_analysis.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
---
name: Security Analysis
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: "0 6 * * *"
jobs:
codeql:
name: CodeQL
# "Initialize CodeQL" fails on forks and the results would not submit either
if: github.repository_owner == 'controlplaneio'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# provide a more modern go until resolved in codeql action
# https://github.com/github/codeql-action/issues/1842#issuecomment-1704398087
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: go
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
trivy:
name: Trivy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build an image from Dockerfile
run: |
docker build . -t kubesec:${{ github.sha }}
- name: Run Trivy
uses: aquasecurity/trivy-action@0.28.0
with:
image-ref: kubesec:${{ github.sha }}
format: template
template: "@/contrib/sarif.tpl"
output: trivy-results.sarif
- name: Upload Trivy results to the Security tab
# can't submit scan results on forks
if: github.repository_owner == 'controlplaneio'
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-results.sarif
trufflehog:
name: TruffleHog
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Trufflehog
uses: trufflesecurity/trufflehog@v3.83.2
with:
path: ./
base: ""
head: ${{ github.ref_name }}
extra_args: --debug --only-verified