From cc250039b658d353c4957f3a6b8bea4fc02be2a7 Mon Sep 17 00:00:00 2001 From: Rouven Himmelstein Date: Wed, 24 Jan 2024 13:24:46 +0100 Subject: [PATCH] feat: add scheduled security audits --- .../workflows/scheduled-security-audit.yaml | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/scheduled-security-audit.yaml diff --git a/.github/workflows/scheduled-security-audit.yaml b/.github/workflows/scheduled-security-audit.yaml new file mode 100644 index 0000000..faca777 --- /dev/null +++ b/.github/workflows/scheduled-security-audit.yaml @@ -0,0 +1,77 @@ +name: Security Audits +on: + schedule: + - cron: '0 0 * * *' # every day at midnight + workflow_dispatch: # allow manual execution + +env: + IMAGE_NAME: rouhim/sons-of-the-forest-server + IMAGE_TAG: latest + +jobs: + image-audit: + name: Audit container image + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@master + with: + image-ref: 'docker.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}' + format: 'sarif' + output: 'trivy-results.sarif' + exit-code: '0' + ignore-unfixed: true + severity: 'CRITICAL,HIGH' + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: 'trivy-results.sarif' + + filesystem-audit: + name: Audit repo filesystem + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + format: 'sarif' + output: 'trivy-results.sarif' + exit-code: '0' + ignore-unfixed: true + severity: 'CRITICAL,HIGH' + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: 'trivy-results.sarif' + + config-audit: + name: Audit config files + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@master + with: + scan-type: 'config' + hide-progress: false + format: 'sarif' + output: 'trivy-results.sarif' + exit-code: '0' + ignore-unfixed: true + severity: 'CRITICAL,HIGH' + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: 'trivy-results.sarif' \ No newline at end of file