Skip to content

Commit

Permalink
Extend CVE detail view with distro-specific info (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
fwilhe authored Sep 24, 2024
1 parent 614336f commit 2418d44
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
44 changes: 43 additions & 1 deletion src/main/java/io/gardenlinux/glvd/db/CveDetails.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import jakarta.persistence.Id;
import jakarta.persistence.Table;

import java.util.List;

@Entity
@Table(name = "cvedetails")
public class CveDetails {
Expand All @@ -21,6 +23,21 @@ public class CveDetails {
@Column(name = "published", nullable = false)
private String cvePublishedDate;

@Column(name = "distro", nullable = true)
private List<String> distro;

@Column(name = "distro_version", nullable = true)
private List<String> distroVersion;

@Column(name = "is_vulnerable", nullable = true)
private List<Boolean> isVulnerable;

@Column(name = "source_package_name", nullable = false)
private List<String> sourcePackageName;

@Column(name = "source_package_version", nullable = false)
private List<String> sourcePackageVersion;

@Column(name = "base_score_v40", nullable = true)
private Float baseScoreV40;

Expand Down Expand Up @@ -48,11 +65,16 @@ public class CveDetails {
public CveDetails() {
}

public CveDetails(String cveId, String vulnStatus, String description, String cvePublishedDate, Float baseScoreV40, Float baseScoreV31, Float baseScoreV30, Float baseScoreV2, String vectorStringV40, String vectorStringV31, String vectorStringV30, String vectorStringV2) {
public CveDetails(String cveId, String vulnStatus, String description, String cvePublishedDate, List<String> distro, List<String> distroVersion, List<Boolean> isVulnerable, List<String> sourcePackageName, List<String> sourcePackageVersion, Float baseScoreV40, Float baseScoreV31, Float baseScoreV30, Float baseScoreV2, String vectorStringV40, String vectorStringV31, String vectorStringV30, String vectorStringV2) {
this.cveId = cveId;
this.vulnStatus = vulnStatus;
this.description = description;
this.cvePublishedDate = cvePublishedDate;
this.distro = distro;
this.distroVersion = distroVersion;
this.isVulnerable = isVulnerable;
this.sourcePackageName = sourcePackageName;
this.sourcePackageVersion = sourcePackageVersion;
this.baseScoreV40 = baseScoreV40;
this.baseScoreV31 = baseScoreV31;
this.baseScoreV30 = baseScoreV30;
Expand All @@ -79,6 +101,26 @@ public String getCvePublishedDate() {
return cvePublishedDate;
}

public List<String> getDistro() {
return distro;
}

public List<String> getDistroVersion() {
return distroVersion;
}

public List<Boolean> getIsVulnerable() {
return isVulnerable;
}

public List<String> getSourcePackageName() {
return sourcePackageName;
}

public List<String> getSourcePackageVersion() {
return sourcePackageVersion;
}

public Float getBaseScoreV40() {
return baseScoreV40;
}
Expand Down
21 changes: 21 additions & 0 deletions src/main/resources/templates/getCveDetails.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,27 @@ <h1 th:text="|Details for ${cveDetails.cveId}|" />
<p th:text="|Base Score (Version 2): ${cveDetails.baseScoreV2}|" />
<p th:text="|Vector String (Version 2): ${cveDetails.vectorStringV2}|" />

<h2>Affected Linux Versions</h2>

<table>
<thead>
<tr>
<th>Distro</th>
<th>Version</th>
<th>Source Package</th>
<th>Package Version</th>
<th>Is Vulnerable</th>
</tr>
</thead>
<tr th:each="distro,iterStat : ${cveDetails.distro}">
<td th:text="${distro}"></td>
<td th:text="${cveDetails.distroVersion[__${iterStat.index}__]}"></td>
<td th:text="${cveDetails.sourcePackageName[__${iterStat.index}__]}"></td>
<td th:text="${cveDetails.sourcePackageVersion[__${iterStat.index}__]}"></td>
<td th:text="${cveDetails.isVulnerable[__${iterStat.index}__]}"></td>
</tr>

</table>

</body>
</html>

0 comments on commit 2418d44

Please sign in to comment.