package.json local path traversal working with Node 19, not with Node < 19 #46270
Labels
npm
Issues and PRs related to the npm client dependency or the npm registry.
wrong repo
Issues that should be opened in another repository.
Version
18.13.0 and below
Platform
Ubuntu 22.04.1
What steps will reproduce the bug?
Demo: https://github.com/tkrotoff/node18-local-path-traversal-issue
CI: https://github.com/tkrotoff/node18-local-path-traversal-issue/actions
package.json local path traversal working with Node 19, not with Node < 19
Node.js 19 copies the local path to node_modules (correct), Node.js < 19 does not (incorrect) and references directly the parent folder.
Demo structure:
"node18-local-path-traversal-issue": "file:.."
With Node.js 19, webpack + @babel/preset-env
useBuiltIns: 'usage'
browses the parent folder correctlyWith Node.js < 19, webpack + @babel/preset-env
useBuiltIns: 'usage'
fails to browse parent folder correctlyOutput with Node.js 19.4.0 (OK), references
/subfolder/node_modules/node18-local-path-traversal-issue/index.js
:Output with Node.js 18.13.0 (KO), references
/index.js
instead of/subfolder/node_modules/node18-local-path-traversal-issue/index.js
:How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
Node.js < 19 should work like Node.js 19
What do you see instead?
Node.js < 19 references
/index.js
instead of/subfolder/node_modules/node18-local-path-traversal-issue/index.js
Additional information
No response
The text was updated successfully, but these errors were encountered: