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

Filtering of vulnerabilities #26

Closed
wants to merge 5 commits into from
Closed

Conversation

welwood08
Copy link
Contributor

This PR is my attempt to implement filtering of reported vulnerabilities based on various configurable parameters. I realise this is fairly sizeable and I might be touching too much, so please feel free to suggest areas that could be split into independent PRs, simplified, improved, done differently, squashed, etc.

Currently this implements #13 and npm/npm#20564.
I'd also like to implement npm/npm#20565 (making full use of things like paths, not just the advisory ID), but I'm looking for input from others on which information will be stored in package.json and its structure.
Once the dust has settled here, I'll send a complementary PR to the cli repo for the changes needed there.

Move functions used in multiple reporters into lib/utils.
Determine exit code in a consistent way across reporters that use an exit code.
Reduce levels of indentation and duplicated code in the more complex reporters.
The passed config object can now specify the booleans `excludeDev` and `excludeProd` to hide vulnerabilities affecting only those kinds of dependency. The default in both cases is false to preserve previous behaviour.
Prerequisite for npm/npm#20564.
The passed config object can now specify the string `severityThreshold` to hide less severe vulnerabilities. The (already-present) default 'info' threshold preserves the previous behaviour.
Implements npm#13.
The actual number of vulnerabilities of each severity did not match the counters in the metadata.
Made up enough new data using existing data as a template so actual numbers match the existing metadata numbers.
@isaacs
Copy link
Contributor

isaacs commented May 8, 2020

Closing out all issues and PRs from 2018 and 2019, since this module has been fundamentally refactored for version 2 (npm version 7). Happy to reopen if this is still a thing worth exploring (and it'll probably be easier now if so).

If we're going to add fancy filtering stuff like this, probably the best approach is to go through the rfc process. Post an issue or PR over on https://github.com/npm/rfcs and we can run through the discussion process. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants