|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 5 | +{{- if . }} |
| 6 | + <style> |
| 7 | + * { |
| 8 | + font-family: Arial, Helvetica, sans-serif; |
| 9 | + } |
| 10 | + h1 { |
| 11 | + text-align: center; |
| 12 | + } |
| 13 | + .group-header th { |
| 14 | + font-size: 200%; |
| 15 | + } |
| 16 | + .sub-header th { |
| 17 | + font-size: 150%; |
| 18 | + } |
| 19 | + table, th, td { |
| 20 | + border: 1px solid black; |
| 21 | + border-collapse: collapse; |
| 22 | + white-space: nowrap; |
| 23 | + padding: .3em; |
| 24 | + } |
| 25 | + table { |
| 26 | + margin: 0 auto; |
| 27 | + } |
| 28 | + .severity { |
| 29 | + text-align: center; |
| 30 | + font-weight: bold; |
| 31 | + color: #fafafa; |
| 32 | + } |
| 33 | + .severity-LOW .severity { background-color: #5fbb31; } |
| 34 | + .severity-MEDIUM .severity { background-color: #e9c600; } |
| 35 | + .severity-HIGH .severity { background-color: #ff8800; } |
| 36 | + .severity-CRITICAL .severity { background-color: #e40000; } |
| 37 | + .severity-UNKNOWN .severity { background-color: #747474; } |
| 38 | + .severity-LOW { background-color: #5fbb3160; } |
| 39 | + .severity-MEDIUM { background-color: #e9c60060; } |
| 40 | + .severity-HIGH { background-color: #ff880060; } |
| 41 | + .severity-CRITICAL { background-color: #e4000060; } |
| 42 | + .severity-UNKNOWN { background-color: #74747460; } |
| 43 | + table tr td:first-of-type { |
| 44 | + font-weight: bold; |
| 45 | + } |
| 46 | + .links a, |
| 47 | + .links[data-more-links=on] a { |
| 48 | + display: block; |
| 49 | + } |
| 50 | + .links[data-more-links=off] a:nth-of-type(1n+5) { |
| 51 | + display: none; |
| 52 | + } |
| 53 | + a.toggle-more-links { cursor: pointer; } |
| 54 | + </style> |
| 55 | + <title>{{- escapeXML ( index . 0 ).Target }} - Trivy Report - {{ now }} </title> |
| 56 | + <script> |
| 57 | + window.onload = function() { |
| 58 | + document.querySelectorAll('td.links').forEach(function(linkCell) { |
| 59 | + var links = [].concat.apply([], linkCell.querySelectorAll('a')); |
| 60 | + [].sort.apply(links, function(a, b) { |
| 61 | + return a.href > b.href ? 1 : -1; |
| 62 | + }); |
| 63 | + links.forEach(function(link, idx) { |
| 64 | + if (links.length > 3 && 3 === idx) { |
| 65 | + var toggleLink = document.createElement('a'); |
| 66 | + toggleLink.innerText = "Toggle more links"; |
| 67 | + toggleLink.href = "#toggleMore"; |
| 68 | + toggleLink.setAttribute("class", "toggle-more-links"); |
| 69 | + linkCell.appendChild(toggleLink); |
| 70 | + } |
| 71 | + linkCell.appendChild(link); |
| 72 | + }); |
| 73 | + }); |
| 74 | + document.querySelectorAll('a.toggle-more-links').forEach(function(toggleLink) { |
| 75 | + toggleLink.onclick = function() { |
| 76 | + var expanded = toggleLink.parentElement.getAttribute("data-more-links"); |
| 77 | + toggleLink.parentElement.setAttribute("data-more-links", "on" === expanded ? "off" : "on"); |
| 78 | + return false; |
| 79 | + }; |
| 80 | + }); |
| 81 | + }; |
| 82 | + </script> |
| 83 | + </head> |
| 84 | + <body> |
| 85 | + <h1>Trivy Report: {{ now }}</h1> |
| 86 | + <table> |
| 87 | + {{- range . }} |
| 88 | + <tr class="group-header"><th colspan="6">{{ .Type | toString | escapeXML }}: {{ .Target | toString | escapeXML }}</th></tr> |
| 89 | + {{- if (eq (len .Vulnerabilities) 0) }} |
| 90 | + <tr><th colspan="6">No Vulnerabilities found</th></tr> |
| 91 | + {{- else }} |
| 92 | + <tr class="sub-header"> |
| 93 | + <th>Package</th> |
| 94 | + <th>Vulnerability ID</th> |
| 95 | + <th>Severity</th> |
| 96 | + <th>Installed Version</th> |
| 97 | + <th>Fixed Version</th> |
| 98 | + <th>Links</th> |
| 99 | + </tr> |
| 100 | + {{- range .Vulnerabilities }} |
| 101 | + <tr class="severity-{{ escapeXML .Vulnerability.Severity }}"> |
| 102 | + <td class="pkg-name">{{ escapeXML .PkgName }}</td> |
| 103 | + <td>{{ escapeXML .VulnerabilityID }}</td> |
| 104 | + <td class="severity">{{ escapeXML .Vulnerability.Severity }}</td> |
| 105 | + <td class="pkg-version">{{ escapeXML .InstalledVersion }}</td> |
| 106 | + <td>{{ escapeXML .FixedVersion }}</td> |
| 107 | + <td class="links" data-more-links="off"> |
| 108 | + {{- range .Vulnerability.References }} |
| 109 | + <a href={{ escapeXML . | printf "%q" }}>{{ escapeXML . }}</a> |
| 110 | + {{- end }} |
| 111 | + </td> |
| 112 | + </tr> |
| 113 | + {{- end }} |
| 114 | + {{- end }} |
| 115 | + {{- if (eq (len .Misconfigurations ) 0) }} |
| 116 | + <tr><th colspan="6">No Misconfigurations found</th></tr> |
| 117 | + {{- else }} |
| 118 | + <tr class="sub-header"> |
| 119 | + <th>Type</th> |
| 120 | + <th>Misconf ID</th> |
| 121 | + <th>Check</th> |
| 122 | + <th>Severity</th> |
| 123 | + <th>Message</th> |
| 124 | + </tr> |
| 125 | + {{- range .Misconfigurations }} |
| 126 | + <tr class="severity-{{ escapeXML .Severity }}"> |
| 127 | + <td class="misconf-type">{{ escapeXML .Type }}</td> |
| 128 | + <td>{{ escapeXML .ID }}</td> |
| 129 | + <td class="misconf-check">{{ escapeXML .Title }}</td> |
| 130 | + <td class="severity">{{ escapeXML .Severity }}</td> |
| 131 | + <td class="link" data-more-links="off" style="white-space:normal;"> |
| 132 | + {{ escapeXML .Message }} |
| 133 | + <br> |
| 134 | + <a href={{ escapeXML .PrimaryURL | printf "%q" }}>{{ escapeXML .PrimaryURL }}</a> |
| 135 | + </br> |
| 136 | + </td> |
| 137 | + </tr> |
| 138 | + {{- end }} |
| 139 | + {{- end }} |
| 140 | + {{- end }} |
| 141 | + </table> |
| 142 | +{{- else }} |
| 143 | + </head> |
| 144 | + <body> |
| 145 | + <h1>Trivy Returned Empty Report</h1> |
| 146 | +{{- end }} |
| 147 | + </body> |
| 148 | +</html> |
0 commit comments