From f9e8c9d83faf12a6e6689e2848835695bf51d37b Mon Sep 17 00:00:00 2001 From: Ben Blattberg Date: Fri, 20 Jan 2023 16:03:46 -0600 Subject: [PATCH 1/3] test exit code --- .github/workflows/trivy-scan.yaml | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/trivy-scan.yaml diff --git a/.github/workflows/trivy-scan.yaml b/.github/workflows/trivy-scan.yaml new file mode 100644 index 0000000000..af24852277 --- /dev/null +++ b/.github/workflows/trivy-scan.yaml @@ -0,0 +1,43 @@ +name: Trivy + +on: + pull_request: + branches: + - master + push: + branches: + - master + schedule: + - cron: '25 16 * * 2' + +jobs: + scan: + runs-on: ubuntu-latest + + #if: ${{ github.repository == 'CrunchyData/postgres-operator' }} + + steps: + - uses: actions/checkout@v3 + + - name: Log all detected vulnerabilities + uses: aquasecurity/trivy-action@master + with: + scan-type: fs + hide-progress: true + exit-code: 1 + + # Upload actionable results to the GitHub Security tab. + # Pull request checks fail according to repository settings. + # + # - https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github + # - https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning + - name: Report actionable vulnerabilities + uses: aquasecurity/trivy-action@master + with: + scan-type: fs + ignore-unfixed: true + format: 'sarif' + output: 'trivy-results.sarif' + - uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: 'trivy-results.sarif' From b761a0323d688eb4529e28725ade7e4f9f937853 Mon Sep 17 00:00:00 2001 From: Ben Blattberg Date: Fri, 20 Jan 2023 16:07:57 -0600 Subject: [PATCH 2/3] remove exit --- .github/workflows/trivy-scan.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trivy-scan.yaml b/.github/workflows/trivy-scan.yaml index af24852277..a3d76dfab5 100644 --- a/.github/workflows/trivy-scan.yaml +++ b/.github/workflows/trivy-scan.yaml @@ -24,7 +24,7 @@ jobs: with: scan-type: fs hide-progress: true - exit-code: 1 + # exit-code: 1 # Upload actionable results to the GitHub Security tab. # Pull request checks fail according to repository settings. From da2c19b2abe6ffb37e91294651492ffead9cda6d Mon Sep 17 00:00:00 2001 From: Ben Blattberg Date: Fri, 20 Jan 2023 16:12:07 -0600 Subject: [PATCH 3/3] test write --- .github/workflows/trivy-scan.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/trivy-scan.yaml b/.github/workflows/trivy-scan.yaml index a3d76dfab5..59d9225f6d 100644 --- a/.github/workflows/trivy-scan.yaml +++ b/.github/workflows/trivy-scan.yaml @@ -12,6 +12,9 @@ on: jobs: scan: + permissions: + # contents: read # for actions/checkout to fetch code + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results runs-on: ubuntu-latest #if: ${{ github.repository == 'CrunchyData/postgres-operator' }}