grype/templates
deftdawg eaa948e522
Add a space following the "Name:" label (#2155)
Should be a space between "Name:" and "container:tag" currently that doesn't render, so adding a space here fixes that.  Tested on Firefox

Signed-off-by: deftdawg <deftdawg@gmail.com>
2024-10-02 16:37:37 -04:00
..
csv.tmpl Add a simple CSV format template to the templates/ directory and tweak docs (#1366) 2023-06-29 17:05:17 -04:00
html.tmpl Add a space following the "Name:" label (#2155) 2024-10-02 16:37:37 -04:00
junit.tmpl docs(templates): escape description in junit.tmpl (#2088) 2024-08-29 08:20:37 -04:00
README.md feat: add html template (#1806) 2024-04-16 11:41:50 -04:00
table.tmpl feat: add community template folder and new table template (#1343) 2023-06-09 11:33:20 -04:00

Grype Templates

This folder contains a set of "helper" go templates you can use for your own reports.

Please feel free to extend and/or update the templates for your needs, be sure to contribute back into this folder any new templates!

Current templates:

.
├── README.md
├── html.tmpl
├── junit.tmpl
├── csv.tmpl
└── table.tmpl

Table

This template mimics the "default" table output of Grype, there are some drawbacks using the template vs the native output such as:

  • unsorted
  • duplicate rows
  • no (wont-fix) logic

As you can see from the above list, it's not perfect but it's a start.

HTML

Produces a nice html template with a dynamic table using datatables.js.

You can also modify the templating filter to limit the output to a subset.

Default includes all

    {{- if or (eq $vuln.Vulnerability.Severity "Critical") (eq $vuln.Vulnerability.Severity "High") (eq $vuln.Vulnerability.Severity "Medium") (eq $vuln.Vulnerability.Severity "Low") (eq $vuln.Vulnerability.Severity "Unknown") }}

We can limit it to only Critical, High, and Medium by editing the filter as follows

    {{- if or (eq $vuln.Vulnerability.Severity "Critical") (eq $vuln.Vulnerability.Severity "High") (eq $vuln.Vulnerability.Severity "Medium") }}