Allowlisted advisories still included in output
Maybe I am missing something but I don't know what.
We have the following audit-ci.jsonc:
{
"$schema": "https://github.com/IBM/audit-ci/raw/main/docs/schema.json",
"critical": true,
"high": true,
"allowlist": [
"GHSA-fjxv-7rqg-78g4|request>form-data>",
"GHSA-fjxv-7rqg-78g4|request-promise-native>request-promise-core>request>form-data"
]
}
When we now run audit-ci like this, I would expect moderate advisories and the advisory GHSA-fjxv-7rqg-78g4 to be excluded from the output, but they are not:
$ npx audit-ci@^7 --config ./audit-ci.jsonc
NPM audit report results:
{
"advisories": {
"form-data": {
"name": "form-data",
"severity": "critical",
"isDirect": false,
"via": [
{
"source": 1109540,
"name": "form-data",
"dependency": "form-data",
"title": "form-data uses unsafe random function in form-data for choosing boundary",
"url": "https://github.com/advisories/GHSA-fjxv-7rqg-78g4",
"severity": "critical",
"cwe": [
"CWE-330"
],
"cvss": {
"score": 0,
"vectorString": null
},
"range": "<2.5.4"
}
],
"effects": [
"request"
],
"range": "<2.5.4",
"nodes": [
"node_modules/request/node_modules/form-data"
],
"fixAvailable": {
"name": "request-promise-native",
"version": "1.0.5",
"isSemVerMajor": true
}
},
"request": {
"name": "request",
"severity": "critical",
"isDirect": true,
"via": [
{
"source": 1096727,
"name": "request",
"dependency": "request",
"title": "Server-Side Request Forgery in Request",
"url": "https://github.com/advisories/GHSA-p8p7-x288-28g6",
"severity": "moderate",
"cwe": [
"CWE-918"
],
"cvss": {
"score": 6.1,
"vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
},
"range": "<=2.88.2"
},
"form-data",
"tough-cookie"
],
"effects": [
"request-promise-core",
"request-promise-native"
],
"range": "*",
"nodes": [
"node_modules/request"
],
"fixAvailable": {
"name": "request-promise-native",
"version": "1.0.5",
"isSemVerMajor": true
}
}
},
"metadata": {
"vulnerabilities": {
"info": 0,
"low": 12,
"moderate": 8,
"high": 0,
"critical": 2,
"total": 22
},
"dependencies": {
"prod": 2118,
"dev": 1337,
"optional": 480,
"peer": 25,
"peerOptional": 0,
"total": 3842
}
}
}
Passed npm security audit.
It does not matter if I add --show-found false to the arguments (or in the config), the result is still the same.
Is this a bug or am I missing something?
I encountered a similar issue, and i think this is an intractable problem with how npm audit collates and returns its results. Basically, because there are the lower priority vulnerabilities in transitive dependencies of form-data (likely it's the vulnerability with tough-cookie, which which affect the wider version range than the critical vulnerability for form-data, so audit-ci concludes that the critical vulnerability affects all installed versions of form-data, as that's what the underlying npm audit backend returns.
My short term solution is to just allowlist all instances of the relevant vulnerability, and eventually i will need to migrate to pnpm or another alternative. Otherwise, audit-ci would have to reimplement and maintain a customized version of the npm audit command in order to aggregate metavulnerabilities more cleanly.
The JSON output will always include allowlisted entries, it's mostly just the output from npm audit --json with a bit of cleanup.