Skip to content

Security scan

Security scan #58

Workflow file for this run

name: Security scan
on:
# Run only on pushes to version bump pull requests that modify Dockerfile
push:
paths:
- '**/Dockerfile'
branches:
- '[1-9]+.[0-9]+.[0-9]+'
# Run nightly
schedule:
- cron: '0 9 * * *'
jobs:
trivy-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Trivy in table mode
# Table output is only useful when running on a pull request or push.
if: contains(fromJSON('["push"]'), github.event_name)
uses: aquasecurity/trivy-action@0.28.0
with:
scan-type: fs
scan-ref: ./${{ github.ref_name }}
trivy-config: ./trivy.yaml
format: table
exit-code: 1
- name: Run Trivy in report mode
# Only generate sarif when running nightly
if: ${{ github.event_name == 'schedule' }}
uses: aquasecurity/trivy-action@0.28.0
with:
scan-type: image
scan-ref: newrelic/php-daemon:latest
trivy-config: ./trivy.yaml
format: sarif
output: trivy-results.sarif
- name: Upload Trivy scan results to GitHub Security tab
# Only upload sarif when running nightly
if: ${{ github.event_name == 'schedule' }}
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-results.sarif