Skip to content

Commit

Permalink
Merge pull request #2946 from greenbone/mergify/bp/master/pr-2944
Browse files Browse the repository at this point in the history
Fall back to cvss_base when severity subelement is missing from NVT severities (backport #2944)
  • Loading branch information
saberlynx authored May 28, 2021
2 parents 965f41f + bbf3a02 commit 275e233
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Use greenbone sensor as default scanner type when opening the dialog if available [#2867](https://github.com/greenbone/gsa/pull/2867), [#2924](https://github.com/greenbone/gsa/pull/2924)

### Fixed
- Fall back to cvss_base when severity subelement is missing from NVT severities [#2944](https://github.com/greenbone/gsa/pull/2944)
- Fix loading NVT information in result details [#2934](https://github.com/greenbone/gsa/pull/2934)
- Fixed setting whether to include related resources for new permissions [#2931](https://github.com/greenbone/gsa/pull/2931)
- Fixed number-only names within schedules/dialog [#2914](https://github.com/greenbone/gsa/pull/2914)
- Fixed changing Trend and Select for NVT-families and whole selection only [#2905](https://github.com/greenbone/gsa/pull/2905)
Expand Down
12 changes: 12 additions & 0 deletions gsa/src/gmp/models/__tests__/nvt.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,18 @@ describe('nvt Model tests', () => {
expect(nvt3.severityDate).toBeUndefined();
});

test('should fall back to cvss_base when <severity> is missing from <severities>', () => {
const nvt = Nvt.fromElement({
cvss_base: '10.0',
severities: {},
});

expect(nvt.severity).toEqual(10.0);
expect(nvt.severityOrigin).toBeUndefined();
expect(nvt.severityDate).toBeUndefined();
expect(nvt.cvss_base).toBeUndefined();
});

test('should parse preferences', () => {
const elem = {
preferences: {
Expand Down
2 changes: 1 addition & 1 deletion gsa/src/gmp/models/nvt.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class Nvt extends Info {

delete ret.refs;

if (isDefined(ret.severities)) {
if (isDefined(ret?.severities?.severity)) {
const {severity} = ret.severities;
ret.severity = parseSeverity(severity.score);
ret.severityOrigin = parseText(severity.origin);
Expand Down

0 comments on commit 275e233

Please sign in to comment.