Debian Codegraph @

.github/workflows/security.yaml

raw
1 name: Run Security Checks
2 on:
3 push:
4 branches: [main]
5 pull_request:
6 branches: [main]
7 paths:
8 - internal/**
9 - pkg/**
10 - shoutrrr/**
11 - go.mod
12 - go.sum
13 - shoutrrr.go
14 schedule:
15 - cron: "0 0 * * *"
16
17 env:
18 OUTPUT_FILE: results.sarif
19
20 permissions:
21 contents: read # Set default read-only permissions
22
23 jobs:
24 gosec:
25 name: Run gosec Scanner
26 runs-on: ubuntu-latest
27 permissions:
28 contents: read
29 security-events: write
30 steps:
31 - name: Harden the Runner (Step Security)
32 uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
33 with:
34 egress-policy: audit
35
36 - name: Checkout Repo
37 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
38 with:
39 persist-credentials: false
40
41 - name: Run Gosec Security Scanner
42 uses: securego/gosec@deb54465fea23d19a77f037e11e6589021f8501d # v2.29.0
43 with:
44 args: "-exclude-generated -no-fail -fmt sarif -out ${{ env.OUTPUT_FILE }} ./..."
45
46 - name: Upload SARIF file
47 uses: github/codeql-action/upload-sarif@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1
48 with:
49 sarif_file: ${{ env.OUTPUT_FILE }}
50 category: gosec-sarif
51
52 govulncheck:
53 name: Run govulncheck Scanner
54 runs-on: ubuntu-latest
55 permissions:
56 contents: read
57 security-events: write
58 steps:
59 - name: Harden the Runner (Step Security)
60 uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
61 with:
62 egress-policy: audit
63
64 - name: Run govulncheck
65 id: govulncheck
66 uses: nicholas-fedor/govulncheck-action@2e8328bfd2a2259f6b48ad47edc8101c86e74883 # v1.0.5
67 with:
68 output-format: sarif
69 output-file: ${{ env.OUTPUT_FILE }}
70 go-version-file: "go.mod"
71
72 - name: Upload SARIF file
73 uses: github/codeql-action/upload-sarif@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1
74 with:
75 sarif_file: ${{ env.OUTPUT_FILE }}
76 category: govulncheck-sarif