Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified metrics should impact score #4

Closed
j--- opened this issue Jan 12, 2023 · 4 comments
Closed

Modified metrics should impact score #4

j--- opened this issue Jan 12, 2023 · 4 comments

Comments

@j---
Copy link

j--- commented Jan 12, 2023

When the env metrics are used to modify a base metric value, the score should be calculated as if the env metric is the value.

Note that the following scores, [1] and [2] should have the same output, but in fact [1] and [3] have the same output.

  1. https://skontar.github.io/cvss-v4.0-calculator/#CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:N/SA:N/CR:H/IR:H/AR:H/MAV:P/MAC:H/MAT:P/MPR:H/MUI:A
  2. https://skontar.github.io/cvss-v4.0-calculator/#CVSS:4.0/AV:P/AC:H/AT:P/PR:H/UI:A/VC:N/VI:N/VA:N/SC:N/SI:N/SA:N/CR:H/IR:H/AR:H/MAV:P/MAC:H/MAT:P/MPR:H/MUI:A
  3. https://skontar.github.io/cvss-v4.0-calculator/#CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:N/SA:N/CR:H/IR:H/AR:H

Perhaps something like this added to checkMetric(metric, value) for each modified env metric (except MSA and MSI, which are going to need to be special cases because of the way that MSA is the only place Safety can be selected)

Lines 124-126 makes sense, but I think it needs something more to account for the env inputs effected the computed score. Perhaps

if(metric[0] == "M") {
   if(selected == "X") {
                return value == this.selectedValues[metric.slice(1)]
            }
    else {
       metric.slice(1).value == selected
    }
}

Sorry, I don't speak javascript very well, but I hope this is intelligible to a human at least.

For MSA and MSI, it it may need to be checked separately, since "S" won't be a legal SA or SI value. Or the macrovector lookup can change to account for this.

@skontar
Copy link
Collaborator

skontar commented Jan 12, 2023

I think I do not understand correctly how modified env metric is supposed to be used.
Is either or both assumptions below true?

  1. If modified metric is set, then treat non-modified one to be equal to modified for computation purposes.
  2. If modified metric is not set, treat the modified one to be equal to non-modified for computation purposes.

@ViperGeek
Copy link
Contributor

This may be overly simplistic, but the way I think of it is:

AV=$VALUE
if (MAV != X) AV=MAV

etc.

In other words, Modified versions of the Base Metrics completely override the value set for that Base Metric.

And as Jono said, MSI and MSA may have to be handled differently (although conceptually the same way) because there are additional values (S) that do not exist in the SI and SA base metrics.

@skontar
Copy link
Collaborator

skontar commented Jan 16, 2023

I think I understand now. I used the following code instead:

// All other environmental metrics just overwrite base score values,
// so if they’re not defined just use the base score value.
if(Object.keys(this.selectedValues).includes("M" + metric)) {
    modified_selected = this.selectedValues["M" + metric]
    if(modified_selected != "X" && modified_selected != "S") {
        return value == modified_selected
    }
}

@skontar
Copy link
Collaborator

skontar commented Jan 16, 2023

I hope this issues is fixed by 5aa9724 . In case it is not, please let me know.

@skontar skontar closed this as completed Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants