Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

fixing suggestions

Ricardo1ce7aae08e60
diff --git a/src/components/Widgets/CveVulnerabilities.vue b/src/components/Widgets/CveVulnerabilities.vue
index d07321b5..8540fd7f 100644
--- a/src/components/Widgets/CveVulnerabilities.vue
+++ b/src/components/Widgets/CveVulnerabilities.vue
@@ -59,7 +59,7 @@ export default {
return apiUrl;
},
endpointPage() {
- const page = this.total - (this.options.limit ?? 5);
+ const page = Math.max(this.total - (this.options.limit ?? 5), 1);
let apiUrl = `${widgetApiEndpoints.cveVulnerabilities}`
+ `?resultsPerPage=${(this.options.limit ?? 5)}`
+ `&startIndex=${page}`
@@ -116,7 +116,7 @@ export default {
data.vulnerabilities.forEach(({ cve = {} }) => {
cveList.push({
id: cve.id,
- score: cve.metrics?.cvssMetricV2?.map(x => x.baseSeverity ?? 'UNSET') ?? 'UNSET',
+ score: this.parseScore(cve.metrics),
url: `https://nvd.nist.gov/vuln/detail/${cve.id}`,
description: this.parseDescriptions(cve.descriptions),
publishDate: cve.published,
@@ -125,6 +125,17 @@ export default {
});
this.cveList = cveList;
},
+ parseScore(metrics = {}) {
+ if (!metrics || !metrics.cvssMetricV2) {
+ return 'Unset';
+ }
+ for (let i = 0; i < metrics.cvssMetricV2.length; i += 1) {
+ if (metrics.cvssMetricV2[i].baseSeverity !== undefined && metrics.cvssMetricV2[i].baseSeverity !== '') {
+ return metrics.cvssMetricV2[i].baseSeverity;
+ }
+ }
+ return 'Unset';
+ },
parseDescriptions(cveDescriptions = []) {
for (let i = 0; i < cveDescriptions.length; i += 1) {
if (cveDescriptions[i].lang === 'en') {