Skip to content

Commit

Permalink
feat: adds support for critical severity
Browse files Browse the repository at this point in the history
  • Loading branch information
thisislawatts authored and karenyavine committed Feb 16, 2021
1 parent edf422e commit cc8730e
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cli/commands/protect/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ function createSeverityBasedIssueHeading(msg: string, severity: SEVERITY) {
return chalk.bold.red(text);
},
},
critical: {
colorFunc(text) {
return chalk.bold.magenta(text);
},
},
};
return severitiesColourMapping[severity].colorFunc(msg);
}
Expand Down
5 changes: 5 additions & 0 deletions src/cli/commands/test/formatters/legacy-format-issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ function createSeverityBasedIssueHeading({
return chalk.bold.red(text);
},
},
critical: {
colorFunc(text) {
return chalk.bold.magenta(text);
},
},
};

let originalSeverityStr = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@ export function formatIssue(
return chalk.redBright(text);
},
},
critical: {
colorFunc(text) {
return chalk.magentaBright(`🚨` + text + ` 🚨 `);
},
},
};
const newBadge = isNew ? ' (new)' : '';
const name = vulnerableModule ? ` in ${chalk.bold(vulnerableModule)}` : '';
Expand Down
5 changes: 5 additions & 0 deletions src/cli/commands/test/iac-output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ function formatIacIssue(
return chalk.redBright(text);
},
},
critical: {
colorFunc(text) {
return chalk.magentaBright(text);
},
},
};
const newBadge = isNew ? ' (new)' : '';
const name = issue.subType ? ` in ${chalk.bold(issue.subType)}` : '';
Expand Down
5 changes: 5 additions & 0 deletions src/lib/snyk-test/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export enum SEVERITY {
LOW = 'low',
MEDIUM = 'medium',
HIGH = 'high',
CRITICAL = 'critical',
}
export const SEVERITIES: Array<{
verboseName: SEVERITY;
Expand All @@ -41,6 +42,10 @@ export const SEVERITIES: Array<{
verboseName: SEVERITY.HIGH,
value: 3,
},
{
verboseName: SEVERITY.CRITICAL,
value: 4,
},
];

export enum FAIL_ON {
Expand Down
1 change: 1 addition & 0 deletions src/lib/snyk-test/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export enum SEVERITY {
LOW = 'low',
MEDIUM = 'medium',
HIGH = 'high',
CRITICAL = 'critical',
}

export enum REACHABILITY {
Expand Down

0 comments on commit cc8730e

Please sign in to comment.