AI coding agents that can install dependencies and run project scripts should, in my view, start dependency setup in a network-isolated, consent-based mode. npm packages can run preinstall, install, postinstall, or prepare hooks, and those scripts receive useful environment information. A warning is not much of a boundary if the agent proceeds anyway.
For example, a postinstall hook could inspect exposed process environment data while downloading or compiling a native component. That is a plausible threat model, not a claim about a particular attack. A sensible default would combine a practical sandbox, lockfile and integrity checks, and human approval before enabling hooks or broader network access. Lockfiles improve reproducibility; they do not establish that code is benign.
The cost is real: native modules and Python builds may need compilation, so first-run setup could require a second pass or explicit approval. Would developers accept slower onboarding for a safer default? I’m interested in counterexamples or better designs.