-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: default limit to max vulnerable paths per vuln, add override option
In CLI-261 an out-of-memory condition occurs when trying to report SCA findings on a container test. This happens due to an unusually large number of dependency paths to some vulnerabilities. Such a large number of paths is unlikely to be useful or helpful. If the user has specifically requested all vulnerable paths with --show-vulnerable-paths=all, this takes precedence and the limit is ignored. Otherwise the user may opt-in to limiting the max number of vulnerable paths with --max-vulnerable-paths=N.
- Loading branch information
Showing
4 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
test/jest/unit/cli/commands/test/set-default-test-options.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { setDefaultTestOptions } from '../../../../../../src/cli/commands/test/set-default-test-options'; | ||
|
||
describe('setDefaultTestOptions', () => { | ||
it('default options', () => { | ||
const options = {}; | ||
const result = setDefaultTestOptions(options as any); | ||
expect(result.showVulnPaths).toEqual('some'); | ||
expect(result.maxVulnPaths).toBeUndefined(); | ||
}); | ||
|
||
it('explicit max-vulnerable-paths', () => { | ||
const options = { 'max-vulnerable-paths': 42 }; | ||
const result = setDefaultTestOptions(options as any); | ||
expect(result.showVulnPaths).toEqual('some'); | ||
expect(result.maxVulnPaths).toEqual(42); | ||
}); | ||
|
||
it('explicit show-vulnerable-paths', () => { | ||
const options = { 'show-vulnerable-paths': 'all' }; | ||
const result = setDefaultTestOptions(options as any); | ||
expect(result.showVulnPaths).toEqual('all'); | ||
expect(result.maxVulnPaths).toBeUndefined(); | ||
}); | ||
}); |