Independent analysis by NHI Mgmt GroupSource article: Cloudsmith, “Dependency attacks start before your scanner runs” (June 23, 2026)

TL;DR: Dependency attacks can start before scanners run because transitive packages execute during installation, according to Cloudsmith, which means enforcement at ingestion matters more than downstream detection. Security teams need a trust boundary that blocks risky artifacts before code enters the environment.


At a glance

What this is: NHI Mgmt Group's analysis, drawing on Cloudsmith's blog post: Dependency attacks exploit the gap between package download and downstream scanning, so the artifact registry becomes the real enforcement point.

Why it matters: This matters because security teams that rely on build-time or endpoint-only controls can miss malicious code that enters through dependency graphs and executes before detection.


Context

Modern software supply chains inherit risk from every transitive dependency, not just the packages developers select directly. The security problem is timing: installation can execute code before downstream scanners or endpoint tools have any chance to inspect it.

The practical governance question is where enforcement actually happens in the delivery path, especially when public registries, CI systems and developer workstations all consume the same artifacts. In that model, the artifact boundary is the control point, not the scanner layered on top of it.


Key questions

Q: Why do transitive dependencies create more software supply chain risk than direct packages alone?

A: Transitive dependencies hide exposure inside nested libraries that are often missed by top-level package reviews. If defenders only track direct components, they can miss the code attackers are most likely to exploit. A dependency-aware inventory reduces that blind spot and gives teams a realistic view of what is actually present in production.

Q: What should teams do first when a package dependency is compromised?

A: Freeze builds, revoke trust in the compromised package, and pin or replace the dependency with a known-good version or internal mirror. Then audit lockfiles, transitive dependencies, and any build pipelines that may have fetched the package, because compromise often spreads through cached artefacts and automated restores. If code signed artefacts exist, verify signatures before resuming release.

Q: How does registry-level policy differ from downstream scanning?

A: Registry-level policy blocks or flags a package before it enters consumption, while downstream scanning inspects code, manifests, and lockfiles after retrieval. The first controls what is allowed into the supply chain, the second detects known issues in what has already been pulled in. Used together, they reduce both exposure and detection lag.

Q: Why does dependency scanning miss install-time malware?

A: Dependency scanning usually reviews declared packages and known vulnerability data, not the code that runs during installation. Install-time malware can live in preinstall or postinstall hooks, native build steps, or bundled scripts that execute after the package is fetched. That means a clean manifest can still trigger malicious behaviour during install.


Technical breakdown

Why transitive dependencies become the attack surface

Package managers resolve a dependency graph, not just a single requested package. That means an install can bring in many transitive components, including maintainers and code paths the consumer never reviewed. If one of those components is compromised, the malicious code may execute as part of normal installation behaviour, before a build step or a downstream control sees anything unusual. The core issue is that trust is extended automatically by dependency resolution, while inspection often happens later in the pipeline.

Practical implication: Treat the dependency graph as an execution surface, not a passive inventory, and enforce policy before package material reaches build or runtime stages.

Why downstream scanners miss install-time compromise

Static analysis and CI/CD scanners are useful, but they usually inspect artifacts after the package manager has already pulled them in. In a dependency attack, that timing is too late if a postinstall hook or similar mechanism has already run. Endpoint tools can detect suspicious behaviour, but only after the code has executed. The architectural failure is not that controls are absent, but that they are positioned after the point where the attacker gains execution.

Practical implication: Move control checks upstream of package execution so install-time scripts cannot run before policy evaluation.

How artifact registries change enforcement timing

An artifact registry can act as a trust boundary between public software and internal environments. When policy is enforced at ingestion, the registry can reject risky packages before they are cached, downloaded into builds or executed on developer systems. It also creates a durable record of what entered the environment and under which policy state. That shifts governance from advisory alerting to admission control, which is the only stage where the attack can still be prevented rather than merely detected.

Practical implication: Use registry-level policy to decide what is allowed into the environment before dependency installation begins.


Threat narrative

Attacker objective: The attacker aims to get malicious code executed inside developer or CI environments before defensive controls can inspect the package.

  1. Entry occurs when an attacker uses a leaked publish key or stolen maintainer credential to gain write access to a package in a public registry.
  2. Credential abuse follows as the attacker publishes a convincing new version that consumers receive through normal dependency resolution.
  3. Impact occurs when install-time code executes before scanners run, allowing credential theft, remote access or other malicious activity inside the build path.

Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.


NHI Mgmt Group analysis

Dependency attack risk starts at ingestion, not detection. The central mistake in many software supply chains is assuming that inspection after download is still timely. Once a package has already been resolved, installed and executed, downstream scanners are documenting an event that has already happened. The governance model therefore has to move from visibility after the fact to admission control at the artifact boundary.

Continuous re-evaluation is the missing governance capability. A package that looked safe last quarter can become risky when a maintainer account is compromised or new threat intelligence emerges. That means trust is not a one-time decision, and registry-level policy needs to re-check artifacts as their risk state changes. The named concept here is ingestion-time trust enforcement: policy that decides whether software enters the environment at all.

Software supply chain security is now an identity problem as much as a code problem. A leaked publish key, a stolen maintainer token or a compromised CI credential turns package publication into an identity event. CI/CD pipeline identity therefore matters because write access to registries is an identity and privilege question before it is a code quality question. Practitioners should govern package publishing as privileged access, not as a routine build task.

Bolt-on controls create seams that attackers exploit. When teams stack scanners, proxies and endpoint tools after the fact, they often create a patchwork with unclear ownership and bypass paths. If developers can route around a control to keep shipping, the organisation has created the appearance of coverage without the assurance of enforcement. Practitioners should evaluate whether their current control stack actually blocks bad artifacts or merely reports on them.

The artifact registry is becoming the policy plane for modern delivery pipelines. As dependency ecosystems grow and AI-assisted development adds even more external code, the old model of scanning everything downstream becomes less defensible. The organisations that reduce exposure will be the ones that treat package admission as a governance decision, not an operational convenience. Practitioners should align software intake with explicit trust decisions.

From our research library:

What this signals

Ingestion-time trust enforcement: dependency security is moving toward decisions made at the artifact boundary, because that is the last point where a malicious package can still be stopped before it executes. Build-time and endpoint controls remain necessary, but they no longer define the real trust boundary for software delivery.

As package ecosystems grow, organisations will need policy that can re-evaluate stored artifacts when provenance, maintainer trust or threat intelligence changes. The controls that matter most will be the ones that answer a simple question: should this package enter the environment at all?

Third-party dependency exposure is widespread, with 92% of organisations exposing NHIs to third parties, according to the Ultimate Guide to NHIs. That makes registry governance and publishing identity controls a shared concern across software supply chains and NHI programmes.


For practitioners

  • Implement package admission controls at the registry boundary Reject or quarantine packages before they are available to build systems, developer workstations or deployment jobs.
  • Block install-time execution for untrusted dependencies Disable or tightly govern postinstall and similar hooks for packages that have not been explicitly approved.
  • Govern publishing credentials as privileged identities Restrict npm publish keys, maintainer tokens and CI credentials to the smallest possible set of trusted workflows.
  • Re-evaluate package risk continuously Re-scan and re-approve stored artifacts when threat intelligence, maintainer trust or vulnerability status changes.

Key takeaways

  • Dependency attacks exploit a timing gap, because code can execute before downstream security tools inspect the package.
  • The incident pattern shows that publish credentials and maintainer access are privileged identities, not just developer conveniences.
  • The most effective control is to decide package admission at the registry boundary, before installation can run untrusted code.

Related NHI Mgmt Group resources: AI Supply Chain Security and AI-BOM Guide · CI/CD Pipeline Identity Security Guide · Dependency Update Automation Guide


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 and MITRE ATT&CK address the attack and risk surface, while NIST CSF 2.0 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-02 — Secret LeakageLeaked publish keys and maintainer tokens expose packages to malicious publishing.
NHI-05 — Overprivileged NHIPublish credentials often grant broader registry write power than the workflow needs.
Recommendation — Scan for exposed package publishing secrets and revoke them as soon as they appear. Reduce registry write scope to the minimum required for trusted release workflows.
MITRE ATT&CKTA0006; TA0010 — Credential Access; ExfiltrationThe attack chain uses stolen credentials to publish malicious code and steal secrets.
Recommendation — Map dependency incidents to credential access and exfiltration paths in threat hunts.
NIST CSF 2.0PR.AA-05 — Access Permissions, Entitlements and AuthorizationsRegistry and publishing access need explicit entitlement governance.
Recommendation — Review who can publish packages and remove standing write access that is not essential.
CIS Controls v8CIS-5 — Account ManagementMaintainer and CI accounts are the accounts that enable malicious package publication.
Recommendation — Inventory and govern all package publishing accounts as privileged identities.

Key terms

  • Transitive Dependency: A package that your software uses indirectly because one of its own dependencies pulls it in, as opposed to a direct dependency that your project declares. Most components in a typical application are transitive, so reviewing the manifest alone misses most risk. Visibility, such as full dependency trees and runtime validation, is needed to know what code is actually present.
  • Package Postinstall Script: A package postinstall script is code that runs automatically after a package is installed. Package managers use it for setup tasks such as compilation or configuration, but it also gives an attacker a route to execute commands on the developer machine or build server when a dependency is trusted and installed.
  • Publish Key: A publish key is the credential used to authorise publishing or uploading content to a package registry. It controls who can release a package or artefact, so leakage can let an attacker overwrite trusted releases or push malicious updates under a legitimate name.
  • Artifact Registry: Artifact Registry is a controlled storage system for software build outputs and other deployable artifacts. In identity and security programs, it helps teams track what was produced, who published it, and what should be allowed into production. Access should be governed with IAM, least privilege, and integrity controls to reduce tampering and supply chain risk.

Deepen your knowledge

NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, workload identity and secrets management. It helps practitioners connect identity controls to the broader delivery systems their programmes depend on.
NHIMG Editorial Note
Published by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org