Skip to content

Commit e5f1f92

Browse files
committed
docs: add Docker image vulnerability scanning EPIC and subissues
Add EPIC #250 and two subissues (#251, #252) for implementing automated Docker image vulnerability scanning using Trivy. - EPIC #250: Automated Docker image vulnerability scanning - Subissue #251: Basic Trivy scanning workflow (hardcoded images) - Subissue #252: Dynamic image detection from environment config Includes Trivy scan results showing 5/6 images clean, with torrust/tracker:develop having 5 vulnerabilities (1 CRITICAL, 4 HIGH) requiring attention. Updated project-words.txt with security-related terms: aquasecurity, sarif, SARIF.
1 parent 51bec32 commit e5f1f92

File tree

4 files changed

+1158
-0
lines changed

4 files changed

+1158
-0
lines changed
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
# Implement Automated Docker Image Vulnerability Scanning
2+
3+
**Issue**: #250 (Epic)
4+
**Parent Epic**: N/A (Independent security initiative)
5+
**Related**:
6+
7+
- Security best practices
8+
- CI/CD pipeline improvements
9+
- Subissue #251: Implement Basic Trivy Scanning Workflow
10+
- Subissue #252: Implement Dynamic Image Detection for Scanning
11+
12+
## Overview
13+
14+
This epic implements automated vulnerability scanning for all Docker images used in the project using Trivy. The implementation is divided into two phases:
15+
16+
1. **Basic Scanning**: Hardcoded image list with periodic and PR-triggered scans
17+
2. **Dynamic Scanning**: Automatically detect images from environment configuration
18+
19+
## Problem Statement
20+
21+
Currently, the project uses multiple Docker images without automated vulnerability scanning:
22+
23+
- `docker/provisioned-instance/Dockerfile`
24+
- `docker/ssh-server/Dockerfile`
25+
- `templates/docker-compose/docker-compose.yml.tera`
26+
27+
This creates security risks as vulnerabilities in these images go undetected until discovered manually or exploited.
28+
29+
## Container Images in Scope
30+
31+
### Project-Built Images
32+
33+
These images are built from Dockerfiles in this repository:
34+
35+
1. **Provisioned Instance**: `torrust-tracker-deployer/provisioned-instance`
36+
37+
- Source: `docker/provisioned-instance/Dockerfile`
38+
- Purpose: Test container for E2E deployment testing
39+
40+
2. **SSH Server**: `torrust-tracker-deployer/ssh-server`
41+
- Source: `docker/ssh-server/Dockerfile`
42+
- Purpose: Mock SSH server for integration testing
43+
44+
### Third-Party Images
45+
46+
These images are referenced in Docker Compose templates:
47+
48+
1. **Torrust Tracker**: `torrust/tracker:develop`
49+
50+
- Purpose: BitTorrent tracker application
51+
- Source template: `templates/docker-compose/docker-compose.yml.tera`
52+
53+
2. **MySQL Database**: `mysql:8.0`
54+
55+
- Purpose: Tracker database backend
56+
- Source template: `templates/docker-compose/docker-compose.yml.tera`
57+
58+
3. **Grafana**: `grafana/grafana:11.4.0`
59+
60+
- Purpose: Metrics visualization dashboard
61+
- Source template: `templates/docker-compose/docker-compose.yml.tera`
62+
63+
4. **Prometheus**: `prom/prometheus:v3.0.1`
64+
- Purpose: Metrics collection and monitoring
65+
- Source template: `templates/docker-compose/docker-compose.yml.tera`
66+
67+
**Total Images**: 6 (2 project-built + 4 third-party)
68+
69+
## Current Vulnerability Status
70+
71+
> **Scan Date**: 2025-12-22
72+
> **Scanner**: Trivy (latest)
73+
> **Severity Filter**: HIGH, CRITICAL
74+
75+
### Project-Built Images
76+
77+
#### 1. torrust-tracker-deployer/provisioned-instance:latest
78+
79+
```text
80+
Status: ✅ CLEAN
81+
Total: 0 (HIGH: 0, CRITICAL: 0)
82+
Base OS: Ubuntu 24.04
83+
Notes: No HIGH or CRITICAL vulnerabilities detected
84+
```
85+
86+
#### 2. torrust-tracker-deployer/ssh-server:latest
87+
88+
```text
89+
Status: ✅ CLEAN
90+
Total: 0 (HIGH: 0, CRITICAL: 0)
91+
Base OS: Alpine 3.22.2
92+
Notes: No HIGH or CRITICAL vulnerabilities detected
93+
```
94+
95+
### Third-Party Images
96+
97+
#### 3. torrust/tracker:develop
98+
99+
```text
100+
Status: ⚠️ VULNERABILITIES FOUND
101+
Total: 5 (HIGH: 4, CRITICAL: 1)
102+
Base OS: Debian 12.11
103+
104+
CRITICAL Vulnerabilities:
105+
- CVE-2019-1010022 (libc6): glibc stack guard protection bypass
106+
Installed: 2.36-9+deb12u10
107+
Fixed: Not available
108+
109+
HIGH Vulnerabilities:
110+
- CVE-2018-20796 (libc6): glibc uncontrolled recursion in check_dst_limits_calc_pos_1
111+
Installed: 2.36-9+deb12u10
112+
Fixed: Not available
113+
114+
- CVE-2019-1010023 (libc6): glibc running ldd on malicious ELF leads to code execution
115+
Installed: 2.36-9+deb12u10
116+
Fixed: Not available
117+
118+
- CVE-2019-9192 (libc6): glibc uncontrolled recursion in check_dst_limits_calc_pos_1
119+
Installed: 2.36-9+deb12u10
120+
Fixed: Not available
121+
122+
- CVE-2023-0286 (libssl3): X.400 address type confusion in X.509 GeneralName
123+
Installed: 3.0.16-1~deb12u1
124+
Fixed: Not available
125+
126+
⚠️ Action Required: These are known glibc/openssl CVEs without available patches.
127+
Consider evaluating risk vs. functionality trade-offs.
128+
```
129+
130+
#### 4. mysql:8.0
131+
132+
```text
133+
Status: ✅ CLEAN
134+
Total: 0 (HIGH: 0, CRITICAL: 0)
135+
Base OS: Oracle Linux 9.5
136+
Notes: No HIGH or CRITICAL vulnerabilities detected
137+
Warning: OS version no longer supported by distribution
138+
```
139+
140+
#### 5. grafana/grafana:11.4.0
141+
142+
```text
143+
Status: ✅ CLEAN
144+
Total: 0 (HIGH: 0, CRITICAL: 0)
145+
Base OS: Alpine 3.20.3
146+
Notes: No HIGH or CRITICAL vulnerabilities detected
147+
Warning: OS version no longer supported by distribution
148+
```
149+
150+
#### 6. prom/prometheus:v3.0.1
151+
152+
```text
153+
Status: ✅ CLEAN
154+
Total: 0 (HIGH: 0, CRITICAL: 0)
155+
Notes: No HIGH or CRITICAL vulnerabilities detected
156+
Warning: OS not detected (distroless or scratch-based image)
157+
```
158+
159+
### Summary
160+
161+
- **Clean Images**: 5/6 (83%)
162+
- **Images with Vulnerabilities**: 1/6 (17%)
163+
- **Total HIGH Vulnerabilities**: 4
164+
- **Total CRITICAL Vulnerabilities**: 1
165+
- **Images Requiring Attention**: torrust/tracker:develop
166+
167+
### Recommended Actions
168+
169+
1. **Immediate**: Document the known vulnerabilities in `torrust/tracker:develop` as accepted risks or plan mitigation
170+
2. **Short-term**: Implement Phase 1 (basic scanning workflow) to prevent introduction of new vulnerable images
171+
3. **Medium-term**: Monitor for patches to the identified CVEs in glibc and openssl
172+
4. **Long-term**: Implement Phase 2 (dynamic detection) for maintainable scanning
173+
174+
## Solution Approach
175+
176+
### Phase 1: Basic Scanning (Subissue 1)
177+
178+
Implement Trivy-based scanning workflow with:
179+
180+
- Hardcoded list of images to scan
181+
- Scan on PR and push events
182+
- Periodic scanning (e.g., daily/weekly)
183+
- Fail build on HIGH/CRITICAL vulnerabilities
184+
- Generate vulnerability reports
185+
186+
### Phase 2: Dynamic Scanning (Subissue 2)
187+
188+
Make scanning dynamic and maintainable:
189+
190+
- Extract Docker images from environment configuration
191+
- Store image references in environment data structure
192+
- Use `show` command to expose image information
193+
- Update workflow to dynamically detect images
194+
- Eliminate manual image list maintenance
195+
196+
## Tasks
197+
198+
- [ ] #X - Implement basic Trivy scanning workflow with hardcoded images
199+
- [ ] #X - Implement dynamic image detection using environment configuration
200+
201+
## Benefits
202+
203+
**Security**:
204+
205+
- Continuous vulnerability monitoring
206+
- Early detection of security issues
207+
- Automated security compliance
208+
209+
**Maintainability**:
210+
211+
- No manual image list updates (Phase 2)
212+
- Consistent scanning across all images
213+
- Integration with existing environment management
214+
215+
**Development Workflow**:
216+
217+
- Fail fast on vulnerable images
218+
- Clear security status in PRs
219+
- Periodic monitoring for new vulnerabilities
220+
221+
## Related Documentation
222+
223+
- GitHub Actions workflows: `.github/workflows/`
224+
- Docker files: `docker/`
225+
- Docker Compose template: `templates/docker-compose/docker-compose.yml.tera`
226+
- Environment show command: `docs/issues/241-implement-environment-show-command.md`
227+
- Trivy documentation: https://github.com/aquasecurity/trivy
228+
229+
## Timeline
230+
231+
- **Phase 1**: 2-4 hours - Immediate security improvement
232+
- **Phase 2**: 4-6 hours - Long-term maintainability (depends on #241)
233+
234+
## Success Criteria
235+
236+
- [ ] All Docker images scanned automatically
237+
- [ ] HIGH/CRITICAL vulnerabilities block builds
238+
- [ ] Periodic scans detect new vulnerabilities
239+
- [ ] Dynamic detection eliminates manual maintenance
240+
- [ ] Documentation updated for security workflow

0 commit comments

Comments
 (0)