Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: format the PDF consumer #469

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
263 changes: 172 additions & 91 deletions components/consumers/pdf/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
body {
font-family: 'Arial', sans-serif;
background-color: #f4f4f4;
color: #333;
color: #2b2722;
margin: 20px;
}

Expand All @@ -33,22 +33,14 @@
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.report-title {
font-size: 24px;
font-weight: bold;
color: #333;
text-align: center;
margin-bottom: 20px;
}

.scan {
margin-bottom: 20px;
}

.scan-title {
font-size: 20px;
font-weight: bold;
color: #007bff;
color: #f65f1e;
margin-bottom: 10px;
}

Expand All @@ -57,6 +49,53 @@
color: #555;
}


.summary {
margin-top: 30px;
color: #555;
}

.introduction {
text-align: center;
}

.placeholder-metrics {
display: flex;
justify-content: space-around;
margin-bottom: 30px;
gap: 10px;
}

.placeholder-metrics > div {
border-radius: 4px;
background-color: #f1ede4;
flex-grow: 1;
text-align: center;
width: 50%;
}

.placeholder-metrics .high-severity {
background-color: #ffe3e3;
color: #982714;
}

.summary-table {
width: 100%;
border-collapse: collapse;
border: 1px solid #777;
}

.summary-table th,
.summary-table td {
border: 1px solid #777;
padding: 4px 10px;
}

/* Detailed finding list */
.detailed-results-header {
margin-top: 40px;
}

.finding {
border: 1px solid #eee;
border-radius: 5px;
Expand All @@ -74,110 +113,152 @@
.finding-title {
font-size: 18px;
font-weight: bold;
color: #333;
color: #2b2722;
margin-bottom: 10px;
}

.finding-details {
color: #777;
.finding-table {
width: 100%;
border-collapse: collapse;
border: 1px solid #777;
}

.introduction {
margin-bottom: 20px;
}

.summary {
margin-top: 20px;
border-top: 1px solid #ddd;
padding-top: 20px;
color: #555;
.finding-table th {
text-align: right;
vertical-align: top;
}

.placeholder-metrics {
display: flex;
justify-content: space-around;
margin-bottom: 20px;
}

.placeholder-graph {
height: 200px;
background-color: #eaeaea;
border-radius: 5px;
.finding-table th,
.finding-table td {
border: 1px solid #777;
padding: 4px 10px;
}
</style>
</head>

<body>

<header>
<img src="https://github.com/smithy-security/smithy/raw/main/assets/smithy-logo-light.svg#gh-dark-mode-only" alt="Logo">
<h1>Smithy Report</h1>
</header>

<div class="report">
<div class="report-title">Scan Results</div>
<header>
<img src="https://github.com/smithy-security/smithy/raw/main/assets/smithy-logo-light.svg#gh-dark-mode-only"
alt="Logo">
<h1>Smithy Report</h1>
</header>

<!-- Introduction -->
<div class="introduction">
<p>This report summarizes the results of running Smithy.</p>
</div>
<!-- Summary -->
<div class="summary">
<h2>Summary</h2>

<!-- Placeholder Metrics -->
<div class="placeholder-metrics">
<div>
<h3>Total Number of Findings</h3>
<p>10</p>
</div>
<div>
<h3>Total High Severity Findings</h3>
<p>10</p>
</div>
</div>

<!-- Placeholder Graph -->
<div class="placeholder-graph"></div>
<div class="report">
<div class="summary">
<p class="introduction">This report summarizes the results of running Smithy.</p>

<p>The vulnerability scans have identified potential issues that need attention. It is recommended to review
and address the findings promptly to enhance the security of our systems.</p>
<!-- Placeholder Metrics -->
<div class="placeholder-metrics">
<div class="total"><h3><span class="total">30</span> Total Findings</h3></div>
<div class="high-severity"><h3><span class="total">10</span> High Severity Findings</h3></div>
</div>
<p>The vulnerability scans have identified potential issues that need attention. <br/>It is recommended to
review
and address the findings promptly to enhance the security of our systems.</p>

<!-- Scan -->
{{range .}}
<div class="scan">
<div class="scan-title">{{.OriginalResults.ScanInfo.ScanUuid}} - {{.OriginalResults.ToolName}}</div>
<div class="scan-details">
<div><strong>Start Time:</strong> {{.OriginalResults.ScanInfo.ScanStartTime}}</div>
</div>
<table class="summary-table">
<thead>
<tr>
<th>Name</th>
<th>Severity</th>
</tr>
</thead>
<tbody>
{{range .}}
{{range .Issues}}
<div class="finding">
<div class="finding-title">{{.RawIssue.Title}}</div>
<div class="finding-details">
<div>Target: {{.RawIssue.Target}} </div>
<div>Type: {{.RawIssue.Type}} </div>
<div>CVSS: {{.RawIssue.Cvss}} </div>
<div>CVE: {{.RawIssue.Cve}} </div>
<div>Confidence: {{.RawIssue.Confidence}} </div>
<div>Severity: {{.RawIssue.Severity}} </div>
<div>Description: {{.RawIssue.Description}} </div>
<div>First Seen: {{.FirstSeen}} </div>
<div>Seen Before Times: {{.Count}} </div>
<div>False Positive?:{{.FalsePositive}} </div>
<div>Last Updated: {{.UpdatedAt}} </div>
{{ range $key,$element := .Annotations }}
<p><b>{{$key}}</b>:{{$element}}</p>
{{end}}
<div>SBOM<pre>{{.RawIssue.CycloneDXSBOM}}</pre></div>
</div>
</div>
<tr>
<td>{{.RawIssue.Title}}</td>
<td>{{.RawIssue.Severity}}</td>
</tr>
{{ end }}
{{end}}
</tbody>
</table>
</div>

<!-- Add more scans as needed -->
<h2 class="detailed-results-header">Detailed Results</h2>

<!-- Scan -->
{{range .}}
<div class="scan">
<h3 class="scan-title">{{.OriginalResults.ScanInfo.ScanUuid}} - {{.OriginalResults.ToolName}}</h3>
<div class="scan-details">
<div><strong>Start Time:</strong> {{.OriginalResults.ScanInfo.ScanStartTime}}</div>
</div>
{{range .Issues}}
<div class="finding">
<h4 class="finding-title">{{.RawIssue.Title}}</h4>
<table class="finding-table">
<tbody>
<tr>
<th>Target</th>
<td>{{.RawIssue.Target}}</td>
</tr>
<tr>
<th>Type</th>
<td>{{.RawIssue.Type}}</td>
</tr>
<tr>
<th>CVSS</th>
<td>{{.RawIssue.Cvss}}</td>
</tr>
<tr>
<th>CVE</th>
<td>{{.RawIssue.Cve}}</td>
</tr>
<tr>
<th>Confidence</th>
<td>{{.RawIssue.Confidence}}</td>
</tr>
<tr>
<th>Severity</th>
<td>{{.RawIssue.Severity}}</td>
</tr>
<tr>
<th>Description</th>
<td>{{.RawIssue.Description}}</td>
</tr>
<tr>
<th>First Seen</th>
<td>{{.FirstSeen}}</td>
</tr>
<tr>
<th>Seen Before Times</th>
<td>{{.Count}}</td>
</tr>
<tr>
<th>False Positive?</th>
<td>{{.FalsePositive}}</td>
</tr>
<tr>
<th>Last Updated</th>
<td>{{.UpdatedAt}}</td>
</tr>
{{ range $key,$element := .Annotations }}
<tr>
<th>{{$key}}</th>
<td>{{$element}}</td>
</tr>
{{end}}
</tbody>
</table>

{{ if .RawIssue.CycloneDXSBOM }}
<div class="sbom">
<h5>SBOM</h5>
<pre>{{ .RawIssue.CycloneDXSBOM }}</pre>
</div>
{{ end }}
</div>
{{end}}
</body>

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

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

</body>
</html>
2 changes: 1 addition & 1 deletion components/sources/git/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
description: Revision to checkout. (branch, tag, sha, ref, etc...)
type: string
default: ""
- name: git-clone-refspec
- name: git-clone-revision
description: Refspec to fetch before checking out revision.
default: ""
type: string
Expand Down
Loading