Update trivy template

This commit is contained in:
Stefan Reimer 2023-10-02 10:54:12 +00:00
parent 0c3f7306d9
commit ab2f4423a1
2 changed files with 27 additions and 6 deletions

View File

@ -42,7 +42,6 @@ RUN sed -i -e 's/exec \$JAVA_BIN/podman system service -t0\&\n exec \$JAV
ENV XDG_RUNTIME_DIR=/home/$BUILDUSER/agent/xdg-run ENV XDG_RUNTIME_DIR=/home/$BUILDUSER/agent/xdg-run
ENV BUILDAH_ISOLATION=chroot ENV BUILDAH_ISOLATION=chroot
ENV _CONTAINERS_USERNS_CONFIGURED="" ENV _CONTAINERS_USERNS_CONFIGURED=""
ENV TRIVY_TEMPLATE="@/home/jenkins/html.tpl"
ENV HOME=/home/$BUILDUSER ENV HOME=/home/$BUILDUSER
USER $BUILDUSER USER $BUILDUSER

View File

@ -83,11 +83,13 @@
</script> </script>
</head> </head>
<body> <body>
<h1><img src="https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png" style="padding-right:10px";>
Trivy Report - {{ now | date "2006-01-02 15:04:05 -0700" }}</h1>
<table> <table>
<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>
{{- range . }} {{- range . }}
<tr class="group-header"><th colspan="7">{{ escapeXML .Target }}({{ escapeXML .Type }})</th></tr> <tr class="group-header"><th colspan="7">{{ escapeXML .Target }} ({{ .Type | toString | escapeXML }})</th></tr>
{{- if (eq (len .Vulnerabilities) 0) }} {{- if (eq (len .Vulnerabilities) 0) }}
<tr><th colspan="7">No Vulnerabilities found</th></tr> <tr><th colspan="7">No Vulnerabilities found</th></tr>
{{- else }} {{- else }}
@ -101,10 +103,10 @@
<th>Links</th> <th>Links</th>
</tr> </tr>
{{- range .Vulnerabilities }} {{- range .Vulnerabilities }}
<tr class="severity-{{ escapeXML .Vulnerability.Severity }}"> <tr class="severity-{{ escapeXML .Severity }}">
<td class="pkg-name">{{ escapeXML .PkgName }}</td> <td class="pkg-name">{{ escapeXML .PkgName }}</td>
<td>{{ escapeXML .VulnerabilityID }}</td> <td>{{ escapeXML .VulnerabilityID }}</td>
<td class="severity">{{ escapeXML .Vulnerability.Severity }}</td> <td class="severity">{{ escapeXML .Severity }}</td>
<td class="pkg-version">{{ escapeXML .InstalledVersion }}</td> <td class="pkg-version">{{ escapeXML .InstalledVersion }}</td>
<td>{{ escapeXML .FixedVersion }}</td> <td>{{ escapeXML .FixedVersion }}</td>
<td>{{ escapeXML .Title }}</td> <td>{{ escapeXML .Title }}</td>
@ -145,6 +147,26 @@
</tr> </tr>
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- 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 }}
{{- end }} {{- end }}
</table> </table>
{{- else }} {{- else }}