-
Notifications
You must be signed in to change notification settings - Fork 108
87 lines (78 loc) · 2.56 KB
/
Copy pathsecurity_analysis.yml
File metadata and controls
87 lines (78 loc) · 2.56 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
---
name: Security Analysis
permissions: {}
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
permissions:
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
# 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@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version-file: go.mod
- name: Initialize CodeQL
uses: github/codeql-action/init@e46ed2cbd01164d986452f91f178727624ae40d7 # v4
with:
languages: go
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@e46ed2cbd01164d986452f91f178727624ae40d7 # v4
trivy:
name: Trivy
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Build an image from Dockerfile
run: |
docker build . -t kubesec:${{ github.sha }}
- name: Run Trivy
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # 0.36.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@e46ed2cbd01164d986452f91f178727624ae40d7 # v4
with:
sarif_file: trivy-results.sarif
trufflehog:
name: TruffleHog
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
checks: write
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Run Trufflehog
uses: trufflesecurity/trufflehog@17456f8c7d042d8c82c9a8ca9e937231f9f42e26 # v3.95.2
with:
path: ./
base: ""
head: ${{ github.ref_name }}
extra_args: --debug --only-verified