2022-03-15 12:48:59 +00:00
|
|
|
name: Scan images using trivy
|
2022-03-15 12:40:42 +00:00
|
|
|
on:
|
2022-03-25 13:59:59 +00:00
|
|
|
push:
|
2022-03-15 12:40:42 +00:00
|
|
|
workflow_dispatch:
|
|
|
|
schedule:
|
|
|
|
- cron: "0 13 * * *"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
scan:
|
2022-03-15 12:48:59 +00:00
|
|
|
permissions:
|
2022-03-29 13:50:40 +00:00
|
|
|
contents: write
|
2022-03-15 12:48:59 +00:00
|
|
|
security-events: write # allow github/codeql-action/upload-sarif
|
2022-03-15 12:44:54 +00:00
|
|
|
name: Scan for Security Vulnerabilities
|
2022-03-15 12:40:42 +00:00
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
2022-03-29 13:40:09 +00:00
|
|
|
|
|
|
|
- name: Create public folder
|
|
|
|
run: |
|
|
|
|
mkdir -p public/
|
2022-03-15 12:40:42 +00:00
|
|
|
|
|
|
|
- name: Run Trivy vulnerability scanner
|
|
|
|
uses: aquasecurity/trivy-action@master
|
|
|
|
with:
|
2022-03-29 13:31:34 +00:00
|
|
|
image-ref: 'docker.io/rockylinux/rockylinux:8'
|
2022-03-15 12:44:54 +00:00
|
|
|
format: 'sarif'
|
2022-03-29 13:40:09 +00:00
|
|
|
output: 'public/trivy-results.sarif'
|
2022-03-15 12:40:42 +00:00
|
|
|
exit-code: '1'
|
|
|
|
ignore-unfixed: true
|
|
|
|
vuln-type: 'os,library'
|
2022-03-15 12:51:15 +00:00
|
|
|
severity: 'CRITICAL,HIGH,MEDIUM'
|
2022-03-15 12:44:54 +00:00
|
|
|
|
|
|
|
- name: Upload Trivy scan results to GitHub Security tab
|
|
|
|
uses: github/codeql-action/upload-sarif@v1
|
|
|
|
if: always()
|
|
|
|
with:
|
2022-03-29 13:40:09 +00:00
|
|
|
sarif_file: 'public/trivy-results.sarif'
|
|
|
|
|
2022-03-25 13:59:59 +00:00
|
|
|
|
|
|
|
- name: Run Trivy vulnerability scanner
|
|
|
|
uses: aquasecurity/trivy-action@master
|
2022-04-09 14:41:43 +00:00
|
|
|
if: always()
|
|
|
|
continue-on-error: true
|
2022-03-25 13:59:59 +00:00
|
|
|
with:
|
2022-03-29 13:31:34 +00:00
|
|
|
image-ref: 'docker.io/rockylinux/rockylinux:8'
|
2022-03-29 13:37:04 +00:00
|
|
|
format: 'template'
|
2022-03-29 13:40:09 +00:00
|
|
|
template: '@/contrib/html.tpl'
|
2022-03-29 13:31:34 +00:00
|
|
|
output: 'public/index.html'
|
2022-03-25 13:59:59 +00:00
|
|
|
exit-code: '1'
|
|
|
|
ignore-unfixed: true
|
|
|
|
vuln-type: 'os,library'
|
|
|
|
severity: 'CRITICAL,HIGH,MEDIUM'
|
|
|
|
|
2022-03-29 13:31:34 +00:00
|
|
|
- name: Save scan results to github pages
|
|
|
|
uses: peaceiris/actions-gh-pages@v3
|
2022-04-09 14:43:48 +00:00
|
|
|
#if: ${{ github.ref == 'refs/heads/main' }}
|
2022-04-09 14:45:24 +00:00
|
|
|
if: always()
|
2022-03-25 13:59:59 +00:00
|
|
|
with:
|
2022-03-29 13:31:34 +00:00
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish_dir: ./public
|