@@ -181,9 +181,55 @@ 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
+ # Steps represent a sequence of tasks that will be executed as part of the job
202
+ steps :
203
+ # Checks-out your repository under $GITHUB_WORKSPACE, so follow-up steps can access it
204
+ - uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
205
+
206
+ - name : Download artifact
207
+ uses : actions/download-artifact@v4
208
+ with :
209
+ name : ${{ env.ARTIFACT_NAME }}_prod
210
+ path : /tmp/
211
+
212
+ - name : Load image
213
+ run : |
214
+ docker load --input /tmp/${{ env.ARTIFACT_NAME }}_prod.tar
215
+ docker image ls -a
216
+
217
+ - name : Checkov GitHub Action
218
+ uses : bridgecrewio/checkov-action@v12
219
+ with :
220
+ # This will add both a CLI output to the console and create a checkov-results.sarif file
221
+ docker_image : ${{ env.IMAGE_NAME }}:${{ github.sha }} # define the name of the image to scan
222
+ output_format : cli,sarif
223
+ output_file_path : console,checkov-results.sarif
224
+
225
+ - name : Upload SARIF file
226
+ uses : github/codeql-action/upload-sarif@v3
227
+ # Results are generated only on a success or failure
228
+ # this is required since GitHub by default won't run the next step
229
+ # when the previous one has failed. Security checks that do not pass will 'fail'.
230
+ # An alternative is to add `continue-on-error: true` to the previous step
231
+ # Or 'soft_fail: true' to checkov.
232
+ if : success() || failure()
233
+ with :
234
+ sarif_file : checkov-results.sarif
235
+ # yamllint enable rule:line-length
0 commit comments