Skip to content

Commit

Permalink
Release 1.1.3 - Improve the appearance of comparing two Trivy scans o…
Browse files Browse the repository at this point in the history
…f the same exact artefact.
  • Loading branch information
EdgewareRoad committed Mar 21, 2024
1 parent d076515 commit 9800ffa
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Added TrivySummary version and link into the PDF output file footer

Improved the appearance of comparing two Trivy scans of the same exact artefact
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@ public TrivyTwoScanComparison(
if (artefactNames.size() >= 2)
{
DateFormat format = DateFormat.getDateInstance(DateFormat.MEDIUM);
title = String.format("Artefacts %s - %s of type %s, between %s and %s", artefactNames.get(0), artefactNames.get(1), artefactType, format.format(fromScanDate), format.format(toScanDate));
if (artefactNames.get(0).equals(artefactNames.get(1)))
{
// We're comparing the same artefact on different dates
title = String.format("Comparing scans of %s (%s to %s) of type %s", artefactNames.get(0), format.format(fromScanDate), format.format(toScanDate), artefactType);
}
else
{
// We're comparing scans of different artefacts (expected to be different versions of the same logical component)
title = String.format("Comparing %s (scan %s) with %s (scan %s) of type %s", artefactNames.get(0), format.format(fromScanDate), artefactNames.get(1), format.format(toScanDate), artefactType);
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
trivysummary.version=1.1.2
trivysummary.version=1.1.3

logging.level.root=ERROR

Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/templates/compareTrivyScans.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ <h1 th:text="|${title}|">Title</h1>

<p th:text="|Report date is ${new java.util.Date().toString()}|">Report date is ...</p>
<p th:text="|Trivy scans spanning ${fromDate} to ${toDate}.|">Today is ...</p>
<p>Artefacts scanned are <b><span th:text="${earlierArtefactName}" /></b> to <b><span th:text="${laterArtefactName}" /></b> of type <b><span th:text="${artefactType}" /></b></p>
<p th:if="${earlierArtefactName == laterArtefactName}">Artefact scanned is <b><span th:text="${earlierArtefactName}" /></b> of type <b><span th:text="${artefactType}" /></b></p>
<p th:if="${earlierArtefactName != laterArtefactName}">Artefacts scanned are <b><span th:text="${earlierArtefactName}" /></b> to <b><span th:text="${laterArtefactName}" /></b> of type <b><span th:text="${artefactType}" /></b></p>
<span th:if="${comparisonMayNotBeForSameArtefact}">
<p><b>WARNING: Artefact names do not indicate these are scans of the same component - comparison may not be valid</b></p>
</span>
Expand Down

0 comments on commit 9800ffa

Please sign in to comment.