Skip to content

Commit

Permalink
nicer pdf format
Browse files Browse the repository at this point in the history
  • Loading branch information
dlicheva committed Jan 21, 2025
1 parent 805d300 commit e25f73b
Showing 1 changed file with 87 additions and 135 deletions.
222 changes: 87 additions & 135 deletions new-components/reporters/pdf/internal/reporter/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,27 +150,27 @@
}

/*severities*/
.SEVERITY_CRITICAL {
.SEVERITY_ID_CRITICAL {
background-color: #f88691;
}

.SEVERITY_HIGH {
.SEVERITY_ID_HIGH {
background-color: #ffe3e3;
}

.SEVERITY_MEDIUM {
.SEVERITY_ID_MEDIUM {
background-color: #fde8cb;
}

.SEVERITY_LOW {
.SEVERITY_ID_LOW {
background-color: #fdf7bd;
}

.SEVERITY_INFO {
.SEVERITY_ID_INFO {
background-color: #dafbfb;
}

.SEVERITY_UNSPECIFIED {
.SEVERITY_ID_UNSPECIFIED {
background-color: #fbf7f1;
}

Expand Down Expand Up @@ -210,145 +210,97 @@ <h1>Smithy Report</h1>
</thead>
<tbody>
{{range .}}
{{range .Issues}}
<tr class="issue-summary">
<td><a href="#{{ .RawIssue.Title | urlquery }}">{{.RawIssue.Title}}</a></td>
<td class="seen">{{.Count}} times</td>
<td class="summary severity {{.RawIssue.Severity}}">{{.RawIssue.Severity}} </td>
</tr>
{{ end }}
<tr class="issue-summary">
<td><a href="#{{ .Finding.FindingInfo.Title | urlquery }}">{{ .Finding.FindingInfo.Title }}</a></td>
<td class="seen">{{ .Finding.Count }} times</td>
<td class="summary severity {{.Finding.Severity}}">{{ .Finding.Severity }} </td>
</tr>
{{end}}
</tbody>
</table>
</div>

<!-- Scan -->
{{range .}}
<div class="scan">
<h3 class="scan-title">{{.OriginalResults.ToolName}}</h3>
{{ if and .OriginalResults.ScanInfo.ScanStartTime (ne .OriginalResults.ScanInfo.ScanStartTime.Seconds 0) }}
<div class="scan-details">
<div class="scan-start-time">{{.OriginalResults.ScanInfo.ScanStartTime | formatTime}}</div>
</div>
{{ end }}
{{range .Issues}}
<div class="finding">
<h4 class="finding-title" id="{{ .RawIssue.Title | urlquery }}">{{ .RawIssue.Title }}</h4>
<table class="finding-table">
<tbody>

{{ if and .RawIssue.Severity (ne .RawIssue.Severity nil) }}
<tr>
<th>Severity</th>
<td class="severity {{.RawIssue.Severity}}">{{.RawIssue.Severity}}</td>
</tr>
{{ end }}

{{ if and .RawIssue.Cvss (ne .RawIssue.Cvss 0.0) }}
<tr>
<th><a href="https://nvd.nist.gov/vuln-metrics/cvss">CVSS</a></th>
<td>{{.RawIssue.Cvss}}</td>
</tr>
{{ end }}

{{ if and .RawIssue.Confidence (ne .RawIssue.Confidence nil) }}
<tr>
<th>Confidence</th>
<td class="confidence">{{.RawIssue.Confidence}}</td>
</tr>
{{ end }}

{{ if and .RawIssue.Type (ne .RawIssue.Type "") }}
<tr>
<th>Type</th>
<td>{{.RawIssue.Type}}</td>
</tr>
{{ end }}

{{ if and .RawIssue.Cve (ne .RawIssue.Cve "") }}
<tr>
<th>CVE</th>
<td>
<a href="https://nvd.nist.gov/vuln/detail/{{.RawIssue.Cve}}">{{.RawIssue.Cve}}</a>
</td>
</tr>
{{ end }}

{{if gt (len .RawIssue.Cwe) 0}}
<tr class="cwe-list">
<th>CWE</th>
<td>
{{range .RawIssue.Cwe}}
<a href="https://cwe.mitre.org/data/definitions/{{ . }}.html">{{ . }}</a>
{{end}}
</td>
</tr>
{{end}}

{{ if and .RawIssue.Target (ne .RawIssue.Target "") }}
<tr>
<th>Target</th>
<td>{{.RawIssue.Target}}</td>
</tr>
{{ end }}

{{ if and .RawIssue.Description (ne .RawIssue.Description "") }}
<tr>
<th>Description</th>
<td>
<pre><code>{{.RawIssue.Description}}</code></pre>
</td>
</tr>
{{ end }}

{{ if and .FirstSeen (ne .FirstSeen nil) }}
<tr>
<th>First Seen</th>
<td>{{.FirstSeen | formatTime}}</td>
</tr>
{{ end }}

<tr>
<th>Seen Before</th>
<td class="seen">{{.Count}} times</td>
</tr>

{{ if and .FalsePositive (ne .FalsePositive "") }}
<tr>
<th>False Positive?</th>
<td>{{.FalsePositive}}</td>
</tr>
{{ end }}

{{ if and .UpdatedAt (ne .UpdatedAt.Seconds 0) }}
<tr>
<th>Last Updated</th>
<td>{{ .UpdatedAt | formatTime }}</td>
</tr>
{{ end }}

{{ range $key,$element := .Annotations }}
<tr>
<th>{{$key}}</th>
<td>{{$element}}</td>
</tr>
{{end}}
</tbody>
</table>

{{ if .RawIssue.CycloneDXSBOM }}
<div class="sbom">
<h5>SBOM for {{.RawIssue.Title}}</h5>
<pre>{{ .RawIssue.CycloneDXSBOM }}</pre>
{{range .}}
<div class="finding">
<h4 class="finding-title" id="{{ .Finding.FindingInfo.Title | urlquery }}">{{ .Finding.FindingInfo.Title }}</h4>
<table class="finding-table">
<tbody>
{{ if and .Finding.FindingInfo.ProductUid (ne .Finding.FindingInfo.ProductUid nil) }}
<tr>
<th>Tool</th>
<td class="severity {{.Finding.FindingInfo.ProductUid}}">{{.Finding.FindingInfo.ProductUid}}</td>
</tr>
{{ end }}

{{ if and .Finding.Severity (ne .Finding.Severity nil) }}
<tr>
<th>Severity</th>
<td class="severity {{.Finding.Severity}}">{{.Finding.Severity}}</td>
</tr>
{{ end }}

{{ if and .Finding.Confidence (ne .Finding.Confidence nil) }}
<tr>
<th>Confidence</th>
<td class="confidence">{{.Finding.Confidence}}</td>
</tr>
{{ end }}

{{ if and .Finding.TypeUid (ne .Finding.TypeUid nil) }}
<tr>
<th>Type</th>
<td>{{.Finding.TypeUid}}</td>
</tr>
{{ end }}

{{ if and .Finding.FindingInfo.DataSources (ne .Finding.FindingInfo.DataSources nil) }}
<tr>
<th>Target</th>
<td>{{.Finding.FindingInfo.DataSources}}</td>
</tr>
{{ end }}

{{ if and .Finding.FindingInfo.Message (ne .Finding.FindingInfo.Message nil) }}
<tr>
<th>Description</th>
<td>
<pre>{{.Finding.FindingInfo.Message}}</pre>
</td>
</tr>
{{ end }}

{{ if and .Finding.FindingInfo.FirstSeenTime (ne .Finding.FindingInfo.FirstSeenTime nil) }}
<tr>
<th>First Seen</th>
<td>{{.Finding.FindingInfo.FirstSeenTime}}</td>
</tr>
{{ end }}

<tr>
<th>Seen Before</th>
<td class="seen">{{.Finding.Count}} times</td>
</tr>

{{ if and .Finding.FindingInfo.ModifiedTime (ne .Finding.FindingInfo.ModifiedTime nil) }}
<tr>
<th>Last Updated</th>
<td>{{ .Finding.FindingInfo.ModifiedTime }}</td>
</tr>
{{ end }}

{{ range $key,$element := .Finding.Vulnerabilities }}
<tr>
<th>{{$key}}</th>
<td>{{$element}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{ end }}
</div>
{{end}}

<!-- Add more scans as needed -->

</div>
{{end}}
</div>

</body>
Expand Down

0 comments on commit e25f73b

Please sign in to comment.