Skip to content

Add security scan

Add security scan #3

Workflow file for this run

name: Security scan
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 9 * * *' # Same time as CI Cron
jobs:
build:
name: Trivy Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag v4.1.7
- 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)
uses: aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2 # tag v.0.28.0
with:
scan-type: fs
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 main branch.
if: ${{ github.event_name == 'schedule' }}
uses: aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2 # tag v.0.28.0
with:
scan-type: fs
format: template
template: '@/contrib/sarif.tpl'
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 main branch.
if: ${{ github.event_name == 'schedule' }}
uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # tag v3.27.0
with:
sarif_file: trivy-results.sarif
notify_slack_fail:
name: Notify slack fail
needs: [build]
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'schedule' && failure() }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag v4.1.7
- uses: ./.github/actions/workflow-conclusion
- uses: voxmedia/github-action-slack-notify-build@3665186a8c1a022b28a1dbe0954e73aa9081ea9e # tag v1.6.0
if: ${{ env.WORKFLOW_CONCLUSION == 'failure' }}
env:
SLACK_BOT_TOKEN: ${{ secrets.RUBY_GITHUB_ACTIONS_BOT_WEBHOOK }}
with:
channel: ruby-agent-notifications
status: FAILED
color: danger