Repository navigation
Closed
Labels
Description
Parent Epic: #250 - Implement Automated Docker Image Vulnerability Scanning
Overview
Implement a GitHub Actions workflow that uses Trivy to scan Docker images for vulnerabilities. This initial implementation uses a hardcoded list of images and provides immediate security coverage while Phase 2 makes it dynamic.
Goals
- Create GitHub Actions workflow for Trivy scanning
- Scan all project Docker images for HIGH/CRITICAL vulnerabilities
- Run scans on push, PR, and periodically
- Fail builds when vulnerabilities detected
- Generate actionable vulnerability reports
Docker Images to Scan
Project-built (build first, then scan):
torrust-tracker-deployer/provisioned-instance:latesttorrust-tracker-deployer/ssh-server:latest
Third-party (direct scan):
3. torrust/tracker:develop
4. mysql:8.0
5. grafana/grafana:11.4.0
6. prom/prometheus:v3.0.1
Implementation Phases
Phase 1: Workflow File Creation
- Create
.github/workflows/docker-security-scan.yml - Configure workflow triggers (push to main, pull_request, schedule)
- Set up job structure for parallel scanning
Phase 2: Project Image Scanning
- Build provisioned-instance and ssh-server images
- Run Trivy scanner on built images
- Configure severity filter (HIGH, CRITICAL)
Phase 3: Third-Party Image Scanning
- Scan torrust/tracker:develop
- Scan mysql:8.0
- Scan grafana/grafana:11.4.0
- Scan prom/prometheus:v3.0.1
Phase 4: Results Upload
- Generate SARIF format reports
- Upload to GitHub Security tab
- Configure exit-code: 1 for failures
Phase 5: Testing & Documentation
- Test workflow on PR
- Add workflow badge to README
- Document in security guidelines
Acceptance Criteria
Quality Checks:
- Workflow YAML passes yamllint
- No syntax errors in workflow file
Functional Requirements:
- All 6 images scanned successfully
- Vulnerabilities displayed in GitHub Security tab
- Build fails when HIGH/CRITICAL vulnerabilities found
- Workflow runs on: push to main, PRs, weekly schedule
- Badge shows workflow status in README
Testing:
- Manual test: create PR to trigger workflow
- Verify SARIF uploads to Security tab
- Verify build fails with vulnerable image
Documentation:
- README.md updated with workflow badge
- Security documentation references workflow
Estimated effort: 2-4 hours
Full specification: docs/issues/implement-basic-trivy-scanning-workflow.md
Activity
docs: add Docker image vulnerability scanning EPIC and subissues
feat: [#251] implement basic trivy scanning workflow
fix: [#251] update docker build context and action versions
feat: [#251] add human-readable vulnerability output to workflow logs
fix: [#251] disable secret scanning for test containers with SSH keys
fix: [#251] focus CVE scanning only, display all issues for visibility
chore: [#251] update trivy-action from v0.28.0 to v0.33.1
refactor: [#251] separate SARIF upload to dedicated job with minimal …
fix: [#251] sanitize Docker image names for artifact naming
fix: [#251] prevent workflow failure and artifact name conflicts
fix: [#251] upload SARIF files with unique categories per image
fix: [#251] upload SARIF files with unique categories per image
refactor: [#251] apply security-first workflow philosophy with exit-c…
docs: [#251] add ADR for docker security scan exit code zero philosophy
fix: [#251] use CodeQL action for SARIF upload with category support
docs: [#251] document Security tab viewing behavior
chore: remove closed issue documentation files