The control that breaks is the assumption that installation is a safe administrative step. If package hooks can run during build or setup, then malware can execute before static review, credential scanning, or policy checks finish. That creates a gap where the package name looks acceptable but the runtime behaviour is already hostile. Teams need to govern execution paths, not just dependency lists.
Why This Matters for Security Teams
Package installation is often treated as a harmless supply chain step, but modern build systems can execute code before anyone reviews the source or approves the dependency. That turns install time into an execution boundary, not a paperwork step. When a package can run hooks, preinstall scripts, or build logic, the threat is not just a bad version number. It is early credential access, environment inspection, and hidden runtime behaviour.
This is especially dangerous because non-human identities and secrets are frequently present in CI/CD and developer environments. NHIMG research shows that 96% of organisations store secrets outside of secrets managers in vulnerable locations including code, config files, and CI/CD tools, which means malicious install-time code may find usable credentials before controls kick in. NIST’s NIST SP 800-53 Rev 5 Security and Privacy Controls reinforces the need to control software acquisition and execution, not just trust declared dependencies.
In practice, many security teams encounter this only after a package has already exfiltrated tokens from a build pipeline rather than through intentional review.
How It Works in Practice
When installation can execute code, the security model shifts from passive inspection to active control of the whole dependency lifecycle. A package may look safe in a manifest, yet still run setup scripts, post-install hooks, native build steps, or transitive installer logic that touches the filesystem, network, or process environment before review completes. The practical response is to separate observation from execution wherever possible.
For build and developer workflows, that usually means restricting which package managers and flags are allowed, blocking install-time scripts by default, sandboxing builds, and using ephemeral, tightly scoped credentials so the install step cannot reach high-value secrets. It also means treating dependency intake as a policy decision, not just a version pin. NIST control families on configuration management, system and communications protection, and least privilege map well to this problem. NHIMG’s Ultimate Guide to NHIs highlights how widespread secret sprawl and NHI exposure make these pipelines attractive targets.
Operationally, teams should validate packages in an isolated environment, inspect install-time behaviour, and record what the installer attempted to access. Where available, prefer provenance checks and allowlists over trust-by-default. Current guidance suggests that dependency review should be paired with runtime policy enforcement, because a safe manifest does not guarantee a safe installer. The LiteLLM PyPI package breach is a reminder that package ecosystems can turn into credential exposure events when trust is placed in the wrong layer. These controls tend to break down in developer workstations and unmanaged CI runners because local privilege and broad secret access defeat isolation.
Common Variations and Edge Cases
Tighter install controls often increase friction for developers, requiring organisations to balance pipeline speed against the risk of code that runs before review. That tradeoff becomes sharper in environments that rely on native extensions, monorepos, or private registries, where build steps are both legitimate and difficult to distinguish from malicious actions.
Best practice is evolving, but there is no universal standard for every package ecosystem. Some ecosystems expose install hooks that are hard to disable without breaking functionality, while others allow safer modes that skip execution. Teams should document which repositories may execute code during installation, which may only be mirrored, and which require manual approval. Where precompiled artifacts are available, they reduce exposure, but they do not remove the need to verify provenance and sandbox the install path.
This issue also intersects with NHI governance because build agents, signing services, and package mirrors often rely on long-lived secrets. NHIMG notes that 71% of NHIs are not rotated within recommended time frames, which makes compromised install-time access harder to contain. The most resilient pattern is to combine short-lived credentials, constrained workload identity, and execution policy that treats install as a privileged action, not a convenience feature.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10, OWASP Agentic AI Top 10 and CSA MAESTRO address the attack and risk surface, while NIST AI RMF and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-03 | Install-time code can steal or abuse long-lived NHI secrets. |
| OWASP Agentic AI Top 10 | A1 | Autonomous execution before review is a tool-use and control-loss risk. |
| CSA MAESTRO | T1 | MAESTRO addresses agent/tool execution paths that can act before approval. |
| NIST AI RMF | AI RMF governance fits runtime risk from unreviewed execution paths. | |
| NIST CSF 2.0 | PR.IP-1 | Secure development practices should control software installation behaviour. |
Inventory package-build NHIs and shorten credential lifetime before install scripts can reach them.
Related resources from NHI Mgmt Group
- What breaks when npm package installs are allowed to execute code before inspection?
- What breaks when a package can execute before the application starts?
- What breaks when a trusted AI package can execute code on import?
- What breaks when npm packages execute code through binding.gyp instead of package.json scripts?
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on August 19, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org