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@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
33 with:
34 egress-policy: audit
35
36 - name: Checkout Repo
37 uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
38 with:
39 persist-credentials: false
40
41 - name: Run Gosec Security Scanner
42 uses: securego/gosec@9e6a9843d7a4a6e3e9a8539b02612c8a4aa3f889 # v2.27.1
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@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
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@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
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@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
74 with:
75 sarif_file: ${{ env.OUTPUT_FILE }}
76 category: govulncheck-sarif