-
Notifications
You must be signed in to change notification settings - Fork 1
124 lines (107 loc) · 3.57 KB
/
Copy pathsecurity.yml
File metadata and controls
124 lines (107 loc) · 3.57 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Security Scanning
on:
push:
branches: [main]
pull_request:
schedule:
- cron: '0 6 * * 1' # Weekly Monday 6am UTC - catch newly disclosed CVEs
permissions:
contents: read
security-events: write
jobs:
dependency-audit:
name: Python dependency audit
runs-on: ubuntu-latest
defaults:
run:
working-directory: operations-manager/python
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
- uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Install dependencies
run: uv sync --all-groups
- name: Run pip-audit
run: uv run pip-audit --strict --desc --skip-editable -s osv
container-scan:
name: Container scan - ${{ matrix.image.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
- name: operations-manager
dockerfile: operations-manager/Dockerfile
context: .
target: application
- name: rig-backup
dockerfile: operations-manager/backup-image/Dockerfile
context: operations-manager/backup-image
target: ""
- name: cmp-kustomize-sops
dockerfile: images/cmp-kustomize-sops/Dockerfile
context: .
target: ""
- name: postgresql-with-dictionaries
dockerfile: images/postgresql-with-dictionaries/Dockerfile
context: images/postgresql-with-dictionaries
target: ""
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image for scanning
uses: docker/build-push-action@v6
with:
context: ${{ matrix.image.context }}
file: ${{ matrix.image.dockerfile }}
target: ${{ matrix.image.target || '' }}
load: true
tags: ${{ matrix.image.name }}:scan
cache-from: type=gha,scope=${{ matrix.image.name }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1
with:
image-ref: '${{ matrix.image.name }}:scan'
format: 'sarif'
output: 'trivy-${{ matrix.image.name }}.sarif'
severity: 'HIGH,CRITICAL'
- name: Upload Trivy results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: 'trivy-${{ matrix.image.name }}.sarif'
category: 'trivy-${{ matrix.image.name }}'
sbom:
name: Generate SBOM
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image for SBOM
uses: docker/build-push-action@v6
with:
context: .
file: operations-manager/Dockerfile
target: application
load: true
tags: operations-manager:sbom
cache-from: type=gha,scope=operations-manager
- name: Generate SBOM with Trivy
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1
with:
image-ref: 'operations-manager:sbom'
format: 'cyclonedx'
output: 'sbom-operations-manager.json'
- name: Upload SBOM as artifact
uses: actions/upload-artifact@v4
with:
name: sbom-operations-manager
path: sbom-operations-manager.json
retention-days: 90