Skip to content

Commit

Permalink
github: Add Trivy repo scan
Browse files Browse the repository at this point in the history
Signed-off-by: hamistao <[email protected]>
  • Loading branch information
hamistao committed Sep 26, 2024
1 parent aa06597 commit 8e4ad2a
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Vulnerability Scanning with Trivy
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Test Trivy daily at midnight

permissions:
contents: read
security-events: write # for uploading SARIF results to the security tab

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
trivy-repo:
name: Trivy vulnerability scanner - Repository
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main

- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
with:
scan-type: "fs"
format: "sarif"
output: "trivy-lxd-repo-scan-results.sarif"
severity: "LOW,MEDIUM,HIGH,CRITICAL"

- name: Cache trivy and vulnerability database
uses: actions/cache/save@v4
with:
path: /home/runner/vuln-cache
key: trivy-cache

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "trivy-lxd-repo-scan-results.sarif"
sha: ${{ github.sha }}
ref: refs/heads/main

0 comments on commit 8e4ad2a

Please sign in to comment.