File tree Expand file tree Collapse file tree 2 files changed +18
-14
lines changed
Expand file tree Collapse file tree 2 files changed +18
-14
lines changed Original file line number Diff line number Diff line change 1- name : Run Security Scan
1+ name : GoSec
22
33on :
44 push :
99jobs :
1010 scan :
1111 runs-on : ubuntu-latest
12-
12+ permissions :
13+ # required for all workflows
14+ security-events : write
15+ contents : read
1316 steps :
17+
1418 - name : Checkout repository
1519 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1620 with :
1721 persist-credentials : false
1822
19- - name : Run Gosec Security Scanner
23+ - name : Security scan
24+ shell : bash
2025 run : |
21- export PATH=$PATH:$(go env GOPATH)/bin
22- go install github.com/securego/gosec/v2/cmd/gosec@latest
23- make gosec
24- if [[ $? != 0 ]]
25- then
26- echo "gosec scanner failed to run "
27- exit 1
28- fi
26+ make gosec
27+ if [[ $? != 0 ]]
28+ then
29+ echo "gosec scanner failed to run "
30+ exit 1
31+ fi
2932
3033 - name : Upload SARIF file
31- uses : github/codeql-action/upload-sarif@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # v3.29 .8
34+ uses : github/codeql-action/upload-sarif@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v4.30 .8
3235 if : always()
3336 with :
3437 # Path to SARIF file relative to the root of the repository
Original file line number Diff line number Diff line change @@ -85,7 +85,8 @@ push-image:
8585
8686.PHONY : gosec
8787gosec : install.gosec
88- $(GOSEC ) -no-fail -fmt=sarif -out=gosec.sarif -exclude-dir tests ./...
88+ $(GOSEC ) -no-fail -fmt=sarif -out=gosec.sarif -exclude-dir tests --exclude G304 ./...
89+ # excluding rule G304 because hits currently produce an invalid SARIF.
8990
9091# ## Python Specific Targets
9192PY_BIN ?= python3
@@ -147,7 +148,7 @@ venv.tools.always-reinstall:
147148# ## Developer Tooling Installation
148149# gosec
149150GOSEC = $(shell pwd) /out/gosec
150- GOSEC_VERSION ?= latest
151+ GOSEC_VERSION ?= 6be2b51fd78feca86af91f5186b7964d76cb1256 # v2.22.10
151152install.gosec:
152153 $(call go-install-tool,$(GOSEC),github.com/securego/gosec/v2/cmd/gosec@$(GOSEC_VERSION))
153154
You can’t perform that action at this time.
0 commit comments