@@ -94,23 +94,37 @@ jobs:
9494 - name : Install govulncheck
9595 run : go install golang.org/x/vuln/cmd/govulncheck@latest
9696
97- - name : Run govulncheck and fail if vulnerabilities are found
97+ - name : Run govulncheck and generate SARIF
9898 run : |
99+ # Generate SARIF output
100+ govulncheck -format sarif -scan=module ./... > govulncheck-results.sarif
101+
102+ # Also generate JSON for counting (optional)
99103 govulncheck -json ./... > vuln.json
100104 count=$(jq '[.[] | select(.finding != null and .finding.trace != null)] | length' vuln.json || echo 0)
101105 echo "Found $count vulnerabilities"
106+
107+ # Note: We don't fail the build here since we want to upload the SARIF file
102108 if [ "$count" -gt 0 ]; then
103- echo "❌ Vulnerabilities found by govulncheck"
104- cat vuln.json
105- exit 1
109+ echo "⚠️ Vulnerabilities found by govulncheck (see Security tab for details) "
110+ else
111+ echo "✅ No vulnerabilities found by govulncheck"
106112 fi
113+ continue-on-error : true
114+
115+ - name : Upload govulncheck results to GitHub Security tab
116+ uses : github/codeql-action/upload-sarif@v3
117+ if : always()
118+ with :
119+ sarif_file : govulncheck-results.sarif
120+ category : govulncheck
107121
108122 - name : Install gosec
109123 run : go install github.com/securego/gosec/v2/cmd/gosec@latest
110124
111125 - name : Run gosec security scanner
112126 run : |
113- gosec -fmt sarif -out gosec-results.sarif ./...
127+ gosec -fmt sarif -out gosec-results.sarif -exclude G304 ./...
114128 continue-on-error : true
115129
116130 - name : Upload gosec results to GitHub Security tab
0 commit comments