Skip to content

Commit

Permalink
Merge pull request snyk#413 from snyk/uj/refactor-exclude-base-image-…
Browse files Browse the repository at this point in the history
…vulns

fix: Move exclude-base... option to docker plugin
  • Loading branch information
hisenb3rg committed Mar 29, 2019
2 parents caf6bc2 + d9da486 commit 8b6f990
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"recursive-readdir": "^2.2.2",
"semver": "^5.6.0",
"snyk-config": "2.2.1",
"snyk-docker-plugin": "1.22.0",
"snyk-docker-plugin": "1.22.1",
"snyk-go-plugin": "1.6.1",
"snyk-gradle-plugin": "2.4.2",
"snyk-module": "1.9.1",
Expand Down
4 changes: 0 additions & 4 deletions src/lib/snyk-test/run-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ async function runTest(packageManager: string, root: string, options): Promise<o
});
}

if (options.docker && options.file && options['exclude-base-image-vulns']) {
res.vulnerabilities = res.vulnerabilities.filter((vuln) => (vuln.dockerfileInstruction));
}

res.uniqueCount = countUniqueVulns(res.vulnerabilities);

return res;
Expand Down
20 changes: 0 additions & 20 deletions test/acceptance/cli.acceptance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1594,26 +1594,6 @@ test('`test foo:latest --docker --file=Dockerfile remediation advice`', async (t
}
});

test('`test foo:latest --docker --file=Dockerfile --exclude-base-image-vulns`', async (t) => {
stubDockerPluginResponse('./fixtures/docker/plugin-multiple-deps', t);
const vulns = require('./fixtures/docker/find-result-remediation.json');
server.setNextResponse(vulns);

try {
await cli.test('foo:latest', {
docker: true,
org: 'explicit-org',
file: 'Dockerfile',
'exclude-base-image-vulns': true,
});
t.fail('should have found vuln');

} catch (err) {
t.notMatch(err.message, /introduced by your base image/i, 'should exclude base image vulns');
t.match(err.message, /introduced in your dockerfile/i, 'should include vulns introduced by dockerfile');
}
});

test('`test foo:latest --docker` doesnt collect policy from cwd', async (t) => {
chdirWorkspaces('npm-package-policy');
const spyPlugin = stubDockerPluginResponse({
Expand Down

0 comments on commit 8b6f990

Please sign in to comment.