Scan and import a second image
Build the old Nginx web image from the scanning lab, then scan it into a new report file:
docker build -t courselabs/web:nginx-1.14 ./labs/scanning/web
docker run --rm -v "${PWD}:/repo" aquasec/trivy:0.76.0 image --format json --output /repo/labs/defectdojo/reports/trivy-web.json courselabs/web:nginx-1.14
Import it into the same product (python-app) under a new engagement, so one product now aggregates findings from two images:
curl -s -X POST http://localhost:8080/api/v2/import-scan/ -H "Authorization: Token YOUR_TOKEN" -F "scan_type=Trivy Scan" -F "product_name=python-app" -F "engagement_name=Web image scan" -F "auto_create_context=true" -F "file=@labs/defectdojo/reports/trivy-web.json"
Triage a finding
Pick a finding to triage. Ask for one active critical finding and read its id from the JSON:
curl -s -H "Authorization: Token YOUR_TOKEN" "http://localhost:8080/api/v2/findings/?active=true&severity=Critical&limit=1"
Take that finding to false-positive. Setting active=false with false_p=true is what removes it from the active count (replace 123 with the real id):
curl -s -X PATCH http://localhost:8080/api/v2/findings/123/ -H "Authorization: Token YOUR_TOKEN" -H "Content-Type: application/json" -d "{\"active\": false, \"false_p\": true}"
Verify it stuck
Query the active count again - it is one lower than before the triage:
curl -s -H "Authorization: Token YOUR_TOKEN" "http://localhost:8080/api/v2/findings/?active=true&limit=1"
Now re-import the web scan. The triaged finding does not come back as active, because DefectDojo remembers your decision:
curl -s -X POST http://localhost:8080/api/v2/reimport-scan/ -H "Authorization: Token YOUR_TOKEN" -F "scan_type=Trivy Scan" -F "product_name=python-app" -F "engagement_name=Web image scan" -F "auto_create_context=true" -F "file=@labs/defectdojo/reports/trivy-web.json"
This is the whole value of the aggregation layer. The scanner has no memory - every run reports the same CVE. DefectDojo remembers that a human looked at this one and said "not a problem", so it never nags you about it again. That is the difference between scanning and vulnerability management.