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

[pull] master from snyk:master #136

Merged
merged 2 commits into from
Jan 15, 2022
Merged
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
11 changes: 1 addition & 10 deletions src/lib/formatters/legacy-format-issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Options, TestOptions, ShowVulnPaths } from '../../lib/types';
import { isLocalFolder } from '../../lib/detect';
import { parsePackageString as snykModule } from 'snyk-module';
import {
WIZARD_SUPPORTED_PACKAGE_MANAGERS,
PINNING_SUPPORTED_PACKAGE_MANAGERS,
SupportedPackageManagers,
} from '../../lib/package-managers';
Expand Down Expand Up @@ -195,11 +194,6 @@ function createRemediationText(
vuln: GroupedVuln,
packageManager: SupportedPackageManagers,
): string {
let wizardHintText = '';
if (WIZARD_SUPPORTED_PACKAGE_MANAGERS.includes(packageManager)) {
wizardHintText = 'Run `snyk wizard` to explore remediation options.';
}

if (
vuln.fixedIn &&
PINNING_SUPPORTED_PACKAGE_MANAGERS.includes(packageManager)
Expand Down Expand Up @@ -250,10 +244,7 @@ function createRemediationText(
return `Upgrade direct dependency ${v.from[1]} to ${v.upgradePath[1]}${upgradeTextInfo}`;
}

return (
'Some paths have no direct dependency upgrade that' +
` can address this issue. ${wizardHintText}`
);
return 'Some paths have no direct dependency upgrade that can address this issue.';
}),
);
return chalk.bold(
Expand Down
5 changes: 0 additions & 5 deletions src/lib/formatters/show-fix-tip.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import chalk from 'chalk';

import { isLocalFolder } from '../detect';
import { WIZARD_SUPPORTED_PACKAGE_MANAGERS } from '../package-managers';
import { TestResult } from '../snyk-test/legacy';
import { Options, SupportedProjectTypes, TestOptions } from '../types';

Expand All @@ -10,10 +9,6 @@ export function showFixTip(
res: TestResult,
options: TestOptions & Options,
): string {
if (WIZARD_SUPPORTED_PACKAGE_MANAGERS.includes(projectType)) {
return `Tip: Run ${chalk.bold('`snyk wizard`')} to address these issues.`;
}

const snykFixSupported: SupportedProjectTypes[] = ['pip', 'poetry'];
if (!snykFixSupported.includes(projectType) || !isLocalFolder(options.path)) {
return '';
Expand Down
19 changes: 0 additions & 19 deletions test/jest/unit/lib/formatters/show-fix-tip.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,6 @@ import stripAnsi from 'strip-ansi';
import { getFixturePath } from '../../../util/getFixturePath';

describe('showFixTip', () => {
test.each(['yarn', 'npm'])('%p shows `snyk wizard` tip', (p) => {
const withRemediation = JSON.parse(
fs.readFileSync(
getFixturePath(
'npm-package-with-severity-override/test-graph-result-patches.json',
),
'utf8',
),
);
expect(
stripAnsi(
showFixTip(p as SupportedProjectTypes, withRemediation, {
path: 'src',
showVulnPaths: 'none',
}),
),
).toBe('Tip: Run `snyk wizard` to address these issues.');
});

test.each(['pip', 'poetry'])('%p shows `snyk fix` tip', (p) => {
const withRemediation = JSON.parse(
fs.readFileSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Testing src...
From: git@2.18.2-r0 > expat@2.2.5-r0
Remediation:
Upgrade direct dependency expat@2.2.5-r0 to expat@2.2.7-r0 (triggers upgrades to expat@2.2.7-r0)
Some paths have no direct dependency upgrade that can address this issue.
Some paths have no direct dependency upgrade that can address this issue.
Fixed in: 2.2.7-r0

✗ High severity vulnerability found in expat
Expand All @@ -32,7 +32,7 @@ Testing src...
From: git@2.18.2-r0 > expat@2.2.5-r0
Remediation:
Upgrade direct dependency expat@2.2.5-r0 to expat@2.2.7-r1 (triggers upgrades to expat@2.2.7-r1)
Some paths have no direct dependency upgrade that can address this issue.
Some paths have no direct dependency upgrade that can address this issue.
Fixed in: 2.2.7-r1


Expand Down Expand Up @@ -72,7 +72,7 @@ Testing src...
From: git@2.18.2-r0 > expat@2.2.5-r0
Remediation:
Upgrade direct dependency expat@2.2.5-r0 to expat@2.2.7-r0 (triggers upgrades to expat@2.2.7-r0)
Some paths have no direct dependency upgrade that can address this issue.
Some paths have no direct dependency upgrade that can address this issue.
Fixed in: 2.2.7-r0

✗ High severity vulnerability found in expat
Expand All @@ -84,7 +84,7 @@ Testing src...
From: git@2.18.2-r0 > expat@2.2.5-r0
Remediation:
Upgrade direct dependency expat@2.2.5-r0 to expat@2.2.7-r1 (triggers upgrades to expat@2.2.7-r1)
Some paths have no direct dependency upgrade that can address this issue.
Some paths have no direct dependency upgrade that can address this issue.
Fixed in: 2.2.7-r1


Expand Down Expand Up @@ -186,7 +186,7 @@ Testing src...
From: git@2.18.2-r0 > expat@2.2.5-r0
Remediation:
Upgrade direct dependency expat@2.2.5-r0 to expat@2.2.7-r0 (triggers upgrades to expat@2.2.7-r0)
Some paths have no direct dependency upgrade that can address this issue.
Some paths have no direct dependency upgrade that can address this issue.
Fixed in: 2.2.7-r0

✗ High severity vulnerability found in expat
Expand All @@ -198,7 +198,7 @@ Testing src...
From: git@2.18.2-r0 > expat@2.2.5-r0
Remediation:
Upgrade direct dependency expat@2.2.5-r0 to expat@2.2.7-r1 (triggers upgrades to expat@2.2.7-r1)
Some paths have no direct dependency upgrade that can address this issue.
Some paths have no direct dependency upgrade that can address this issue.
Fixed in: 2.2.7-r1


Expand Down Expand Up @@ -300,8 +300,6 @@ Project name: shallow-goof
Open source: no
Project path: src

Tip: Run \`snyk wizard\` to address these issues.

Tip: Detected multiple supported manifests (3), use --all-projects to scan all of them at once."
`;

Expand Down