-
Notifications
You must be signed in to change notification settings - Fork 17
72 lines (63 loc) · 2.03 KB
/
Copy pathtrivy.yml
File metadata and controls
72 lines (63 loc) · 2.03 KB
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
name: Trivy
# Scans the Docker image we publish to Docker Hub for OS-level CVEs (alpine
# packages) and Go-binary CVEs. Different surface from govulncheck — that
# one looks at source + go.mod, this one looks at the actual published
# artifact.
#
# We scan both on PR (to catch a fresh CVE in a base image bump before
# merge) and on schedule (to catch a newly-disclosed CVE in an unchanged
# image).
on:
push:
branches: [master]
paths:
- 'Dockerfile'
- 'Makefile'
- '.github/workflows/trivy.yml'
pull_request:
branches: [master]
paths:
- 'Dockerfile'
- 'Makefile'
- '.github/workflows/trivy.yml'
schedule:
- cron: '0 13 * * 5'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
security-events: write
jobs:
image-scan:
name: Image scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: stable
check-latest: true
cache: true
- name: Build linux binary (matches the production Dockerfile copy step)
run: make build_linux
- name: Build local Docker image for scanning
run: docker build -t altair-trivy-scan:local -f ./Dockerfile .
- name: Scan image for HIGH and CRITICAL vulnerabilities
uses: aquasecurity/trivy-action@v0.36.0
with:
image-ref: altair-trivy-scan:local
format: sarif
output: trivy-results.sarif
severity: HIGH,CRITICAL
# Don't fail the build immediately on every CVE — populate the
# Security tab and let humans triage. Flip ignore-unfixed to
# false and exit-code to 1 once you want hard-fail semantics.
ignore-unfixed: true
exit-code: '0'
- name: Upload Trivy results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: trivy-results.sarif
category: trivy-image