Share a Trivy scan report
A container scan produces two things: a list of CVEs, and a set of decisions about them. CI stores the first and loses the second. The finding scrolls past in a build log, someone decides it's not reachable from the entrypoint, and that decision lives in a Slack thread that is unfindable by the time the same CVE shows up next month.
Trivy already writes a readable artifact — the bundled HTML template produces one self-contained file. Give it a URL and the decisions have somewhere to live.
Already ran trivy image --format json? Drop that file into the free
Trivy viewer instead — it groups the CVEs by package,
marks distro will_not_fix findings as having no fix, and builds the same
kind of shareable report without the template step.
Publish it
trivy image --format template \
--template "@contrib/html.tpl" \
-o trivy.html \
"$IMAGE" || true
curl -fsS -X PATCH \
"https://commareports.com/api/v1/reports/$COMMA_REPORT_ID" \
-H "Authorization: Bearer $COMMA_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html trivy.html \
--arg title "Trivy — $IMAGE — $(date +%F)" \
'{title: $title, html: $html}')"
|| true because --exit-code 1 on HIGH findings is the run you most
want published. PATCH on a saved report id keeps one URL per scan
target with a revision per scan, which is what turns a pile of results
into a trend.
Use a scoped token with reports:write only. Keep
reports private or team-visible — see the
sharing model. A vulnerability report is an inventory of
what isn't patched yet, so publish it with "visibility": "private" —
API publishes are otherwise link-viewable.