Installing random software from the internet is problematic.
(I could just give it a shot, but I reckon there will be gotchas)
Docker/LXD or a dev VM lets you access both simultaneously. Or create a separate user, but not as secure or convenient.
Yeah I was playing with a separate user account, could get some basics working but I wonder how far could I get with that.
What are the bigger security risks for that approach? Assuming constrained file permissions, and that no secrets are in ENV (https://gist.github.com/telent/9742059 )
On macos you can use Apple's native sandboxing. See for example http://mybyways.com/blog/creating-a-macos-sandbox-to-run-kod...
At least npm has the package-lock.json feature that lets you lock down the entire dependency graph. If the package-lock.json was created with a safe set of dependencies, then any dependencies compromised in the future won't affect you (because already released versions can't be modified). Maven and gradle both seem to entirely lack a comparable feature as far as I know; if they do have that functionality as an obscure feature or plugin, then I still criticize them for not making it more prominent. (Npm generates and uses package-lock.json by default!)