generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (54 loc) · 1.72 KB
/
trivy-image-scan.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
name: Scan image for vulnerabilities
on:
workflow_call:
inputs:
ECR_REPOSITORY:
required: true
type: string
ECR_REGION:
required: true
type: string
secrets:
ECR_REGISTRY:
required: true
ECR_ROLE_TO_ASSUME:
required: true
jobs:
trivy-image-scan:
name: Trivy Image Scan
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
steps:
- name: Assume role in Cloud Platform
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.ECR_ROLE_TO_ASSUME }}
aws-region: ${{ inputs.ECR_REGION }}
- name: Login to container repository
uses: aws-actions/amazon-ecr-login@v2
id: login-ecr
with:
mask-password: true
- name: Scan for breaking vulnerabilities
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ secrets.ECR_REGISTRY }}/${{ inputs.ECR_REPOSITORY }}:${{ github.sha }}
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
- name: Scan for vulnerabilities (informative, non-breaking)
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ secrets.ECR_REGISTRY }}/${{ inputs.ECR_REPOSITORY }}:${{ github.sha }}
format: 'table'
exit-code: '0'
ignore-unfixed: false
vuln-type: 'os,library'
severity: 'UNKNOWN,LOW,MEDIUM,CRITICAL,HIGH'
env:
TRIVY_SKIP_DB_UPDATE: true
TRIVY_SKIP_JAVA_DB_UPDATE: true