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

change: epss score to be displayed in percentage #4251

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions public/locales/gsa-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@
"Dynamic": "Dynamisch",
"Dynamic Severity": "Dynamischer Schweregrad",
"EPSS": "EPSS",
"EPSS Percentile": "EPSS-Perzentil",
"EPSS Percentage": "EPSS-Prozentsatz",
"EPSS Score": "EPSS-Score",
"EPSS (CVE with highest severity)": "EPSS (CVE mit höchstem Schweregrad)",
"EPSS (highest EPSS score)": "EPSS (Höchster EPSS-Score)",
Expand Down Expand Up @@ -1180,7 +1180,7 @@
"Password only": "Nur Passwort",
"Password: Use existing Password": "Passwort: Verwende bestehendes Passwort",
"Path": "Pfad",
"Percentile": "Perzentil",
"Percennage": "Prozentsatz",
"Performance": "Leistungsdaten",
"Period": "Zeitintervall",
"Permission": "Berechtigung",
Expand Down
2 changes: 1 addition & 1 deletion src/web/pages/cves/__tests__/detailspage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('CVE Detailspage tests', () => {
);

expect(baseElement).toHaveTextContent('Score0.50000');
expect(baseElement).toHaveTextContent('Percentile0.75000');
expect(baseElement).toHaveTextContent('Percentage75.000%');

const links = baseElement.querySelectorAll('a');
const icons = getAllByTestId('svg-icon');
Expand Down
2 changes: 1 addition & 1 deletion src/web/pages/cves/__tests__/listpage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ describe('CvesPage tests', () => {
expect(row[2]).toHaveTextContent('AV:N/AC:M/Au:N/C:C/I:C/A:C');
expect(row[2]).toHaveTextContent('9.3 (High)');
expect(row[2]).toHaveTextContent('0.50000');
expect(row[2]).toHaveTextContent('0.75000');
expect(row[2]).toHaveTextContent('75.000%');
});

test('should allow to bulk action on page contents', async () => {
Expand Down
7 changes: 2 additions & 5 deletions src/web/pages/cves/details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/


import React from 'react';

import {_, _l} from 'gmp/locale/lang';
Expand Down Expand Up @@ -102,8 +101,8 @@ const CveDetails = ({entity}) => {
<TableData>{epss.score.toFixed(5)}</TableData>
</TableRow>
<TableRow>
<TableData>{_('Percentile')}</TableData>
<TableData>{epss.percentile.toFixed(5)}</TableData>
<TableData>{_('Percentage')}</TableData>
<TableData>{`${(epss?.percentile * 100).toFixed(3)}%`}</TableData>
</TableRow>
</TableBody>
</InfoTable>
Expand Down Expand Up @@ -137,5 +136,3 @@ CveDetails.propTypes = {
};

export default CveDetails;

// vim: set ts=2 sw=2 tw=80:
2 changes: 1 addition & 1 deletion src/web/pages/cves/filterdialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
},
{
name: 'epss_percentile',
displayName: _('EPSS Percentile'),
displayName: _('EPSS Percentage'),

Check warning on line 78 in src/web/pages/cves/filterdialog.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/cves/filterdialog.jsx#L78

Added line #L78 was not covered by tests
},
];

Expand Down
7 changes: 3 additions & 4 deletions src/web/pages/cves/row.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/


import React from 'react';

import {_} from 'gmp/locale/lang';
Expand Down Expand Up @@ -66,7 +65,9 @@
{isNumber(epssScore) ? epssScore.toFixed(5) : _('N/A')}
</TableData>
<TableData>
{isNumber(epssPercentile) ? epssPercentile.toFixed(5) : _('N/A')}
{isNumber(epssPercentile)
? `${(epssPercentile * 100).toFixed(3)}%`
: _('N/A')}

Check warning on line 70 in src/web/pages/cves/row.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/cves/row.jsx#L70

Added line #L70 was not covered by tests
</TableData>
</>
)}
Expand All @@ -83,5 +84,3 @@
};

export default Row;

// vim: set ts=2 sw=2 tw=80:
4 changes: 1 addition & 3 deletions src/web/pages/cves/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const Header = ({
currentSortBy={currentSortBy}
sortBy={sort ? 'epss_percentile' : false}
onSortChange={onSortChange}
title={_('Percentile')}
title={_('Percentage')}
/>
</TableRow>
)}
Expand Down Expand Up @@ -140,5 +140,3 @@ export const CvesTable = createEntitiesTable({
});

export default CvesTable;

// vim: set ts=2 sw=2 tw=80:
4 changes: 2 additions & 2 deletions src/web/pages/nvts/__tests__/detailspage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ describe('Nvt Detailspage tests', () => {
expect(baseElement).toHaveTextContent('EPSS (CVE with highest severity)');
expect(baseElement).toHaveTextContent('EPSS Score');
expect(baseElement).toHaveTextContent('0.87650');
expect(baseElement).toHaveTextContent('EPSS Percentile');
expect(baseElement).toHaveTextContent('0.90000');
expect(baseElement).toHaveTextContent('EPSS Percentage');
expect(baseElement).toHaveTextContent('90.000%');
expect(baseElement).toHaveTextContent('EPSS (highest EPSS score)');
expect(baseElement).toHaveTextContent('0.98760');

Expand Down
4 changes: 2 additions & 2 deletions src/web/pages/nvts/__tests__/listpage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ describe('NvtsPage tests', () => {
expect(header[7]).toHaveTextContent('QoD');
expect(header[8]).toHaveTextContent('EPSS');
expect(header[9]).toHaveTextContent('Score');
expect(header[10]).toHaveTextContent('Percentile');
expect(header[10]).toHaveTextContent('Percentage');

const row = baseElement.querySelectorAll('tr');

Expand All @@ -223,7 +223,7 @@ describe('NvtsPage tests', () => {
expect(row[2]).toHaveTextContent('CVE-2020-5678');
expect(row[2]).toHaveTextContent('80 %');
expect(row[2]).toHaveTextContent('0.87650');
expect(row[2]).toHaveTextContent('0.90000');
expect(row[2]).toHaveTextContent('90.000%');
});

test('should allow to bulk action on page contents', async () => {
Expand Down
10 changes: 4 additions & 6 deletions src/web/pages/nvts/details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ const NvtDetails = ({entity, links = true}) => {
</TableData>
</TableRow>
<TableRow>
<TableData>{_('EPSS Percentile')}</TableData>
<TableData>{_('EPSS Percentage')}</TableData>
<TableData>
{isNumber(epss?.max_severity?.percentile)
? epss?.max_severity?.percentile.toFixed(5)
? `${(epss.max_severity.percentile * 100).toFixed(3)}%`
: _('N/A')}
</TableData>
</TableRow>
Expand Down Expand Up @@ -154,10 +154,10 @@ const NvtDetails = ({entity, links = true}) => {
</TableData>
</TableRow>
<TableRow>
<TableData>{_('EPSS Percentile')}</TableData>
<TableData>{_('EPSS Percentage')}</TableData>
<TableData>
{isNumber(epss?.max_epss?.percentile)
? epss?.max_epss?.percentile.toFixed(5)
? `${(epss?.max_epss?.percentile * 100).toFixed(3)}%`
: _('N/A')}
</TableData>
</TableRow>
Expand Down Expand Up @@ -246,5 +246,3 @@ NvtDetails.propTypes = {
};

export default NvtDetails;

// vim: set ts=2 sw=2 tw=80:
2 changes: 1 addition & 1 deletion src/web/pages/nvts/filterdialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
},
{
name: 'epss_percentile',
displayName: _('EPSS Percentile'),
displayName: _('EPSS Percentage'),

Check warning on line 78 in src/web/pages/nvts/filterdialog.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/nvts/filterdialog.jsx#L78

Added line #L78 was not covered by tests
},
];

Expand Down
7 changes: 3 additions & 4 deletions src/web/pages/nvts/row.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/


import React from 'react';

import Filter from 'gmp/models/filter.js';
Expand Down Expand Up @@ -100,7 +99,9 @@
{isNumber(epssScore) ? epssScore.toFixed(5) : _('N/A')}
</TableData>
<TableData>
{isNumber(epssPercentile) ? epssPercentile.toFixed(5) : _('N/A')}
{isNumber(epssPercentile)
? `${(epssPercentile * 100).toFixed(3)}%`
: _('N/A')}

Check warning on line 104 in src/web/pages/nvts/row.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/nvts/row.jsx#L104

Added line #L104 was not covered by tests
</TableData>
</>
)}
Expand All @@ -118,5 +119,3 @@
};

export default Row;

// vim: set ts=2 sw=2 tw=80:
4 changes: 1 addition & 3 deletions src/web/pages/nvts/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const Header = ({
currentSortBy={currentSortBy}
sortBy={sort ? 'epss_percentile' : false}
onSortChange={onSortChange}
title={_('Percentile')}
title={_('Percentage')}
/>
</TableRow>
)}
Expand Down Expand Up @@ -169,5 +169,3 @@ export const NvtsTable = createEntitiesTable({
});

export default NvtsTable;

// vim: set ts=2 sw=2 tw=80:
4 changes: 2 additions & 2 deletions src/web/pages/results/__tests__/detailspage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ describe('Result Detailspage tests', () => {
expect(baseElement).toHaveTextContent('Location80/tcp');
expect(baseElement).toHaveTextContent('EPSS (CVE with highest severity)');
expect(baseElement).toHaveTextContent('EPSS Score0.87650');
expect(baseElement).toHaveTextContent('EPSS Percentile0.80000');
expect(baseElement).toHaveTextContent('EPSS Percentage80.000%');
expect(baseElement).toHaveTextContent('CVECVE-2019-1234');
expect(baseElement).toHaveTextContent('CVE Severity5.0 (Medium)');
expect(baseElement).toHaveTextContent('EPSS (highest EPSS score)');
expect(baseElement).toHaveTextContent('EPSS Score0.98760');
expect(baseElement).toHaveTextContent('EPSS Percentile0.90000');
expect(baseElement).toHaveTextContent('EPSS Percentage90.000%');
expect(baseElement).toHaveTextContent('CVECVE-2020-5678');
expect(baseElement).toHaveTextContent('CVE Severity2.0 (Low)');
expect(heading[2]).toHaveTextContent('Summary');
Expand Down
6 changes: 3 additions & 3 deletions src/web/pages/results/__tests__/row.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ describe('Should render EPSS fields', () => {
const {element} = render(
<table>
<tbody>
<Row entity={entity}/>
<Row entity={entity} />
</tbody>
</table>,
);

expect(element).toHaveTextContent("0.87650");
expect(element).toHaveTextContent("0.80000");
expect(element).toHaveTextContent('0.87650');
expect(element).toHaveTextContent('80.000%');
});
});

Expand Down
46 changes: 28 additions & 18 deletions src/web/pages/results/detailspage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
import TicketComponent from '../tickets/component';

import ResultDetails from './details';
import CveLink from "web/components/link/cvelink.jsx";
import Severitybar from "web/components/bar/severitybar.jsx";
import CveLink from 'web/components/link/cvelink.jsx';
import Severitybar from 'web/components/bar/severitybar.jsx';

export const ToolBarIcons = ({
entity,
Expand Down Expand Up @@ -180,8 +180,8 @@
const {notes, overrides, qod, host, userTags} = entity;
const active_notes = notes.filter(active_filter);
const active_overrides = overrides.filter(active_filter);
const epss = entity?.information?.epss
const gmp = useGmp()
const epss = entity?.information?.epss;
const gmp = useGmp();

return (
<React.Fragment>
Expand Down Expand Up @@ -236,7 +236,7 @@
<TableData>{_('Location')}</TableData>
<TableData>{entity.port}</TableData>
</TableRow>
{ gmp.settings.enableEPSS && isDefined(epss?.max_severity) &&
{gmp.settings.enableEPSS && isDefined(epss?.max_severity) && (
<>
<TableData colSpan="2">
<b>{_('EPSS (CVE with highest severity)')}</b>
Expand All @@ -245,14 +245,16 @@
<TableData>{_('EPSS Score')}</TableData>
<TableData>
{isNumber(epss?.max_severity?.score)
? epss?.max_severity?.score.toFixed(5) : _("N/A")}
? epss?.max_severity?.score.toFixed(5)
: _('N/A')}

Check warning on line 249 in src/web/pages/results/detailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/results/detailspage.jsx#L249

Added line #L249 was not covered by tests
</TableData>
</TableRow>
<TableRow>
<TableData>{_('EPSS Percentile')}</TableData>
<TableData>{_('EPSS Percentage')}</TableData>
<TableData>
{isNumber(epss?.max_severity?.percentile)
? epss?.max_severity?.percentile.toFixed(5) : _("N/A")}
? `${(epss?.max_severity?.percentile * 100).toFixed(3)}%`
: _('N/A')}

Check warning on line 257 in src/web/pages/results/detailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/results/detailspage.jsx#L257

Added line #L257 was not covered by tests
</TableData>
</TableRow>
<TableRow>
Expand All @@ -266,13 +268,16 @@
<TableRow>
<TableData>{_('CVE Severity')}</TableData>
<Severitybar
severity={isDefined(epss?.max_severity?.cve?.severity)
? epss?.max_severity?.cve?.severity : _("N/A")}
severity={
isDefined(epss?.max_severity?.cve?.severity)
? epss?.max_severity?.cve?.severity
: _('N/A')

Check warning on line 274 in src/web/pages/results/detailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/results/detailspage.jsx#L274

Added line #L274 was not covered by tests
}
/>
</TableRow>
</>
}
{ gmp.settings.enableEPSS && isDefined(epss?.max_epss) &&
)}
{gmp.settings.enableEPSS && isDefined(epss?.max_epss) && (
<>
<TableData colSpan="2">
<b>{_('EPSS (highest EPSS score)')}</b>
Expand All @@ -281,14 +286,16 @@
<TableData>{_('EPSS Score')}</TableData>
<TableData>
{isNumber(epss?.max_epss?.score)
? epss?.max_epss?.score.toFixed(5) : _("N/A")}
? epss?.max_epss?.score.toFixed(5)
: _('N/A')}

Check warning on line 290 in src/web/pages/results/detailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/results/detailspage.jsx#L290

Added line #L290 was not covered by tests
</TableData>
</TableRow>
<TableRow>
<TableData>{_('EPSS Percentile')}</TableData>
<TableData>{_('EPSS Percentage')}</TableData>
<TableData>
{isNumber(epss?.max_epss?.percentile)
? epss?.max_epss?.percentile.toFixed(5) : _("N/A")}
? `${(epss?.max_epss?.percentile * 100).toFixed(3)}%`
: _('N/A')}

Check warning on line 298 in src/web/pages/results/detailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/results/detailspage.jsx#L298

Added line #L298 was not covered by tests
</TableData>
</TableRow>
<TableRow>
Expand All @@ -303,13 +310,16 @@
<TableData>{_('CVE Severity')}</TableData>
<TableData>
<Severitybar
severity={isDefined(epss?.max_epss?.cve?.severity)
? epss?.max_epss?.cve?.severity : _("N/A")}
severity={
isDefined(epss?.max_epss?.cve?.severity)
? epss?.max_epss?.cve?.severity
: _('N/A')

Check warning on line 316 in src/web/pages/results/detailspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/results/detailspage.jsx#L316

Added line #L316 was not covered by tests
}
/>
</TableData>
</TableRow>
</>
}
)}
</TableBody>
</InfoTable>
</Layout>
Expand Down
4 changes: 1 addition & 3 deletions src/web/pages/results/filterdialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
},
{
name: 'epss_percentile',
displayName: _('EPSS Percentile'),
displayName: _('EPSS Percentage'),

Check warning on line 92 in src/web/pages/results/filterdialog.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/results/filterdialog.jsx#L92

Added line #L92 was not covered by tests
},
];

Expand Down Expand Up @@ -205,5 +205,3 @@
};

export default ResultsFilterDialog;

// vim: set ts=2 sw=2 tw=80:
Loading
Loading