Code that runs during package installation or build preparation before the application is imported or started. This is a high-risk phase because it can access the host environment, read files, and contact external services. Security teams must treat install-time logic as active execution, not inert metadata.
What setup-time execution really means
Setup-time execution is not passive metadata, it is active code running before an application is fully imported or started. That means the install or build step can already influence the host, inspect the environment, and reach out over the network, so the security boundary begins much earlier than many teams assume.
This matters because package installation often has broader ambient access than runtime code, including filesystem visibility, build variables, shell invocation, and dependency resolution. A malicious or compromised setup hook can therefore become an entry point for tampering, data access, or supply-chain abuse before normal application controls are even engaged.
Why setup-time execution is dangerous
The danger is not only that code runs, but that it runs at a privileged moment in the software lifecycle. Install-time logic can execute in developer laptops, CI pipelines, image builds, or deployment jobs, where secrets, tokens, and source material may be present and where defenders may be expecting a harmless install rather than real execution.
That makes this phase attractive for dependency attacks, build compromise, and hidden exfiltration. If a package author, maintainer account, or transitive dependency is abused, setup-time code can perform actions that look like ordinary packaging work while quietly reading files, modifying artifacts, or contacting external infrastructure.
How organisations should think about exposure
Exposure starts with inventory and trust boundaries: know which packages can run setup logic, where they are installed, and in which environments they are allowed to execute. Build systems, container images, and developer workstations should be treated differently, because the same hook can have very different consequences depending on what data and permissions are present.
It is also important to distinguish safe packaging metadata from executable behaviour. Dependency review should include the installation path, build backend behaviour, and any code that runs as part of preparation, because that code can matter as much as the application itself. Guidance for containerised environments in NIST SP 800-190 Container Security is useful here because it reinforces that software supply-chain stages and runtime stages both need explicit control.
Controls and safer handling of install-time code
The most effective control is to reduce or eliminate unexpected execution during installation and to isolate any execution that remains necessary. That means preferring packages and build steps with transparent, reviewable behaviour, limiting network and filesystem reach during builds, and applying least-privilege principles to the environment that performs installs.
Supply-chain controls should also cover provenance, dependency approval, and repeatable builds. A package that is safe to import is not automatically safe to install, so teams should review build and install pathways separately and treat them as part of software integrity rather than as a convenience feature. SLSA is directly relevant because it frames build provenance and integrity as first-class supply-chain concerns, while OWASP SAMM helps teams build secure delivery practices that account for this class of risk.
Risk and Threat Considerations
Setup-time execution creates a high-value attack window because code can run before normal application defences, review workflows, or runtime containment fully apply. If attackers can place or modify package behaviour at this stage, they may gain access to build secrets, sensitive files, or outbound channels that are harder to monitor than application traffic.
Failure mechanism: a dependency, build backend, or package hook executes during installation and abuses that early trust to read local data, alter artifacts, or establish external communication before the application is operational.
Impact: the result can be supply-chain compromise, secret exposure, poisoned builds, or persistence in downstream artifacts and deployment pipelines.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
SLSA, OWASP SAMM, NIST SP 800-53 Rev 5 and NIST SP 800-190 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| SLSA | Supply chain integrity | Setup-time execution can poison build provenance and artifacts. |
| Recommendation — Prove and isolate builds so install-time code cannot silently alter released artifacts. | ||
| OWASP SAMM | Software assurance maturity | The term concerns secure delivery practices and build-stage review. |
| Recommendation — Embed package and build-step review into software delivery governance. | ||
| NIST SP 800-53 Rev 5 | SI-7 — Software, Firmware, and Information Integrity | Install-time code can tamper with software integrity before startup. |
| CM-5 — Access Restrictions for Change | Setup-time code should not gain uncontrolled change capability in build environments. | |
| Recommendation — Validate installation artifacts and block untrusted modifications during build and install. Restrict who and what can modify packages, build scripts, and installation paths. | ||
| NIST SP 800-190 | Container Security | Container build and image stages are affected by setup-time execution risks. |
| Recommendation — Harden build images so package installation cannot access unnecessary host resources. | ||
Practitioner Guidance
Why practitioners should care: teams often focus on runtime security and miss the fact that installation itself can be an execution surface. If install-time logic is allowed to run unreviewed, the build process can become the easiest place to smuggle in unwanted behaviour.
What to watch for: packages that execute code during install, build, or wheel preparation deserve extra scrutiny, especially when they are new, lightly maintained, or pull in many transitive dependencies. Treat any install step that needs network access, filesystem access, or environment inspection as active software behaviour, not a passive setup action.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 2, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org