-
Notifications
You must be signed in to change notification settings - Fork 0
Implement Basic Trivy Scanning Workflow #256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
…permissions - Scan jobs now upload SARIF files as artifacts - New dedicated upload-sarif-results job with only security-events:write permission - Display steps show all security issues (CVEs + secrets) for visibility - Scan steps only fail on HIGH/CRITICAL CVE vulnerabilities
Viewing Security Scan ResultsThe workflow successfully uploads SARIF results to GitHub Security, but the default Security tab view filters by How to View Results
All six SARIF uploads are completing successfully:
This is standard GitHub behavior for code scanning - PR results are filtered separately from main branch results. |
Viewing Security Scan ResultsThe workflow successfully uploads SARIF results to GitHub Security, but the default Security tab view filters by 'is:open branch:main', which means results from PR branches are not visible in the default view. How to View Results
All six SARIF uploads are completing successfully with unique categories. This is standard GitHub behavior for code scanning - PR results are filtered separately from main branch results. |
- Add comment in workflow explaining filter behavior - Add section in ADR explaining how to view results by branch/PR - Add PR comment with direct links to view scan results The default Security tab filters by 'is:open branch:main' which hides PR branch results. Users must use specific PR/branch filters to see results before merging to main.
|
ACK 40dd234 |
Design Decision: Upload Steps PatternThe upload job currently uses 6 individual steps instead of a matrix. This is intentional for Phase 1 (hardcoded images). Why Not Matrix Now?Matrix would require duplicating the image list:
Future: Dynamic Array Passing (Issue #252)Phase 2 will implement dynamic image detection, where:
Example for Phase 2: scan-images:
outputs:
scanned_images: ${{ steps.collect.outputs.images }}
upload-sarif:
needs: scan-images
strategy:
matrix:
image: ${{ fromJSON(needs.scan-images.outputs.scanned_images) }}Decision RationaleKeep current implementation because:
References:
|
Closes #251
Overview
Implements 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.
Changes
1. GitHub Actions Workflow (
.github/workflows/docker-security-scan.yml)Created a new workflow with two jobs:
Scan Project-Built Images
torrust-tracker-deployer/provisioned-instancetorrust-tracker-deployer/ssh-serverScan Third-Party Images
torrust/tracker:developmysql:8.0grafana/grafana:11.4.0prom/prometheus:v3.0.1Workflow Features:
exit-code: 1)Notes:
templates/docker-compose/docker-compose.yml.tera2. README Update
Added workflow badge to display scan status.
Testing
./scripts/pre-commit.sh)Future Work
This is Phase 1 of the security scanning epic. Phase 2 (#252) will:
showcommand to list scanned imagesRelated