[BUG] npm exec reports ECOMPROMISED when virtiofs changes the lock directory inode
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 49/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, node.js
Línea de trabajo
Start with libnpmexec/lib/with-lock.js, especially the inode check described in the report, and trace how it behaves during a real reify workload on virtiofs. Compare the lock-directory identity checks with the documented NFS support and the reported virtiofs trace. Done means npm exec no longer falsely reports ECOMPROMISED for an unchanged lock directory while still detecting actual compromise; verify with the provided Docker reproduction.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Is there an existing issue for this?
- I have searched the existing issues
Related but distinct: #8710 fixed overlapping stat calls by changing the lock maintenance loop from setInterval to setTimeout. The current implementation contains that fix; this report is an inode-identity failure.
This issue exists in the latest npm version
- I am using the latest npm
Reproduced with npm 12.2.0 immediately before filing.
This is not just a request to bump a dependency for a CVE
- This is not solely a request to bump a dependency for a CVE
Current Behavior
On Docker Desktop for macOS, npx fails with ECOMPROMISED: Lock compromised when npm's cache is a host bind served through virtiofs. Packages whose installation finishes before the first lock check usually pass; a larger installation fails reliably.
libnpmexec/lib/with-lock.js records the lock directory's inode and rejects the lock if a later stat returns a different inode. A preload tracing fs.promises.stat, utimes, mkdir, and rmdir around the lock captured:
...313275 mkdir ok
...313275 stat ok ino=2548552 mtimeMs=1791392313276.2095
...314275 stat ok ino=2548554 mtimeMs=1791392313276.2095
There was no intervening mkdir or rmdir: the same directory returned a new inode with the same mtime while npm's reify workload was writing the package tree beside it. with-lock.js interprets the inode change as compromise and aborts.
Moving only <cache>/_npx to a container-local tmpfs makes the same command pass while the reusable _cacache remains on the virtiofs bind. The downstream investigation and workaround are tracked at https://github.com/filippolmt/toolbox/issues/1167.
Expected Behavior
npm exec should not report a compromised lock merely because a remote/FUSE filesystem returns unstable inode identity for an unchanged lock directory. This is especially surprising because with-lock.js documents that the lock works across machines via NFS.
I am not proposing that inode checks simply be removed; the lock needs a compromise check whose assumptions hold on the remote filesystems it intends to support.
Steps To Reproduce
On macOS with Docker Desktop using virtiofs file sharing:
cache=$(mktemp -d)
docker run --rm \
-v "$cache:/home/toolbox/.npm" \
--entrypoint sh ghcr.io/filippolmt/toolbox:latest \
-lc 'npm install -g npm@latest >/dev/null && /home/toolbox/.npm-global/bin/npx -y @modelcontextprotocol/[email protected] --help'
The command fails with ECOMPROMISED. The equivalent invocation succeeds when _npx is overlaid with local storage:
docker run --rm \
-v "$cache:/home/toolbox/.npm" \
--tmpfs /home/toolbox/.npm/_npx:rw,exec,uid=1000,gid=1000,mode=0700 \
--entrypoint sh ghcr.io/filippolmt/toolbox:latest \
-lc 'npm install -g npm@latest >/dev/null && /home/toolbox/.npm-global/bin/npx -y @modelcontextprotocol/[email protected] --help'
A small isolated call to the same withLock with a delayed callback did not reproduce it; the inode change appears tied to the real reify workload.
Environment
- npm: 12.2.0
- Node.js: v24.21.0
- OS Name: macOS host, Debian container under Docker Desktop
- System Model Name: Apple Silicon Mac
- npm cache filesystem:
virtiofs0 on /home/toolbox/.npm, reported asfuseblkbystat -f -c %T - control filesystem: container overlayfs
- Lenguaje dominante
- JavaScript
- Estrellas
- 10.3k
- Forks
- 5k
- Merge medio
- 4 d 11 h
- PR fusionados (30 d)
- 26
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de npm/cli
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 2 días
-
[BUG] scripts/dependency-graph.js splits npm-cli-repos.txt on os.EOL, so DEPENDENCIES.md depends on the checkout's line endingsPosiblemente ocupada @saruk-vedant la tomó hace 7 días. AbiertoBug Needs Triage Triage Requested
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
npm/cli#10316 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
[BUG] npm pkg delete removes the first array item for a nonexistent propertyPosiblemente ocupada @drawliin la tomó hace 42 días. Abiertocmd:delete Priority 3
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 2 días
-
create node pr: Node.js 20 deprecation & `DEP0040` warnings loggedQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. AbiertoEngineering Priority 1
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
Los mantenedores suelen responder en 2 días
-
`npm audit signatures` does not report how many packages it skipped for want of registry keysPosiblemente ocupada @greenlincoln05 la tomó hace 63 días. AbiertoPriority 3
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
npm/cli#10018 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
Issues similares
-
docs: add SECURITY.md vulnerability reporting policyPosiblemente ocupada @AK-Lmn la tomó hoy. Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 72/100
flisk-sh/linux2wasm#12 ·
Los mantenedores suelen responder en 1 día
-
possible bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Mintplex-Labs/anything-llm#7388 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 60/100
Los mantenedores suelen responder en 1 día
-
v6: Minified bootstrap.min.css is missing header infoPosiblemente ocupada @lazerg la tomó hoy. Abiertobug build confirmed has-pr v6
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
githubnext/gh-aw-workshop#6332 ·
Los mantenedores suelen responder en 1 día