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

Fixing the severity for several Advisories #2611

Merged
merged 4 commits into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- The CVSS v2 BaseScore calculator calculates the score on the client side now. [#2536](https://github.com/greenbone/gsa/pull/2536)

### Fixed
- Fixed the severity for different advisories [#2611](https://github.com/greenbone/gsa/pull/2611)

### Removed
- Removed support for uncontrolled form fields [#2520](https://github.com/greenbone/gsa/pull/2520)
Expand Down
2 changes: 1 addition & 1 deletion gsa/src/gmp/models/__tests__/certbund.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('CertBundAdv model tests', () => {

test('should parse severity', () => {
const elem = {
max_cvss: '8.5',
score: '85',
};
const certBundAdv = CertBundAdv.fromElement(elem);

Expand Down
4 changes: 2 additions & 2 deletions gsa/src/gmp/models/__tests__/cpe.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ testModel(Cpe, 'cpe');

describe('CPE model tests', () => {
test('should parse severity correctly', () => {
const cpe = Cpe.fromElement({max_cvss: '5.0'});
const cpe2 = Cpe.fromElement({max_cvss: '10'});
const cpe = Cpe.fromElement({score: '50'});
const cpe2 = Cpe.fromElement({score: '100'});

expect(cpe.max_cvss).toBeUndefined();
y0urself marked this conversation as resolved.
Show resolved Hide resolved
expect(cpe.severity).toEqual(5.0);
Expand Down
4 changes: 2 additions & 2 deletions gsa/src/gmp/models/__tests__/dfncert.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ describe('DfnCertAdv model tests', () => {
});

test('should parse severity correctly', () => {
const dfnCertAdv = DfnCertAdv.fromElement({max_cvss: '5.0'});
const dfnCertAdv2 = DfnCertAdv.fromElement({max_cvss: '10'});
const dfnCertAdv = DfnCertAdv.fromElement({score: '50'});
const dfnCertAdv2 = DfnCertAdv.fromElement({score: '100'});

expect(dfnCertAdv.max_cvss).toBeUndefined();
y0urself marked this conversation as resolved.
Show resolved Hide resolved
expect(dfnCertAdv.severity).toEqual(5.0);
Expand Down
2 changes: 1 addition & 1 deletion gsa/src/gmp/models/__tests__/ovaldef.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ testModel(Ovaldef, 'ovaldef');

describe('Ovaldef model tests', () => {
test('should parse severity', () => {
const ovaldef = Ovaldef.fromElement({max_cvss: '8.5'});
const ovaldef = Ovaldef.fromElement({score: '85'});

expect(ovaldef.severity).toEqual(8.5);
expect(ovaldef.max_cvss).toBeUndefined();
y0urself marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
4 changes: 2 additions & 2 deletions gsa/src/gmp/models/certbund.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class CertBundAdv extends Info {
static parseElement(element) {
const ret = super.parseElement(element, 'cert_bund_adv');

ret.severity = parseSeverity(ret.max_cvss);
delete ret.max_cvss;
ret.severity = parseSeverity(ret.score / 10);
delete ret.score;

ret.categories = [];
ret.description = [];
Expand Down
3 changes: 2 additions & 1 deletion gsa/src/gmp/models/cpe.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class Cpe extends Info {
static parseElement(element) {
const ret = super.parseElement(element, 'cpe');

ret.severity = parseSeverity(ret.max_cvss);
ret.severity = parseSeverity(ret.score / 10);
delete ret.score;
delete ret.max_cvss;
y0urself marked this conversation as resolved.
Show resolved Hide resolved

if (isDefined(ret.cves) && isDefined(ret.cves.cve)) {
Expand Down
3 changes: 2 additions & 1 deletion gsa/src/gmp/models/dfncert.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class DfnCertAdv extends Info {
static parseElement(element) {
const ret = super.parseElement(element, 'dfn_cert_adv');

ret.severity = parseSeverity(ret.max_cvss);
ret.severity = parseSeverity(ret.score / 10);
delete ret.score;
delete ret.max_cvss;

const {raw_data} = ret;
Expand Down
4 changes: 2 additions & 2 deletions gsa/src/gmp/models/ovaldef.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ class Ovaldef extends Info {
static parseElement(element) {
const ret = super.parseElement(element, 'ovaldef');

ret.severity = parseSeverity(ret.max_cvss);
delete ret.max_cvss;
ret.severity = parseSeverity(ret.score / 10);
delete ret.score;

const {raw_data} = ret;

Expand Down