sig-cloud-instance-images/.github/workflows/scan.yml

62 lines
1.7 KiB
YAML
Raw Normal View History

name: Scan images using trivy
2022-03-15 12:40:42 +00:00
on:
push:
2022-03-15 12:40:42 +00:00
workflow_dispatch:
schedule:
- cron: "0 13 * * *"
jobs:
scan:
permissions:
2022-03-29 13:50:40 +00:00
contents: write
security-events: write # allow github/codeql-action/upload-sarif
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:
image-ref: 'docker.io/rockylinux/rockylinux:8'
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'
- 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'
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
2022-04-09 14:41:43 +00:00
if: always()
continue-on-error: true
with:
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'
output: 'public/index.html'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH,MEDIUM'
- 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()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public