Skip to content

Commit

Permalink
feat: adds support for critical severity [APOLLO-91]
Browse files Browse the repository at this point in the history
  • Loading branch information
thisislawatts committed May 10, 2021
1 parent da933ee commit 886017e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/vuln.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as _ from '@snyk/lodash';
import { PatchRemediation, UpgradeRemediation, Vuln } from './types';

export const severityMap = { low: 0, medium: 1, high: 2 };
export const severityMap = { low: 0, medium: 1, high: 2, critical: 3 };

function getVuln(id, vulnerabilities: any): Vuln {
const vuln = vulnerabilities.find((v) => v.id === id);
Expand Down
7 changes: 6 additions & 1 deletion test/vuln.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ test('getSeverityScore with data length 1', async (t) => {
test('getSeverityScore with multiple vulns', async (t) => {
// Arrange
const vulnerabilities = [
{
id: 'npm:adm-zip:20180415',
severity: 'critical',
title: 'Arbitrary File Write via Archive Extraction (Zip Slip)',
},
{
id: 'npm:adm-zip:20180415',
severity: 'high',
Expand All @@ -102,7 +107,7 @@ test('getSeverityScore with multiple vulns', async (t) => {
title: 'Arbitrary File Write via Archive Extraction (Zip Slip)',
},
];
const expected = 6;
const expected = 10;
// Act
const result = getSeverityScore(vulnerabilities);
// Assert
Expand Down

0 comments on commit 886017e

Please sign in to comment.