aquasecurity / trivy

Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more
https://aquasecurity.github.io/trivy
Apache License 2.0
23.1k stars 2.28k forks source link

HTML template missing target names for go, npm, python/pip, java pom.xml, config files #1556

Closed jpinkham closed 3 months ago

jpinkham commented 2 years ago

For many different types of files being scanned, the target names are not being reported in the HTML template, only the type of file. This makes it impossible to know which file contains the vulnerabilities and/or misconfigurations that were found.

I happened to have a local clone of https://github.com/docker/awesome-compose available, which is good for scanning because it contains files of multiple types (except golang). I've attached the json output of the scan and the HTML output for comparison (for some reason GH doesn't support HTML or JSON file attachments....so I gzip'd them). I attached trivy results of Trivy as well, since it contains golang examples plus lots of config files.

And here's some screenshots of the lack of Target name:

Trivy_HTML_report_AwesomeCompose Trivy_HTML_report_trivy_itself

awesome-compose.html.gz awesome-compose.json.gz trivy_results_of_trivy_itself.json.gz trivy_results_of_trivy_itself.html.gz

NOTE: These reports were generated with Trivy v0.22.0

jpinkham commented 2 years ago

I've taken a first pass at tweaking the template to increase readability. This round was more about determining what data I can add to the page, vs fussing too much with styling. Feedback is welcome

Trivy_HTML_report_trivy_itself__first_pass_html_reportchanges Trivy_HTML_report_trivy_itself__first_pass_html_reportchanges-2
frjonsen commented 2 years ago

Was also facing this issue, where we scan a large number of .NET projects at the same time, and each project would only get the header "nuget". Would be great to see the modifications by @jpinkham implemented.

afdesk commented 2 years ago

@frjonsen you can use any custom templates for trivy results:

$ trivy image --format template --template @path/to/custom/html.tpl --output result.html alpine:latest

it seems that @jpinkham's changes are here: https://github.com/aquasecurity/trivy/commit/7b4fb9daadffa758337a9042ff37b057b602a772

jpinkham commented 2 years ago

@afdesk and @frjonsen : thank you for providing the impetus to stop futzing with the template and finally submit a PR with my changes. Hopefully https://github.com/aquasecurity/trivy/pull/1741 will be reviewed soon.

github-actions[bot] commented 2 years ago

This issue is stale because it has been labeled with inactivity.

jpvg10 commented 2 years ago

I think this shouldn't be closed, I'd like to see this fixed at some point... And the PR hasn't been merged yet

huornlmj commented 1 year ago

Same issue here - please merge the PR

huornlmj commented 1 year ago

This also applies when using Trivy's misconfiguration scanning AND filesystem scanning features.

github-actions[bot] commented 1 year ago

This issue is stale because it has been labeled with inactivity.

huornlmj commented 1 year ago

Ping to keep this active. This is the official bundled HTML template and it's never worked properly. I think this should be fixed.

itaysk commented 1 year ago

Hi @huornlmj, we have a plan to extract the non-essential output options out of trivy so that the community can develop it, therefore we are reluctant to invest in these areas right now. related: https://github.com/aquasecurity/trivy/discussions/4451

github-actions[bot] commented 1 year ago

This issue is stale because it has been labeled with inactivity.

huornlmj commented 1 year ago

Still an issue

huornlmj commented 3 months ago

Still an issue - quietly longing for this fix as I believe it would be one of those "missing puzzle piece" feature fixes.!

itaysk commented 3 months ago

@huornlmj I'm sorry but we have no intention to maintain the HTML template in-tree, most like we will remove it. I would advise people interested in an HTML output to either copy the html from Trivy and tweak it, or make the request with one of the existing plugins such as https://github.com/fatihtokus/scan2html