File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -11,17 +11,20 @@ jobs:
11
11
steps :
12
12
- name : Checkout code
13
13
uses : actions/checkout@v4
14
-
15
- - name : Run Trivy vulnerability scanner in repo mode
16
- uses : aquasecurity/trivy-action@master
17
14
with :
18
- scan-type : " fs"
19
- ignore-unfixed : true
20
- format : " sarif"
21
- output : " trivy-results.sarif"
22
- severity : " CRITICAL,HIGH"
15
+ ref : ${{ github.event.pull_request.head.sha }}
23
16
24
- - name : Upload Trivy scan results to GitHub Security tab
25
- uses : github/codeql-action/upload-sarif@v2
26
- with :
27
- sarif_file : " trivy-results.sarif"
17
+ - name : Download latest trivy
18
+ run : |
19
+ mkdir -p ${{ github.workspace }}/trivy
20
+ LATEST_TRIVY_VERSION=$(curl --retry 5 --retry-connrefused --retry-delay 5 --fail -s https://api.github.com/repos/aquasecurity/trivy/releases/latest | jq -r .tag_name)
21
+ TRIVY_VERSION_STRIPPED=$(echo "$LATEST_TRIVY_VERSION" | sed 's/^v//')
22
+ wget --tries=5 --retry-connrefused --waitretry=5 -O ${{ github.workspace }}/trivy/trivy.tar.gz \
23
+ https://github.com/aquasecurity/trivy/releases/download/$LATEST_TRIVY_VERSION/trivy_${TRIVY_VERSION_STRIPPED}_Linux-64bit.tar.gz && break || sleep 5
24
+ tar -xzf ${{ github.workspace }}/trivy/trivy.tar.gz -C ${{ github.workspace }}/trivy
25
+
26
+ - name : Generate SBOM
27
+ run : ${{ github.workspace }}/trivy/trivy fs --format cyclonedx --output ${{ github.workspace }}/sbom.json ${{ github.workspace }}
28
+
29
+ - name : Run trivy scan on SBOM
30
+ run : ${{ github.workspace }}/trivy/trivy sbom ${{ github.workspace }}/sbom.json --severity HIGH,CRITICAL --ignore-unfixed --exit-code=1
You can’t perform that action at this time.
0 commit comments