aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/trivy-scan.yaml
blob: 283ff8d457f6a2c0bc1088509af31827e67167fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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@1f0aa582c8c8f5f7639610d6d38baddfea4fdcee  # master
        with:
          image-ref: 'docker.io/coredns/coredns:${{ matrix.versions }}'
          severity: 'CRITICAL,HIGH'
          format: 'sarif'
          output: 'trivy-results.sarif'

      - name: Upload Trivy scan results to GitHub Security tab
        uses: github/codeql-action/upload-sarif@168b99b3c22180941ae7dbdd5f5c9678ede476ba  # v2.2.7
        with:
          sarif_file: 'trivy-results.sarif'