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

Incorrect score calculated when Environmental Requirement metrics are provided #19

Open
jobertabma opened this issue Jul 14, 2022 · 1 comment · May be fixed by #20
Open

Incorrect score calculated when Environmental Requirement metrics are provided #19

jobertabma opened this issue Jul 14, 2022 · 1 comment · May be fixed by #20

Comments

@jobertabma
Copy link

Steps to reproduce

To reproduce, run the following test:

it('returns the correct environmental score for vector without modifiers', function () {
  var someVector = parseVector('CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:C/C:L/I:L/A:L/CR:H/IR:H/AR:H');

  expect(scores.getBase(someVector, { env: true })).to.equal(7.4);
});

This test will fail as getBase returns 6.3 instead of 7.4. As can be seen on FIRST.org, 7.4 should be the environmental score: https://www.first.org/cvss/calculator/3.0#CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:C/C:L/I:L/A:L/CR:H/IR:H/AR:H.

Workaround for v1.0.5

The temporary workaround that I used was to always pass the Modified Scope (MS) metric to the vector string and make sure that it has the same value as the Scope (S) metric. The following test passes:

it('returns the correct environmental score for vector without modifiers', function () {
  var someVector = parseVector('CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:C/C:L/I:L/A:L/CR:H/IR:H/AR:H/MS:C');

  expect(scores.getBase(someVector, { env: true })).to.equal(7.4);
});

This was tested against version 1.0.5.

@xarmin-dev
Copy link

Just ran into this as well. Would be great to have @jobertabma's suggested fix implemented.

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

Successfully merging a pull request may close this issue.

2 participants