$ npm -v
11.14.1
npm audit fix --dry-run --json
change @tootallnate/once 2.0.0 => 2.0.1
{
"add": [],
"added": 0,
"audited": 2,
"change": [
{
"from": {
"name": "@tootallnate/once",
"version": "2.0.0",
"path": "/Users/oliver.byford/Code/npm-sandbox/node_modules/@tootallnate/once"
},
"to": {
"name": "@tootallnate/once",
"version": "2.0.1",
"path": "/Users/oliver.byford/Code/npm-sandbox/node_modules/@tootallnate/once"
}
}
],
"changed": 1,
"funding": 0,
"remove": [],
"removed": 0,
"audit": {
"auditReportVersion": 2,
"vulnerabilities": {
"@tootallnate/once": {
"name": "@tootallnate/once",
"severity": "low",
"isDirect": false,
"via": [
{
"source": 1113977,
"name": "@tootallnate/once",
"dependency": "@tootallnate/once",
"title": "@tootallnate/once vulnerable to Incorrect Control Flow Scoping",
"url": "https://github.com/advisories/GHSA-vpq2-c234-7xj6",
"severity": "low",
"cwe": [
"CWE-705"
],
"cvss": {
"score": 3.3,
"vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L"
},
"range": "<3.0.1"
}
],
"effects": [],
"range": "<3.0.1",
"nodes": [
""
],
"fixAvailable": {
"name": "@tootallnate/once",
"version": "3.0.1",
"isSemVerMajor": true
}
}
},
"metadata": {
"vulnerabilities": {
"info": 0,
"low": 1,
"moderate": 0,
"high": 0,
"critical": 0,
"total": 1
},
"dependencies": {
"prod": 2,
"dev": 0,
"optional": 0,
"peer": 0,
"peerOptional": 0,
"total": 1
}
}
}
}
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Using
@toolnate/onceas an example, starting with 2.0.0 installed.@toolnate/oncehas a vulnerability which is only fixed by updating to 3.0.1 (requiring the use ofnpm audit fix --force.However running
npm audit fixwith no--forceflag results in@toolnate/oncebeing updated from 2.0.0 to 2.0.1, despite the fact this does not resolve the vulnerability.Expected Behavior
I would expect
npm audit fixonly to make changes to installed packages where those changes resolve the vulnerabilities shown when runningnpm audit.Steps To Reproduce
npm install @tootallnate/once@2.0.0npm auditand note that the only vulnerability listed requires a major semver change and is shown as needingnpm audit fix --forceto resolve itnpm audit fix --longand note the unexpectedchange @tootallnate/once 2.0.0 => 2.0.1npm audit fix --dry-run --jsonoutputEnvironment