Skip to content

Commit

Permalink
Trivy GitHub action (#12)
Browse files Browse the repository at this point in the history
Move Trivy scans from Azure CI pipeline (written by @Dabnsky) to a GitHub Action workflow.
  • Loading branch information
foodprocessor authored Sep 29, 2023
1 parent 72b6d8f commit 735d249
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 70 deletions.
48 changes: 21 additions & 27 deletions .github/workflows/trivy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
# separate terms of service, privacy policy, and support
# documentation.

name: build
name: trivy

on:
push:
branches: [ "main", master ]
branches:
- main
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
# every Monday at 7:31pm
- cron: '31 19 * * 1'

permissions:
Expand All @@ -29,29 +29,23 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build Cloudfuse
run: |
sudo apt-get install fuse3 libfuse3-dev -y
go build -o cloudfuse
ls -l
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: fs
scan-ref: './cloudfuse'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results-binary.sarif'
severity: 'CRITICAL,HIGH,MEDIUM,LOW'

- name: List Issues
- name: Install Trivy
run: |
cat trivy-results-binary.sarif
sudo apt-get install wget apt-transport-https gnupg lsb-release -y
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install trivy -y
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results-binary.sarif'
- name: Run vulnerability scanner
run: |
trivy fs ./ --scanners license --exit-code 1 --severity HIGH,CRITICAL
trivy fs ./ --exit-code 1 --severity MEDIUM,HIGH,CRITICAL --dependency-tree
#TODO: maybe use this when codeql is available (after publishing)
# - name: Upload Trivy scan results to GitHub Security tab
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: 'trivy-results-binary.sarif'
5 changes: 0 additions & 5 deletions RunTrivyScans.sh

This file was deleted.

7 changes: 0 additions & 7 deletions TrivySetup.sh

This file was deleted.

31 changes: 0 additions & 31 deletions cloudfuse-vunerability-scanning.yaml

This file was deleted.

0 comments on commit 735d249

Please sign in to comment.