Skip to content

Commit fefbeec

Browse files
Add trivy scan to replace tfsec (#78)
* Add trivy scan for testing * update output format * Use 0.13.0 * use version * version lock trivy action * use 0.12.0 * upload results * Test with sed * Update terraform.yaml * Update terraform.yaml --------- Co-authored-by: Poh Peng <thepoppingone@users.noreply.github.com>
1 parent 5b37482 commit fefbeec

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

.github/workflows/terraform.yaml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,28 @@ jobs:
321321
fetch-depth: 1
322322
submodules: ${{ inputs.enable_submodules }}
323323

324-
- name: Run tfsec with reviewdog output on the PR
325-
uses: reviewdog/action-tfsec@master
324+
- name: Run Trivy vulnerability scanner in IaC mode
325+
uses: aquasecurity/trivy-action@0.12.0
326326
with:
327-
github_token: ${{ secrets.GITHUB_TOKEN }}
328-
reporter: github-pr-review
329-
flags: -tee
330-
if: inputs.upload_sarif != true
327+
scan-type: 'config'
328+
hide-progress: false
329+
format: 'sarif'
330+
output: 'trivy-results.sarif'
331+
exit-code: '1'
332+
ignore-unfixed: true
333+
severity: 'CRITICAL,HIGH'
334+
335+
# https://github.com/aquasecurity/trivy/issues/5003
336+
- name: Remove git from url for sarif uploading
337+
shell: bash
338+
run: |
339+
sed -i 's#git::https:/##g' trivy-results.sarif
340+
341+
- name: Upload Trivy scan results to GitHub Security tab
342+
uses: github/codeql-action/upload-sarif@v2
343+
with:
344+
sarif_file: 'trivy-results.sarif'
345+
# if: inputs.upload_sarif == true
331346

332347
- name: Run Checkov action
333348
id: checkov

0 commit comments

Comments
 (0)