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.2
GitHub 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_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, in part, accomplished by resolving dependency specifiers defined in
package.json
manifests 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_modules
hierarchy. 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-a
could define a dependency in theirpackage.json
file such as"foo": "file:/some/path"
. Another package,pwn-b
could define a dependency such asFOO: "file:foo.tgz"
. On case-insensitive file systems, ifpwn-a
was installed, and thenpwn-b
was installed afterwards, the contents offoo.tgz
would be written to/some/path
, and any existing contents of/some/path
would 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:
children
map 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.json
already 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 update
to rebuild your tree and generate a newpackage-lock.json
file.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_modules
folder.If the
node_modules
folder 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_modules
symbolic link would have to be employed.preinstall
script could replacenode_modules
with a symlink. (This is prevented by using--ignore-scripts
.)npm install --ignore-scripts
in the root. This may be successful, becausenpm install --ignore-scripts
is 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 install
on untrusted codebases, without first ensuring that thenode_modules
directory in the project is not a symbolic link.Fix
Prior to extracting any package contents, the
node_modules
folder 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_modules
folder in order to share dependencies between projects, then that will no longer be possible. Please use thenpm link
command, explicitfile:...
dependencies, and/orworkspaces
to 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.