Expand description
Package-manager trees mounted read-only for cants that may write the project.
pnpm, Bun and uv (and Yarn with nmMode: hardlinks-*) fill node_modules or .venv with
hard links into one store shared by all the user’s projects. Landlock checks the path a file
is opened by, not the file, and can’t take files out of a writable directory: a cant that may
write the project could change a stored package for every project. So such trees are found
with a few stat calls (no walk) and mounted read-only in the cant’s own mount namespace
(crate::Plan::readonly); tool caches inside node_modules stay writable.
Constants§
- WRITABLE_
CACHES - Caches inside
node_modulesthat tools write (eslint, babel, vite, vitest): mounted writable again on top of the read-only tree..cacheis created when missing.
Functions§
- not_
locked - The warning when the trees can’t be mounted read-only here (no user namespaces).
- shared_
trees - The package-manager trees under the directories
policylets the cant write: for each writable directoryd(from the manifest, the command line or--grant),d/node_modulesandd/.venvord/venvwith apyvenv.cfg, and the same one level down (workspaces). A tree the manifest grants writable itself ($CWD/*grants each entry) is one too. A tree the user named (--grant, or as an argument), or that holds a path they named, is their choice and is left alone. Sorted, distinct.