chore: initial commit - prototype code #2
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: Trivy Container Scan | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: [ main ] | |
permissions: | |
contents: read | |
security-events: write | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag app:${{ github.sha }} | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@69cbbc0cbbf6a2b0bab8dcf0e9f2d7ead08e87e4 # master | |
with: | |
image-ref: 'app:${{ github.sha }}' | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
exit-code: '1' | |
ignore-unfixed: true | |
vuln-type: 'os,library' | |
severity: 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL' | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@305f6546310b9203e892c28c1484e82977f4f63d # v2.22.10 | |
if: always() | |
with: | |
sarif_file: 'trivy-results.sarif' |