From 47a395e44127ee43df44921b99c5cf4f8261f3e7 Mon Sep 17 00:00:00 2001 From: Derek Sappington Date: Tue, 16 Apr 2024 08:11:39 -0400 Subject: [PATCH] Fix issue with undefined macroVector on `show details` --- app.js | 6 +++++- cvss_score.js | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 66168a2..70d8089 100644 --- a/app.js +++ b/app.js @@ -14,6 +14,7 @@ const app = Vue.createApp({ cvssSelected: null, header_height: 0, lookup: cvssLookup_global, + macroVector: null } }, methods: { @@ -106,6 +107,8 @@ const app = Vue.createApp({ for (key in toSelect) { this.cvssSelected[key] = toSelect[key] } + this.macroVector = macroVector(this.cvssSelected) + }, onReset() { window.location.hash = "" @@ -145,7 +148,8 @@ const app = Vue.createApp({ return cvss_score( this.cvssSelected, this.lookup, - this.maxSeverityData) + this.maxSeverityData, + this.macroVector) }, qualScore() { if (this.score == 0) { diff --git a/cvss_score.js b/cvss_score.js index 95295c2..f893a50 100644 --- a/cvss_score.js +++ b/cvss_score.js @@ -1,4 +1,4 @@ -function cvss_score(cvssSelected, lookup, maxSeverityData) { +function cvss_score(cvssSelected, lookup, maxSeverityData, macroVectorResult) { // The following defines the index of each metric's values. // It is used when looking for the highest vector part of the // combinations produced by the MacroVector respective highest vectors. @@ -23,7 +23,6 @@ function cvss_score(cvssSelected, lookup, maxSeverityData) { E_levels = {'U': 0.2, 'P': 0.1, 'A': 0} - macroVectorResult = macroVector(cvssSelected) // Exception for no impact on system (shortcut) if (["VC", "VI", "VA", "SC", "SI", "SA"].every((metric) => m(cvssSelected, metric) == "N")) {