Hacker News new | ask | show | jobs
by ashishb 7 days ago
The archaic model where every tool gets full access to your home directory was never designed for the scenario where a single npm install will install and execute 100s of packages written by various authors.

One should sandbox all npm command executions.

https://github.com/ashishb/amazing-sandbox

4 comments

I also believe sandboxing will get more and more important. There might be some trade-off on user experience or convenience, but given the security enhancement and (LLM agent's) freedom I think it will be well worth it.
Yes I highly suggest working in a container or setting up selinux. Selinux is especially powerful for this kind of thing but also requires a lot of advanced knowledge and skills to setup and maintain sadly.
Switch to another user, idealy called 'npm'.

        su -l npm
Then, just in case, run it under bubblewrap so it just can use $HOME and nothing more.
This is what I'm transitioning to. All third-party code runs in isolated containers: node/npm, python/pip.