2424
2525 steps :
2626 - name : Check out the repository
27- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
27+ uses : actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v6.0.2
2828 with :
2929 fetch-depth : 0
3030
@@ -35,42 +35,73 @@ jobs:
3535 cache : true
3636
3737 - name : Run Gosec Security Scanner
38- uses : securego/gosec@424fc4cd9c82ea0fd6bee9cd49c2db2c3cc0c93f # v2.22.11
38+ id : gosec
39+ uses : securego/gosec@bb17e422fc34bf4c0a2e5cab9d07dc45a68c040c # v2.24.7
40+ continue-on-error : true
3941 with :
40- args : " -fmt sarif -out gosec.sarif ./..."
41- config : .github/codeql/codeql-config.yml
42+ args : " -fmt sarif -out gosec.sarif -exclude-dir=vendor -tests=false -exclude=G101 ./..."
4243
43- - name : Upload SARIF file
44- uses : github/codeql-action/upload-sarif@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4
45- if : always()
44+ - name : Upload Gosec SARIF file
45+ uses : github/codeql-action/upload-sarif@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
46+ if : always() && hashFiles('gosec.sarif') != ''
4647 with :
4748 sarif_file : gosec.sarif
48- config-file : .github/codeql/codeql-config.yml
49+
50+ - name : Fail on Gosec findings
51+ if : always() && steps.gosec.outcome == 'failure'
52+ run : |
53+ echo "## Gosec Security Scanner Found Issues" >> $GITHUB_STEP_SUMMARY
54+ echo "" >> $GITHUB_STEP_SUMMARY
55+ if [ -f gosec.sarif ]; then
56+ echo "| Rule | File | Line | Description |" >> $GITHUB_STEP_SUMMARY
57+ echo "|------|------|------|-------------|" >> $GITHUB_STEP_SUMMARY
58+ jq -r '.runs[0].results[] | "| \(.ruleId) | \(.locations[0].physicalLocation.artifactLocation.uri) | \(.locations[0].physicalLocation.region.startLine) | \(.message.text) |"' gosec.sarif >> $GITHUB_STEP_SUMMARY
59+ fi
60+ echo "" >> $GITHUB_STEP_SUMMARY
61+ echo "See the **Security** tab for full details." >> $GITHUB_STEP_SUMMARY
62+ exit 1
4963
5064 - name : Run Trivy vulnerability scanner
51- uses : aquasecurity/trivy-action@062f2592684a31eb3aa050cc61e7ca1451cecd3d # 0.18.0
65+ id : trivy
66+ uses : aquasecurity/trivy-action@e368e328979b113139d6f9068e03accaed98a518 # 0.34.1
67+ continue-on-error : true
5268 with :
5369 scan-type : " fs"
5470 scan-ref : " ."
71+ version : " v0.69.2"
5572 format : " sarif"
5673 output : " trivy-results.sarif"
5774 ignore-unfixed : true
5875 severity : " CRITICAL,HIGH"
5976
60- - name : Upload Trivy scan results to GitHub Security tab
61- uses : github/codeql-action/upload-sarif@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4
62- if : always()
77+ - name : Upload Trivy SARIF file
78+ uses : github/codeql-action/upload-sarif@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
79+ if : always() && hashFiles('trivy-results.sarif') != ''
6380 with :
6481 sarif_file : " trivy-results.sarif"
6582
83+ - name : Fail on Trivy findings
84+ if : always() && steps.trivy.outcome == 'failure'
85+ run : |
86+ echo "## Trivy Vulnerability Scanner Found Issues" >> $GITHUB_STEP_SUMMARY
87+ echo "" >> $GITHUB_STEP_SUMMARY
88+ if [ -f trivy-results.sarif ]; then
89+ echo "| Rule | File | Severity | Description |" >> $GITHUB_STEP_SUMMARY
90+ echo "|------|------|----------|-------------|" >> $GITHUB_STEP_SUMMARY
91+ jq -r '.runs[0].results[]? | "| \(.ruleId) | \(.locations[0].physicalLocation.artifactLocation.uri) | \(.level) | \(.message.text[:100]) |"' trivy-results.sarif >> $GITHUB_STEP_SUMMARY
92+ fi
93+ echo "" >> $GITHUB_STEP_SUMMARY
94+ echo "See the **Security** tab for full details." >> $GITHUB_STEP_SUMMARY
95+ exit 1
96+
6697 dependency-check :
6798 name : Dependency Security Check
6899 runs-on : ubuntu-latest
69100 timeout-minutes : 15
70101
71102 steps :
72103 - name : Check out the repository
73- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
104+ uses : actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v6.0.2
74105
75106 - name : Set up Go
76107 uses : actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
99130
100131 steps :
101132 - name : Check out the repository
102- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
133+ uses : actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v6.0.2
103134 with :
104135 fetch-depth : 0
105136
@@ -130,7 +161,7 @@ jobs:
130161
131162 steps :
132163 - name : Checkout repository
133- uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
164+ uses : actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v6.0.2
134165 with :
135166 persist-credentials : false
136167
@@ -142,7 +173,7 @@ jobs:
142173 publish_results : true
143174
144175 - name : Upload SARIF results to GitHub
145- uses : github/codeql-action/upload-sarif@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4
176+ uses : github/codeql-action/upload-sarif@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
146177 with :
147178 sarif_file : results.sarif
148179
0 commit comments