Skip to content

Commit

Permalink
feat: drop pinning flag
Browse files Browse the repository at this point in the history
  • Loading branch information
lili2311 committed Dec 27, 2019
1 parent 74a6c33 commit cf17af6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 55 deletions.
8 changes: 1 addition & 7 deletions src/cli/commands/test/formatters/legacy-format-issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ export function formatIssues(
extraInfo: vuln.note ? chalk.bold('\n Note: ' + vuln.note) : '',
remediationInfo:
vuln.metadata.type !== 'license' && localPackageTest
? createRemediationText(
vuln,
packageManager,
!!options.pinningSupported,
)
? createRemediationText(vuln, packageManager)
: '',
fixedIn: options.docker ? createFixedInText(vuln) : '',
dockerfilePackage: options.docker ? dockerfileInstructionText(vuln) : '',
Expand Down Expand Up @@ -174,15 +170,13 @@ function createFixedInText(vuln: GroupedVuln): string {
function createRemediationText(
vuln: GroupedVuln,
packageManager: SupportedPackageManagers,
pinningSupported: boolean,
): string {
let wizardHintText = '';
if (WIZARD_SUPPORTED_PACKAGE_MANAGERS.includes(packageManager)) {
wizardHintText = 'Run `snyk wizard` to explore remediation options.';
}

if (
pinningSupported &&
vuln.fixedIn &&
PINNING_SUPPORTED_PACKAGE_MANAGERS.includes(packageManager)
) {
Expand Down
6 changes: 1 addition & 5 deletions src/cli/commands/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,10 @@ async function test(...args: MethodArgs): Promise<string> {
throw err;
}

const pipResults: LegacyVulnApiResult = results.find(
const pinningSupported: LegacyVulnApiResult = results.find(
(res) => res.packageManager === 'pip',
);

const pinningSupported =
pipResults &&
(await isFeatureFlagSupportedForOrg('pythonPinningAdvice', config.org)).ok;

let response = results
.map((unused, i) => {
resultOptions[i].pinningSupported = pinningSupported;
Expand Down
1 change: 0 additions & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export interface TestOptions {
interactive: boolean;
'prune-repeated-subdependencies'?: boolean;
showVulnPaths: ShowVulnPaths;
pinningSupported?: boolean;
failOn?: FailOn;
}
export interface ProtectOptions {
Expand Down
47 changes: 5 additions & 42 deletions test/acceptance/cli-test/cli-test.python.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,7 @@ export const PythonTests: AcceptanceTests = {
await params.cli.test('pip-app', {
file: 'requirements.txt',
});
let req = params.server.popRequest();
t.equal(req.method, 'GET', 'makes GET request');
t.match(
req.url,
'cli-config/feature-flags/pythonPinningAdvice',
'to correct url',
);
req = params.server.popRequest();
const req = params.server.popRequest();
t.equal(req.method, 'POST', 'makes POST request');
t.equal(
req.headers['x-snyk-cli-version'],
Expand Down Expand Up @@ -86,14 +79,7 @@ export const PythonTests: AcceptanceTests = {
await params.cli.test('pipenv-app', {
file: 'Pipfile',
});
let req = params.server.popRequest();
t.equal(req.method, 'GET', 'makes GET request');
t.match(
req.url,
'cli-config/feature-flags/pythonPinningAdvice',
'to correct url',
);
req = params.server.popRequest();
const req = params.server.popRequest();
t.equal(req.method, 'POST', 'makes POST request');
t.equal(
req.headers['x-snyk-cli-version'],
Expand Down Expand Up @@ -152,14 +138,7 @@ export const PythonTests: AcceptanceTests = {
fs.readFileSync('pip-app-transitive-vuln/cli-output.txt', 'utf8'),
);
}
let req = params.server.popRequest();
t.equal(req.method, 'GET', 'makes GET request');
t.match(
req.url,
'cli-config/feature-flags/pythonPinningAdvice',
'to correct url',
);
req = params.server.popRequest();
const req = params.server.popRequest();
t.equal(req.method, 'POST', 'makes POST request');
t.equal(
req.headers['x-snyk-cli-version'],
Expand Down Expand Up @@ -220,14 +199,7 @@ export const PythonTests: AcceptanceTests = {
),
);
}
let req = params.server.popRequest();
t.equal(req.method, 'GET', 'makes GET request');
t.match(
req.url,
'cli-config/feature-flags/pythonPinningAdvice',
'to correct url',
);
req = params.server.popRequest();
const req = params.server.popRequest();
t.equal(req.method, 'POST', 'makes POST request');
t.equal(
req.headers['x-snyk-cli-version'],
Expand Down Expand Up @@ -278,16 +250,7 @@ export const PythonTests: AcceptanceTests = {
file: 'setup.py',
});

let req = params.server.popRequest();

t.equal(req.method, 'GET', 'makes GET request');
t.match(
req.url,
'cli-config/feature-flags/pythonPinningAdvice',
'to correct url',
);

req = params.server.popRequest();
const req = params.server.popRequest();
t.equal(req.method, 'POST', 'makes POST request');
t.equal(
req.headers['x-snyk-cli-version'],
Expand Down

0 comments on commit cf17af6

Please sign in to comment.