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