Skip to content

Add a check for vulnerabilities in the Go database #100

Add a check for vulnerabilities in the Go database

Add a check for vulnerabilities in the Go database #100

Workflow file for this run

# https://aquasecurity.github.io/trivy
name: Trivy
on:
pull_request:
push:
branches:
- main
env:
# Use the Go toolchain installed by setup-go
# https://github.com/actions/setup-go/issues/457
GOTOOLCHAIN: local
jobs:
licenses:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Trivy needs a populated Go module cache to detect Go module licenses.
- uses: actions/setup-go@v5
with: { go-version: stable }
- run: go mod download
# Report success only when detected licenses are listed in [/trivy.yaml].
- name: Scan licenses
uses: aquasecurity/trivy-action@0.28.0
env:
TRIVY_DEBUG: true
with:
scan-type: filesystem
scanners: license
exit-code: 1
vulnerabilities:
if: ${{ github.repository == 'CrunchyData/postgres-operator' }}
permissions:
security-events: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Print any detected secrets or vulnerabilities to the workflow log for
# human consumption. This step fails only when Trivy is unable to scan.
# A later step uploads results to GitHub as a pull request check.
- name: Log detected vulnerabilities
uses: aquasecurity/trivy-action@0.28.0
with:
scan-type: filesystem
hide-progress: true
scanners: secret,vuln
# Produce a SARIF report of actionable results. This step fails only when
# Trivy is unable to scan.
- name: Report actionable vulnerabilities
uses: aquasecurity/trivy-action@0.28.0
with:
scan-type: filesystem
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
scanners: secret,vuln
# Submit the SARIF report to GitHub code scanning. Pull requests checks
# succeed or fail according to branch protection rules.
# - https://docs.github.com/en/code-security/code-scanning
- name: Upload results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'