-
Notifications
You must be signed in to change notification settings - Fork 7
92 lines (83 loc) · 2.64 KB
/
trivy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
name: Trivy Scan
on:
workflow_dispatch:
workflow_call:
push:
branches:
- main
- prod
tags:
- v1.*
permissions:
contents: read
jobs:
trivy:
permissions:
contents: read
security-events: write
actions: read
env:
DOCKER_NAME: fac
WORKING_DIRECTORY: ./backend
name: Trivy Scan FAC Web Container
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Date
shell: bash
id: date
run: |
echo "date=$(date +%Y%m%d%H%M%S)" >> $GITHUB_OUTPUT
- name: Build Container
working-directory: ${{ env.WORKING_DIRECTORY }}
run: docker build -t ${{ env.DOCKER_NAME }}:${{ steps.date.outputs.date }} .
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: '${{ env.DOCKER_NAME }}:${{ steps.date.outputs.date }}'
scan-type: 'image'
hide-progress: false
format: 'sarif'
output: 'trivy-results.sarif'
exit-code: 0 # Setting the exit-code to 1 will fail the action, without publishing to Github Security Tab (> aquasecurity/[email protected])
severity: 'CRITICAL,HIGH'
timeout: 15m0s
ignore-unfixed: true
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
scan-third-party:
permissions:
contents: read
security-events: write
actions: read
name: Trivy Scan Third Party Images
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
- name: ghcr.io/gsa-tts/fac/postgrest:latest
- name: ghcr.io/gsa-tts/fac/clamav:latest
steps:
- name: Pull Third Party Docker Images
run: docker pull ${{ matrix.image.name }}
- name: Run Trivy vulnerability scanner on Third Party Images
uses: aquasecurity/[email protected]
with:
image-ref: '${{ matrix.image.name }}'
scan-type: 'image'
hide-progress: false
format: 'sarif'
output: 'trivy-results.sarif'
exit-code: 0 # Setting the exit-code to 1 will fail the action, without publishing to Github Security Tab (> aquasecurity/[email protected])
severity: 'CRITICAL,HIGH'
timeout: 15m0s
ignore-unfixed: true
- name: Upload Trivy scan results to GitHub Security tab for Third Party Images
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'