Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
When using the overrides
feature to mitigate a vulnerable transient dependency, the version number of the overridden package is not updated in the packages
section of the lockfile.
Example
Excerpt from package.json
"dependencies": {
"svg2sprite-cli": "^2.0.1"
},
"overrides": {
"trim-newlines": "^3.0.1"
}
Excerpt from package-lock.json in packages > node-modules/meow > dependencies
"trim-newlines": "^1.0.0"
This entry seems to raise a false-positive in a tool we use for checking for vulnerable dependencies.
Expected Behavior
I expect the vulnerable version no longer to appear in the lock file after it was overwritten.
In case this is actually intended behavior, is there any technical documentation on how the overrides
feature should affect the contents of the lockfile?
Steps To Reproduce
- On a local development machine, run
npm install
for the package.json file below. - Inspect the lockfile at
packages > node-modules/meow > dependencies > trim-newlines
{
"name": "npm-overrides-issue",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"svg2sprite-cli": "^2.0.1"
},
"overrides": {
"trim-newlines": "^3.0.1"
}
}
Environment
- npm: 8.6.0 and 8.5.5
- Node.js: v16.14.0
- OS Name: macOS
- System Model Name: MacBook Pro 2021
- npm config:
; "user" config from /Users/redacted/.npmrc
; redacted: custom registry configuration for internal dependencies, not related
; node bin location = /Users/redacted/.nvm/versions/node/v16.14.0/bin/node
; cwd = /Users/redacted/dev/npm-overrides-issue
; HOME = /Users/redacted
; Run `npm config ls -l` to show all defaults.