chore(deps): update dependency @npmcli/arborist to 2.8.2 [security] - abandoned #108
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
2.2.9->2.8.2GitHub Vulnerability Alerts
CVE-2021-39134
Impact
Arbitrary File Creation, Arbitrary File Overwrite, Arbitrary Code Execution
@npmcli/arborist, the library that calculates dependency trees and manages thenode_modulesfolder hierarchy for the npm command line interface, aims to guarantee that package dependency contracts will be met, and the extraction of package contents will always be performed into the expected folder.This is, in part, accomplished by resolving dependency specifiers defined in
package.jsonmanifests for dependencies with a specific name, and nesting folders to resolve conflicting dependencies.When multiple dependencies differ only in the case of their name, Arborist's internal data structure saw them as separate items that could coexist within the same level in the
node_moduleshierarchy. However, on case-insensitive file systems (such as macOS and Windows), this is not the case. Combined with a symlink dependency such asfile:/some/path, this allowed an attacker to create a situation in which arbitrary contents could be written to any location on the filesystem.For example, a package
pwn-acould define a dependency in theirpackage.jsonfile such as"foo": "file:/some/path". Another package,pwn-bcould define a dependency such asFOO: "file:foo.tgz". On case-insensitive file systems, ifpwn-awas installed, and thenpwn-bwas installed afterwards, the contents offoo.tgzwould be written to/some/path, and any existing contents of/some/pathwould be removed.Anyone using npm v7.20.6 or earlier on a case-insensitive filesystem is potentially affected.
Patches
2.8.2 (included in npm v7.20.7 and above)
Fix and Caveats
There are two parts to the fix:
childrenmap that represents child nodes in the tree is replaced with a case-insensitive map object, such thatnode.children.get('foo')andnode.children.get('FOO')will return the same object, enabling Arborist to detect and handle this class of tree collision.This second item imposes a caveat on case sensitive filesystems where two packages with names which differ only in case may already exist at the same level in the tree, causing unpredictable behavior in this rare edge case. Note that in such cases, the
package-lock.jsonalready creates a situation which is hazardous to use on case-sensitive filesystems, and will likely lead to other problems.If affected by this caveat, please run
npm updateto rebuild your tree and generate a newpackage-lock.jsonfile.CVE-2021-39135
Impact
Arbitrary File Creation, Arbitrary File Overwrite, Arbitrary Code Execution
@npmcli/arborist, the library that calculates dependency trees and manages the node_modules folder hierarchy for the npm command line interface, aims to guarantee that package dependency contracts will be met, and the extraction of package contents will always be performed into the expected folder.This is accomplished by extracting package contents into a project's
node_modulesfolder.If the
node_modulesfolder of the root project or any of its dependencies is somehow replaced with a symbolic link, it could allow Arborist to write package dependencies to any arbitrary location on the file system.Note that symbolic links contained within package artifact contents are filtered out, so another means of creating a
node_modulessymbolic link would have to be employed.preinstallscript could replacenode_moduleswith a symlink. (This is prevented by using--ignore-scripts.)npm install --ignore-scriptsin the root. This may be successful, becausenpm install --ignore-scriptsis typically not capable of making changes outside of the project directory, so it may be deemed safe.Patches
2.8.2 (included in npm v7.20.7 and above)
Workarounds
Do not run
npm installon untrusted codebases, without first ensuring that thenode_modulesdirectory in the project is not a symbolic link.Fix
Prior to extracting any package contents, the
node_modulesfolder into which it is extracted is verified to be a real directory. If it is not, then it is removed.Caveat: if you are currently relying on creating a symbolic link to the
node_modulesfolder in order to share dependencies between projects, then that will no longer be possible. Please use thenpm linkcommand, explicitfile:...dependencies, and/orworkspacesto share dependencies in a development environment.Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.