jenkins-podman/html.tpl

179 lines
6.2 KiB
Smarty
Raw Normal View History

2022-01-13 11:41:17 +00:00
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
{{- if . }}
<style>
* {
font-family: Arial, Helvetica, sans-serif;
}
h1 {
text-align: center;
}
.group-header th {
font-size: 200%;
2022-01-25 13:58:38 +00:00
background-color: #E4E4E4;
2022-01-13 11:41:17 +00:00
}
.sub-header th {
font-size: 150%;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
2022-11-18 12:36:14 +00:00
white-space: nowrap;
2022-01-13 11:41:17 +00:00
padding: .3em;
}
table {
margin: 0 auto;
}
.severity {
text-align: center;
font-weight: bold;
color: #fafafa;
}
.severity-LOW .severity { background-color: #5fbb31; }
.severity-MEDIUM .severity { background-color: #e9c600; }
.severity-HIGH .severity { background-color: #ff8800; }
.severity-CRITICAL .severity { background-color: #e40000; }
.severity-UNKNOWN .severity { background-color: #747474; }
.severity-LOW { background-color: #5fbb3160; }
.severity-MEDIUM { background-color: #e9c60060; }
.severity-HIGH { background-color: #ff880060; }
.severity-CRITICAL { background-color: #e4000060; }
2022-11-18 12:36:14 +00:00
.severity-UNKNOWN { background-color: #74747460; }
2022-01-13 11:41:17 +00:00
table tr td:first-of-type {
font-weight: bold;
}
.links a,
.links[data-more-links=on] a {
display: block;
}
.links[data-more-links=off] a:nth-of-type(1n+5) {
display: none;
}
a.toggle-more-links { cursor: pointer; }
</style>
<title>{{- escapeXML ( index . 0 ).Target }} - Trivy Report - {{ now | date "2006-01-02 15:04:05 -0700" }}</title>
2022-01-13 11:41:17 +00:00
<script>
window.onload = function() {
document.querySelectorAll('td.links').forEach(function(linkCell) {
var links = [].concat.apply([], linkCell.querySelectorAll('a'));
[].sort.apply(links, function(a, b) {
return a.href > b.href ? 1 : -1;
});
links.forEach(function(link, idx) {
if (links.length > 3 && 3 === idx) {
var toggleLink = document.createElement('a');
toggleLink.innerText = "Toggle more links";
toggleLink.href = "#toggleMore";
toggleLink.setAttribute("class", "toggle-more-links");
linkCell.appendChild(toggleLink);
}
linkCell.appendChild(link);
});
});
document.querySelectorAll('a.toggle-more-links').forEach(function(toggleLink) {
toggleLink.onclick = function() {
var expanded = toggleLink.parentElement.getAttribute("data-more-links");
toggleLink.parentElement.setAttribute("data-more-links", "on" === expanded ? "off" : "on");
return false;
};
});
};
</script>
</head>
<body>
<table>
2023-10-02 10:54:12 +00:00
<tr><td colspan="7">
<h1><img src="https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png" style="padding:10px;float:left";>
{{- escapeXML ( index . 0 ).Target }}<br/>Trivy Report - {{ now | date "2006-01-02 15:04:05 -0700" }}</h1>
</td></tr>
2022-01-13 11:41:17 +00:00
{{- range . }}
2023-10-02 10:54:12 +00:00
<tr class="group-header"><th colspan="7">{{ escapeXML .Target }} ({{ .Type | toString | escapeXML }})</th></tr>
2022-01-13 11:41:17 +00:00
{{- if (eq (len .Vulnerabilities) 0) }}
<tr><th colspan="7">No Vulnerabilities found</th></tr>
2022-01-13 11:41:17 +00:00
{{- else }}
<tr class="sub-header">
<th>Package</th>
<th>Vulnerability ID</th>
<th>Severity</th>
<th>Installed Version</th>
<th>Fixed Version</th>
<th>Title</th>
2022-01-13 11:41:17 +00:00
<th>Links</th>
</tr>
2022-01-25 11:43:14 +00:00
{{- range .Vulnerabilities }}
2023-10-02 10:54:12 +00:00
<tr class="severity-{{ escapeXML .Severity }}">
2022-01-13 11:41:17 +00:00
<td class="pkg-name">{{ escapeXML .PkgName }}</td>
<td>{{ escapeXML .VulnerabilityID }}</td>
2023-10-02 10:54:12 +00:00
<td class="severity">{{ escapeXML .Severity }}</td>
2022-01-13 11:41:17 +00:00
<td class="pkg-version">{{ escapeXML .InstalledVersion }}</td>
<td>{{ escapeXML .FixedVersion }}</td>
<td>{{ escapeXML .Title }}</td>
2022-01-13 11:41:17 +00:00
<td class="links" data-more-links="off">
2022-01-25 11:43:14 +00:00
{{- if .PrimaryURL }}
<a href={{ escapeXML .PrimaryURL | printf "%q" }} target="_blank" rel="noopener noreferrer">{{ escapeXML .PrimaryURL }}</a>
{{- else }}
2022-01-13 11:41:17 +00:00
{{- range .Vulnerability.References }}
<a href={{ escapeXML . | printf "%q" }} target="_blank" rel="noopener noreferrer">{{ escapeXML . }}</a>
2022-01-13 11:41:17 +00:00
{{- end }}
2022-01-25 11:43:14 +00:00
{{- end }}
2022-01-13 11:41:17 +00:00
</td>
</tr>
2022-01-25 11:43:14 +00:00
{{- end }}
2022-01-13 11:41:17 +00:00
{{- end }}
{{- if (eq (len .Misconfigurations ) 0) }}
<tr><th colspan="7">No Misconfigurations found</th></tr>
2022-01-13 11:41:17 +00:00
{{- else }}
<tr class="sub-header">
<th>Type</th>
<th>Misconf ID</th>
<th>Check</th>
<th>Severity</th>
<th>Message</th>
</tr>
{{- range .Misconfigurations }}
<tr class="severity-{{ escapeXML .Severity }}">
<td class="misconf-type">{{ escapeXML .Type }}</td>
<td>{{ escapeXML .ID }}</td>
<td class="misconf-check">{{ escapeXML .Title }}</td>
<td class="severity">{{ escapeXML .Severity }}</td>
<td class="link" data-more-links="off" style="white-space:normal;">
2022-01-13 11:41:17 +00:00
{{ escapeXML .Message }}
<br>
<a href={{ escapeXML .PrimaryURL | printf "%q" }} target="_blank" rel="noopener noreferrer">{{ escapeXML .PrimaryURL }}</a>
2022-01-13 11:41:17 +00:00
</br>
</td>
</tr>
{{- end }}
{{- end }}
2023-10-02 10:54:12 +00:00
{{- if (eq (len .Secrets) 0) }}
<tr><th colspan="7">No Secrets found</th></tr>
{{- else }}
<tr class="sub-header">
<th colspan="2">Rule ID</th>
<th>Severity</th>
<th>Category</th>
<th colspan="2">Title</th>
<th>Lines</th>
</tr>
{{- range .Secrets }}
<tr class="severity-{{ escapeXML .Severity }}">
<td colspan="2">{{ escapeXML .RuleID }}</td>
<td class="severity">{{ escapeXML .Severity }}</td>
<td>{{ .Category | toString | escapeXML }}</td>
<td colspan="2">{{ escapeXML .Title }}</td>
<td>{{ .StartLine | toString }} - {{ .EndLine | toString }}</td>
</tr>
{{- end }}
{{- end }}
2022-01-13 11:41:17 +00:00
{{- end }}
</table>
{{- else }}
</head>
<body>
<h1>Trivy Returned Empty Report</h1>
{{- end }}
</body>
</html>