mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-11-23 09:20:51 +03:00
`nvm debug` ran `npm config get prefix` in `$PWD`, so npm applied the untrusted project `.npmrc`. Its `logs-dir` chose where npm wrote its debug log, and npm 11 copies unknown keys into that log verbatim, so `logs-dir=~/.bashrc.d` plus a `$(...)` key runs a command in the next shell on Fedora-style setups. Its `userconfig` makes npm 11 echo the lines of any file into the log and into the `nvm debug` output. `-g` is not enough: npm v7 through v8.2 load the project `.npmrc` even in global mode. Add `nvm_npm`, which runs npm from `/`, and use it for both npm commands. `$NVM_CD_FLAGS` is not used, since a zsh parent exports `-q` to bash and sh children. Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-ZF4UWQNS.