-
Notifications
You must be signed in to change notification settings - Fork 454
94 lines (84 loc) · 2.7 KB
/
security.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
93
94
---
name: security
# Run for all pushes to master and pull requests when Go or YAML files change
on:
push:
branches:
- master
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '23 20 * * 2'
jobs:
security-repo-scan:
name: security-repo-scan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
security-checks: 'vuln,secret'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'HIGH,CRITICAL'
skip-dirs: 'tests'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'
image-scan:
strategy:
matrix:
config:
- image: krakend/builder
dockerfile: Dockerfile-builder
- image: krakend/krakend-ce
dockerfile: Dockerfile
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set the environment variables
run: |
echo "GOLANG_VERSION=$(grep -m 1 GOLANG_VERSION Makefile | sed 's/^.*= //g')" >> $GITHUB_ENV
echo "ALPINE_VERSION=$(grep -m 1 ALPINE_VERSION Makefile | sed 's/^.*= //g')" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ matrix.config.image }}
tags: |
type=sha
- name: "Build image ${{ matrix.config.image }}"
uses: docker/build-push-action@v2
with:
context: .
file: ${{ matrix.config.dockerfile }}
build-args: |
GOLANG_VERSION=${{ env.GOLANG_VERSION }}
ALPINE_VERSION=${{ env.ALPINE_VERSION }}
push: false
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Run Trivy vulnerability scanner in image mode
uses: aquasecurity/trivy-action@master
with:
scan-type: 'image'
image-ref: ${{ steps.meta.outputs.tags }}
security-checks: 'vuln,secret'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'HIGH,CRITICAL'
skip-dirs: 'tests'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'