@@ -181,9 +181,57 @@ jobs:
181
181
with :
182
182
image-ref : ${{ env.IMAGE_NAME }}:${{ github.sha }}
183
183
format : ' sarif'
184
- output : ' trivy-results.sarif'
184
+ output : ' trivy-checkov- results.sarif'
185
185
186
- - name : Upload Trivy scan results to GitHub Security tab
186
+ - name : Upload Trivy scan checkov- results to GitHub Security tab
187
187
uses : github/codeql-action/upload-sarif@v3
188
188
with :
189
- sarif_file : ' trivy-results.sarif'
189
+ sarif_file : ' trivy-checkov-results.sarif'
190
+
191
+ # yamllint disable rule:line-length
192
+ checkov :
193
+ permissions :
194
+ contents : read # for actions/checkout to fetch code
195
+ security-events : write # for github/codeql-action/upload-sarif to upload SARIF checkov-results
196
+ actions : read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
197
+
198
+ # The type of runner that the job will run on
199
+ runs-on : ubuntu-latest
200
+
201
+ needs : build
202
+
203
+ # Steps represent a sequence of tasks that will be executed as part of the job
204
+ steps :
205
+ # Checks-out your repository under $GITHUB_WORKSPACE, so follow-up steps can access it
206
+ - uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
207
+
208
+ - name : Download artifact
209
+ uses : actions/download-artifact@v4
210
+ with :
211
+ name : ${{ env.ARTIFACT_NAME }}_prod
212
+ path : /tmp/
213
+
214
+ - name : Load image
215
+ run : |
216
+ docker load --input /tmp/${{ env.ARTIFACT_NAME }}_prod.tar
217
+ docker image ls -a
218
+
219
+ - name : Checkov GitHub Action
220
+ uses : bridgecrewio/checkov-action@v12
221
+ with :
222
+ # This will add both a CLI output to the console and create a checkov-results.sarif file
223
+ docker_image : ${{ env.IMAGE_NAME }}:${{ github.sha }} # define the name of the image to scan
224
+ output_format : cli,sarif
225
+ output_file_path : console,checkov-results.sarif
226
+
227
+ - name : Upload SARIF file
228
+ uses : github/codeql-action/upload-sarif@v3
229
+ # Results are generated only on a success or failure
230
+ # this is required since GitHub by default won't run the next step
231
+ # when the previous one has failed. Security checks that do not pass will 'fail'.
232
+ # An alternative is to add `continue-on-error: true` to the previous step
233
+ # Or 'soft_fail: true' to checkov.
234
+ if : success() || failure()
235
+ with :
236
+ sarif_file : checkov-results.sarif
237
+ # yamllint enable rule:line-length
0 commit comments