diff --git a/src/main/java/io/gardenlinux/glvd/UiController.java b/src/main/java/io/gardenlinux/glvd/UiController.java index 22562f7..55234e7 100644 --- a/src/main/java/io/gardenlinux/glvd/UiController.java +++ b/src/main/java/io/gardenlinux/glvd/UiController.java @@ -1,5 +1,6 @@ package io.gardenlinux.glvd; +import io.gardenlinux.glvd.db.SourcePackageCve; import jakarta.annotation.Nonnull; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -39,16 +40,37 @@ public String getCveForDistribution( @RequestParam(defaultValue = "DESC") final String sortOrder, @RequestParam(required = false) final String pageNumber, @RequestParam(required = false) final String pageSize, + @RequestParam(required = false, defaultValue = "true") final boolean onlyVulnerable, Model model ) { var sourcePackageCves = glvdService.getCveForDistribution( gardenlinuxVersion, new SortAndPageOptions(sortBy, sortOrder, pageNumber, pageSize) - ); + ).stream().filter(SourcePackageCve::isVulnerable).toList(); model.addAttribute("sourcePackageCves", sourcePackageCves); model.addAttribute("gardenlinuxVersion", gardenlinuxVersion); + model.addAttribute("onlyVulnerable", onlyVulnerable); return "getCveForDistribution"; } + @GetMapping("/getCveForDistributionAll") + public String getCveForDistributionAll( + @RequestParam(name = "gardenlinuxVersion", required = true) String gardenlinuxVersion, + @RequestParam(defaultValue = "baseScore") final String sortBy, + @RequestParam(defaultValue = "DESC") final String sortOrder, + @RequestParam(required = false) final String pageNumber, + @RequestParam(required = false) final String pageSize, + @RequestParam(required = false, defaultValue = "true") final boolean onlyVulnerable, + Model model + ) { + var sourcePackageCves = glvdService.getCveForDistribution( + gardenlinuxVersion, new SortAndPageOptions(sortBy, sortOrder, pageNumber, pageSize) + ); + model.addAttribute("sourcePackageCves", sourcePackageCves); + model.addAttribute("gardenlinuxVersion", gardenlinuxVersion); + model.addAttribute("onlyVulnerable", onlyVulnerable); + return "getCveForDistributionAll"; + } + @GetMapping("/getCveForPackages") public String getCveForPackages( @RequestParam(name = "gardenlinuxVersion", required = true) String gardenlinuxVersion, diff --git a/src/main/resources/templates/getCveForDistribution.html b/src/main/resources/templates/getCveForDistribution.html index b165bb8..32a041f 100644 --- a/src/main/resources/templates/getCveForDistribution.html +++ b/src/main/resources/templates/getCveForDistribution.html @@ -6,33 +6,35 @@ -

+

+Show all potential issues + diff --git a/src/main/resources/templates/getCveForDistributionAll.html b/src/main/resources/templates/getCveForDistributionAll.html new file mode 100644 index 0000000..e0973b7 --- /dev/null +++ b/src/main/resources/templates/getCveForDistributionAll.html @@ -0,0 +1,56 @@ + + + + GLVD: List vulnerabilities in distro + + + + +

+ +

+ +Show only unresolved potential issues + +

CVE ID - - + + CVE Base Score - - + + Vector String CVE Published Date - - + + Source Package - - + + Version
+ + + + + + + + + + + + + + + + + + + +
CVE ID + + + CVE Base Score + + + Vector StringCVE Published Date + + + Source Package + + + VersionIs Vulnerable?
+ + + + + +
+ + + \ No newline at end of file