Skip to content

Commit

Permalink
Merge pull request #1760 from snyk/feat/support-critical-in-sarif
Browse files Browse the repository at this point in the history
feat: add critical severity support for sarif output format
  • Loading branch information
admons committed Mar 29, 2021
2 parents 9ed99f3 + 30fbd0e commit f14819f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/cli/commands/test/open-source-sarif-output.ts
Expand Up @@ -117,6 +117,7 @@ export function getResults(testResult): sarif.Result[] {

export function getLevel(vuln: AnnotatedIssue) {
switch (vuln.severity) {
case SEVERITY.CRITICAL:
case SEVERITY.HIGH:
return 'error';
case SEVERITY.MEDIUM:
Expand Down
3 changes: 2 additions & 1 deletion test/jest/unit/sarif.spec.ts
Expand Up @@ -11,6 +11,7 @@ describe('createSarifOutputForOpenSource', () => {
expect(run.tool.driver.name).toEqual('Snyk Open Source');
expect(run.tool.driver.rules).toHaveLength(1);
expect(run.results).toHaveLength(1);
expect(run.results?.[0].level === 'error');
});

describe('replace lock-file to manifest-file', () => {
Expand Down Expand Up @@ -63,7 +64,7 @@ function getTestResult(testResultOverride = {}, vulnOverride = {}): TestResult {
semver: {
vulnerable: ['<6.12.3'],
},
severity: SEVERITY.HIGH,
severity: SEVERITY.CRITICAL,
title: 'Prototype Pollution',
from: [
'PROJECT_NAME@1.0.0',
Expand Down

0 comments on commit f14819f

Please sign in to comment.