Sub topic 12
Triage: deciding what to fix and what to accept
A scan of a real image usually returns dozens or hundreds of findings. Treating every one as an emergency is not realistic. Triage is the step between "the scanner reported it" and "we changed something". For each finding you decide to fix it, accept it with a recorded reason, or investigate further.
This chapter assumes you can run trivy image and docker scout cves, filter by severity and fix status, and read a CVE entry (ID, severity, fixed version). If any of that is unfamiliar, review the earlier chapters on those commands first.
Why a severity label is not a decision
A scanner's severity rating (low, medium, high, critical) comes from advisory data, usually based on a CVSS score. CVSS rates the flaw in the abstract. It does not know how your container uses the package. Two findings with the same label can carry very different risk.
Triage adds the context the scanner lacks. For each finding, ask these questions in order:
- Is a fix available? A finding with a fixed version can be remediated. A finding without one cannot, so your options are to mitigate it or accept it.
- Is the vulnerable code present at runtime? A compiler, a package manager, or a test library may sit in the image without ever running in production.
- Can an attacker reach it? A flaw in an HTTP parser matters if the container accepts HTTP from untrusted clients. A flaw in a command-line tool matters only if someone can run that tool.
- What is the impact if it is exploited? Remote code execution is worse than a denial of service in a batch job.
- Is there a known exploit? Advisory data may mark a CVE as actively exploited. Treat those as urgent whatever their score.
A practical order of work
Work from the list that is cheapest to act on.
Start with fixable findings. They are the ones where you can change something. With Trivy, --ignore-unfixed hides everything that has no fix yet. With Docker Scout, --only-fixed does the same:
trivy image --severity HIGH,CRITICAL --ignore-unfixed python:3.12-slim
docker scout cves --only-severity critical,high --only-fixed python:3.12-slimMany of these disappear after one base image update, because the base image maintainers already ship the patched packages. Check this before you triage individual CVEs. The remediation chapter covers how to update the base image.
Next, look at where the findings come from. Docker Scout can leave out the findings that belong to the base image with --ignore-base. This shows which vulnerabilities come from packages you added yourself:
docker scout cves --ignore-base --only-severity critical,high myapp:2.0Findings in your own layers are yours to fix. Findings in the base image are fixed by choosing a newer or smaller base.
Only after that do you handle the remainder: findings with no fix, or findings that you have decided are not exploitable.
Reasons that justify accepting a finding
Acceptance is a decision, so it needs a reason you can defend later. These are common legitimate reasons:
- No fix exists yet. The upstream project or distribution has not released a patch. Accept for a short, fixed period and review again.
- Not reachable. The vulnerable package is installed but your application never loads or calls it. A library used only by an unused optional feature is an example.
- Not applicable to your configuration. Some CVEs affect only specific settings, platforms or build options. The advisory text usually says so.
- Wrong target. A flaw that needs local shell access has little effect on a container that has no shell and runs as a non-root user.
- Cost outweighs risk. A fix requires a major version upgrade that cannot happen this quarter, and other controls reduce exposure.
These are not valid reasons: "the scan was noisy", "it is only medium" without checking, or "we will look at it later" with no date.
Suppressing findings with a Trivy ignore file
Trivy reads a file named .trivyignore from the current directory by default. Each line holds one vulnerability ID. Lines starting with # are comments. You can append an expiry with exp: so the suppression stops working on a given date:
# .trivyignore
# CVE-2024-00000: libexample parser flaw. No fix released upstream.
# Our service never calls the affected function. Reviewed by: platform team.
# Re-check each sprint.
CVE-2024-00000 exp:2027-03-31The ID above is a placeholder. Replace it with the real identifier from your report. The exp: date is the part people skip, and it is the most useful part. When the date passes, the finding reappears in the scan, so an accepted risk cannot be forgotten.
Run the scan as normal and Trivy applies the file. You can also point to a file in another location:
trivy image --severity HIGH,CRITICAL --ignore-unfixed python:3.12-slim
trivy image --ignorefile ./security/.trivyignore --severity HIGH,CRITICAL myapp:2.0Newer Trivy versions also accept a YAML ignore file (.trivyignore.yaml) that can scope an ignore to a specific package or path and carry a statement field. Use it when the same CVE is harmless in one place and dangerous in another. Check the documentation for the version you run, because the format has changed between releases.
Suppression pitfalls
- An ID suppresses everywhere. In the plain text format, one line hides that CVE in every package and every image scanned with that file. If the same CVE appears in two packages and only one is harmless, you hide both.
- Comments are your only audit trail. Trivy does not store who accepted a finding or why. Keep the file in version control, and require review of changes to it like any other code change.
- Never ignore by severity as a shortcut. Hiding all medium findings is a policy choice. Make it with
--severityin the open, not through a long ignore list. - Do not copy ignore files between projects. An exception justified for one service may not hold for another.
Recording exceptions with Docker Scout
Docker Scout handles accepted findings through VEX (Vulnerability Exploitability eXchange) documents. A VEX statement says that a CVE does or does not affect a particular product, with a status such as not_affected and a justification. Scout can read VEX statements attached to an image, and it can use local files with the --vex-location option:
docker scout cves --vex-location ./vex myapp:2.0Statements marked not_affected are then excluded from the results. The benefit over a flat ignore file is that VEX is a standard, machine-readable format that travels with the image and can be shared with the people who consume it. The cost is writing and maintaining the documents. Check the Docker Scout documentation for the supported options in your version, since this feature has evolved.
If your team uses only one of the tools, use that tool's native mechanism. If you run both, keep the two exception lists consistent, or the same finding will pass in one scan and fail in the other.
A triage worksheet
Keep a short record for each accepted finding. A table in your repository is enough:
| Field | Example |
|---|---|
| CVE ID | CVE-2024-00000 |
| Package and version | libexample 1.4.2 |
| Reported severity | High |
| Fix available | No |
| Decision | Accept |
| Reason | Function never called by the service |
| Owner | Platform team |
| Review by | 2027-03-31 |
The Review by value should match the exp: date in the ignore file. When the two disagree, the file is the one that enforces the deadline.
Putting it together
A repeatable triage routine looks like this:
- Scan with severity and fix filters to get the actionable list.
- Update the base image and rebuild. Rescan.
- Fix remaining findings in your own layers by upgrading the package or removing it.
- For each leftover finding, decide: mitigate, or accept with a reason.
- Record accepted findings in the ignore file with an expiry date and commit it.
- Rescan and confirm only the accepted findings are suppressed.
The next steps, remediation and CI gating, build on this routine. A gate that fails the build is only useful if the list of suppressed findings is small, current and reviewed.
Exercise
A scan of your image reports CVE-2024-00000 as high severity in a library, and no fixed version exists. Your service never calls the affected function. Describe what you would put in the ignore file and what you would keep outside it, and explain why an expiry date matters.
Show answer
Add a line for the CVE ID to .trivyignore with an exp: date, for example CVE-2024-00000 exp:2027-03-31, preceded by comment lines stating the reason (function never called, no upstream fix), the owner and the review cadence. Keep the full record (package, version, decision, owner, review date) in a tracked triage table in the repository, and send changes to the ignore file through code review. The expiry matters because it makes the finding reappear in scans after the date. This forces a re-check: a fix may now exist, or the code may have started calling the function, and an open-ended suppression would hide both.