ci: add security scan with trivy #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Security scan | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
pull_request: | ||
schedule: | ||
- cron: '0 9 * * *' # Same time as CI Cron | ||
jobs: | ||
trivy-scan: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout newrelic-php-agent code | ||
uses: actions/checkout@v4 | ||
with: | ||
path: php-agent | ||
- name: Run Trivy in table mode | ||
# Table output is only useful when running on a pull request or push. | ||
if: contains(fromJSON('["push", "pull_request"]'), github.event_name) | ||
working-directory: ./php-agent | ||
uses: aquasecurity/trivy-action@0.28.0 | ||
Check failure on line 23 in .github/workflows/security-scan.yml GitHub Actions / Security scanInvalid workflow file
|
||
with: | ||
scan-type: fs | ||
scanners: vuln,misconfig | ||
skip-dirs: vendor | ||
format: table | ||
exit-code: 1 | ||
ignore-unfixed: true | ||
severity: CRITICAL,HIGH,MEDIUM,LOW | ||
- name: Run Trivy in report mode | ||
# Only generate sarif when running nightly on the dev branch. | ||
if: ${{ github.event_name == 'schedule' }} | ||
uses: aquasecurity/trivy-action@0.28.0 | ||
with: | ||
scan-type: fs | ||
skip-dirs: vendor | ||
format: sarif | ||
output: trivy-results.sarif | ||
ignore-unfixed: true | ||
severity: 'CRITICAL,HIGH,MEDIUM,LOW' | ||
- name: Upload Trivy scan results to GitHub Security tab | ||
# Only upload sarif when running nightly on the dev branch. | ||
if: ${{ github.event_name == 'schedule' }} | ||
uses: aquasecurity/trivy-action@0.28.0 | ||
with: | ||
sarif_file: trivy-results.sarif |