Skip to content

Commit b224f84

Browse files
committed
gosec enablement
Signed-off-by: Kim Tsao <[email protected]>
1 parent f17c2bf commit b224f84

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ jobs:
6363
- name: Upload coverage to Codecov
6464
uses: codecov/[email protected]
6565

66+
- name: Run Gosec Security Scanner
67+
run: |
68+
go install github.com/securego/gosec/v2/cmd/gosec@latest
69+
./run_gosec.sh
70+
if [[ $? != 0 ]]
71+
then
72+
echo "gosec scanner failed to run "
73+
exit 1
74+
fi
75+
76+
- name: Upload SARIF file
77+
uses: github/codeql-action/upload-sarif@v2
78+
with:
79+
# Path to SARIF file relative to the root of the repository
80+
sarif_file: gosec.sarif
81+
6682
test_minikube:
6783
name: Test Devfile Registry
6884
runs-on: ubuntu-latest

run_gosec.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# This script runs the gosec scanner locally
3+
4+
if ! command -v gosec 2> /dev/null
5+
then
6+
echo "error gosec must be installed with this command: go install github.com/securego/gosec/v2/cmd/gosec@latest" && exit 1
7+
fi
8+
9+
gosec -no-fail -fmt=sarif -out=gosec.sarif -exclude-dir tests ./...

0 commit comments

Comments
 (0)