Sub topic 12
Triage: deciding what to fix and what to accept
This chapter assumes you can run trivy image and docker scout cves, and that you know what a CVE ID, a severity rating and a fixed version are. Here you decide which findings need action and how to record the ones you accept.
Why triage is needed
A scan of a common base image often returns dozens of findings. Fixing all of them at once is rarely possible. Triage is the process of sorting findings into "act now", "act later" and "accept with a reason". The goal is a defensible decision for each finding, not a report with zero lines.
Questions to ask for each finding
Work through these questions in order.
- Is a fix available? If the scanner lists a fixed version, the fix is usually a rebuild or a version bump. If not, you can only wait, mitigate or accept.
- Is the vulnerable package reachable? A flaw in a library that your application never loads is less urgent than one in your web server. Reachability is a judgment you make. Scanners match package versions and do not check how your code uses them.
- Is it exposed? A flaw in a network service on a public port matters more than a flaw in a tool that only runs during a build.
- How severe is it? Use the severity rating as a starting point, not as the final answer.
Narrowing the list first
Filtering removes noise before you make decisions. These commands show only the findings that you can act on.
trivy image --severity HIGH,CRITICAL --ignore-unfixed python:3.12-slim
docker scout cves --only-severity critical,high nginx:latestRemember that --ignore-unfixed hides findings. They have not gone away. Check for fixes again on a regular schedule.
Recording accepted findings
When you accept a finding, write it down so the decision survives staff changes. Trivy reads a .trivyignore file in the directory where you run it. It holds one vulnerability ID per line, and lines starting with # are comments.
# .trivyignore
# Accepted until the upstream fix ships; reviewed each sprint.
CVE-2024-00000The ID above is a placeholder. Replace it with a real CVE ID from your report.
Each entry should have a comment that answers three questions: why it is accepted, who decided, and when it will be reviewed. Keep the file in version control so changes go through code review.
Common mistakes
| Mistake | Result | Better practice |
|---|---|---|
| Ignoring an ID with no comment | Nobody knows why it is hidden | Add a reason and a review date |
| Treating severity as the only input | Low-risk findings get fixed first | Weigh exposure and reachability too |
| Using `--ignore-unfixed` and forgetting it | Newly fixed flaws stay hidden | Re-scan without the flag from time to time |
| Never removing ignore entries | The file grows and goes stale | Review entries each sprint |
Exercise
A scan shows a HIGH finding in a library used only by a build tool. It is not present in the final image's running service, and no fixed version exists. What are two reasonable actions, and what must you record if you choose to accept it?
Show answer
You can accept the finding or move the build tool out of the final image, for example with a multi-stage build. If you accept it, add the CVE ID to .trivyignore with a comment that states the reason (not reachable, no fix available), who decided, and a review date.
Exercise
Why is --ignore-unfixed different from adding an ID to .trivyignore?
Show answer
--ignore-unfixed hides every finding that has no fixed version, and it stops hiding a finding once a fix is published. .trivyignore hides only the listed IDs, and it keeps hiding them until someone removes the entry, even after a fix exists.