diff --git a/.github/workflows/trivy-scan.yaml b/.github/workflows/trivy-scan.yaml new file mode 100644 index 000000000..b0f027eb9 --- /dev/null +++ b/.github/workflows/trivy-scan.yaml @@ -0,0 +1,34 @@ +name: Trivy Nightly Scan +on: + schedule: + - cron: '0 2 * * 5' #Run at 2AM UTC on every Friday + +permissions: read-all +jobs: + nightly-scan: + name: Trivy Scan nightly + strategy: + fail-fast: false + matrix: + # It will test for only the latest version as older version is not maintained + versions: [latest] + permissions: + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results + + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@9ab158e8597f3b310480b9a69402b419bc03dbd5 # master + with: + image-ref: 'docker.io/coredns/coredns:${{ matrix.versions }}' + severity: 'CRITICAL,HIGH' + format: 'template' + template: '@/contrib/sarif.tpl' + output: 'trivy-results.sarif' + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@a669cc5936cc5e1b6a362ec1ff9e410dc570d190 # v2.1.36 + with: + sarif_file: 'trivy-results.sarif'