Search code examples
trivy

Generate a html report from Trivy


I'm trying to generate a HTML report from Trivy. On the example page, they provide trivy image --format template --template "@contrib/html.tpl" -o report.html golang:1.12-alpine. When I run this, I get the following error,

FATAL report error: unable to write results: failed to initialize template writer: error retrieving template from path: open contrib/html.tpl: no such file or directory

Based on the documentation, It looks like this is a default template so I'm assuming it's included. My logic here is that there is no "/" following the "@" in the template path.

I'm currently on version 0.41.0


Solution

  • I did not install trivy from RPM and had no files other than a solid trivy binary of a few 10 MBs. Downloaded the html.tpl template from their github repo https://github.com/aquasecurity/trivy/blob/main/contrib/html.tpl and placed it in /usr/bin/html.tpl and used the command line: trivy image --format template --template "@/usr/bin/html.tpl" -o report.html image-name