Skip to content

Instantly share code, notes, and snippets.

@wagoodman
Last active January 14, 2022 14:51
Show Gist options
  • Save wagoodman/85ffcbf6f73a9597f657f17936a8da0e to your computer and use it in GitHub Desktop.
Save wagoodman/85ffcbf6f73a9597f657f17936a8da0e to your computer and use it in GitHub Desktop.
grype html template usage
<!DOCTYPE html>
<html>
<script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script>
<style>
.backdrop {
background: #efefef;
}
.center {
margin-left: auto;
margin-right: auto;
}
.vuln-table {
border-collapse: collapse;
margin-top: 50px;
padding: 25px
font-size: 0.9em;
font-family: sans-serif;
min-width: 400px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
}
.vuln-table thead tr {
background-color: #4062f7;
color: #ffffff;
text-align: left;
}
.vuln-table th,
.vuln-table td {
padding: 12px 15px;
}
.vuln-table tbody tr {
border-bottom: 1px solid #dddddd;
}
.vuln-table tbody tr:nth-of-type(even) {
background-color: #f3f3f3;
}
.vuln-table tbody tr:last-of-type {
border-bottom: 2px solid #4062f7;
}
.vuln-table tbody tr.active-row {
font-weight: bold;
color: #4062f7;
}
</style>
<body class="backdrop">
<table class="vuln-table center sortable">
<thead>
<tr>
<th>Package Name</th>
<th>Package Version</th>
<th>Vulnerability</th>
<th>Severity</th>
</tr>
</thead>
<tbody>
{{- range .Matches}}
<tr class="item">
<td>{{.Artifact.Name}}</td>
<td>{{.Artifact.Version}}</td>
<td>{{.Vulnerability.ID}}</td>
<td>{{.Vulnerability.Severity}}</td>
</tr>
{{- end}}
</tbody>
</table>
</body>
</html>
@wagoodman
Copy link
Author

wagoodman commented Jan 14, 2022

Example usage:

grype -o template -t ./html.tmpl alpine:3.4 > output.html

firefox output.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment