Socket Firewall + PATH shims: universal coverage for npm/pip/etc. on macOS
Socket Firewall (sfw) blocks known-malicious package installs at the network layer. You use it by wrapping your install: sfw npm install foo. Which means you only get protection when you remember to type it.
That's a problem, what happens if the Claude Code is the one installing the packages or a variety of other cases where something else runs npm, a script, a postinstall hook, an npx that internally calls npm install, an editor extension fetching a language server?
Shell aliases (alias npm='sfw npm') don't always help: aliases only expand in interactive zsh. Non-interactive subshells, scripts, Makefiles, tool-spawned commands — none of them see the alias.