Closed
Description
Hi all, I'm opening this issue to propose a way of automatically checking Node's dependencies for new vulnerabilities, as part of CI.
The idea is to query both the NVD and the GH Advisory Database with Node's direct dependencies (the ones here) and have a GH action fail in case any new vulnerabilities are found.
I have a working POC in the form of a Python script that:
- Has a list of the current dependencies, and the names to use when querying the NVD database (their Common Platform Enumeration)
- Goes through the
deps/
folder, parsing the current version of each of the dependencies - Queries the NVD using the CPE with the parsed version, to see if there are any active vulnerabilities
- Queries the GH Advisory Database for the deps that are NPM packages
- Filters the found vulnerabilities using an "ignore" list, that contains known false-positives
- Exits successfully if no vulnerabilities are found. Otherwise, it fails and prints a message like:
WARNING: New vulnerabilities found
- npm (version 1.2.1) :
- GHSA-v3jv-wrf4-5845: https://github.com/advisories/GHSA-v3jv-wrf4-5845
- GHSA-93f3-23rq-pjfp: https://github.com/advisories/GHSA-93f3-23rq-pjfp
- GHSA-m6cx-g6qm-p2cx: https://github.com/advisories/GHSA-m6cx-g6qm-p2cx
- GHSA-4328-8hgf-7wjr: https://github.com/advisories/GHSA-4328-8hgf-7wjr
- GHSA-x8qc-rrcw-4r46: https://github.com/advisories/GHSA-x8qc-rrcw-4r46
- GHSA-m5h6-hr3q-22h5: https://github.com/advisories/GHSA-m5h6-hr3q-22h5
- acorn (version 6.0.0) :
- GHSA-6chw-6frg-f759: https://github.com/advisories/GHSA-6chw-6frg-f759
For each dependency and vulnerability, check the following:
- Check the vulnerability's description to see if it applies to the dependency as
used by Node. If not, the vulnerability ID (either a CVE or a GHSA) can be added to the ignore list in
dependencies.py. IMPORTANT: Only do this if certain that the vulnerability found is a false positive.
- Otherwise, the vulnerability found must be remediated by updating the dependency in the Node repo to a
non-affected version.
If anyone has any comments or suggestions about the approach, please feel free to comment. Also, let me know if I should open a PR with the script in the public Node repo.