The trust model breaks because package approval does not matter if the imported code can still access cloud keys, registry tokens, and GitHub tokens at execution time. The immediate failure is secret overexposure, but the larger issue is that one compromised dependency can turn a normal application or CI job into a credential harvesting point.
Why This Matters for Security Teams
A fake SDK that can read environment secrets at runtime turns a normal dependency into an execution-time trust failure. Package review, publisher reputation, and even signed artifacts do not help if the imported code can access cloud keys, registry tokens, GitHub tokens, or CI variables once it runs. The risk is not just malicious exfiltration. It is also accidental overexposure when libraries log, forward, or cache secrets in ways the application never intended.
This is why secrets management has to be treated as runtime containment, not only as pre-install vetting. NHI Management Group research on the State of Secrets in AppSec shows that organisations are still spending heavily on secrets controls while leaked-secret remediation averages 27 days, which is far longer than the lifespan of most CI jobs and ephemeral workloads. The real gap is that approval of a package says little about what that package can see when the process starts.
For dependency-heavy systems, this becomes a supply chain and identity problem at the same time, which is why guidance from the OWASP Non-Human Identity Top 10 matters here. In practice, many security teams discover this only after a build runner, bot account, or developer laptop has already exposed secrets to untrusted code.
How It Works in Practice
The control failure happens because runtime access is broader than package trust. A fake SDK does not need elevated privileges if the host application injects secrets through environment variables, mounted files, or inherited process context. Once the code executes, it can read what the parent process can read, and then chain that access into cloud APIs, source control, package registries, ticketing systems, or internal services.
Effective defence starts with reducing what secrets exist in the runtime at all. Current guidance suggests moving from static, long-lived credentials to dynamic secrets, short TTL tokens, and task-scoped identity. For workloads that execute code from external packages, the stronger pattern is workload identity plus just-in-time authorisation: issue an ephemeral credential only when a specific action is approved, then revoke it immediately after use. That limits the blast radius if the SDK is compromised.
- Keep build and runtime secrets separate, and do not inject production credentials into package installation steps.
- Prefer workload identity, such as SPIFFE or OIDC-based identity, over static shared secrets where the platform supports it.
- Use policy-as-code at request time so access is evaluated against context, not just a pre-approved role.
- Scope CI, bot, and agent credentials to a single task, repository, or environment whenever possible.
This lines up with lessons from the CI/CD pipeline exploitation case study, where secrets exposed to a compromised build path become the fastest route to lateral movement. The key point is that the SDK is rarely the only problem; the environment it inherits is what makes the compromise valuable. These controls tend to break down when long-lived secrets are mounted into shared runners or developer environments because one execution context then inherits reusable access across multiple systems.
Common Variations and Edge Cases
Tighter secret controls often increase operational overhead, requiring organisations to balance developer convenience against containment. That tradeoff is most visible in local development, vendor integrations, and legacy CI systems where teams still rely on broad environment injection to keep pipelines moving.
There is no universal standard for this yet, but best practice is evolving toward narrower runtime boundaries. For example, a package installed during build time may need no production secret access at all, while a post-deploy job may require a short-lived token for one API call. Those cases should be distinguished explicitly rather than handled with one shared secret bundle. The same principle applies to AI-enabled tooling and agentic workflows: if an autonomous component can call tools, its identity and secret scope must be constrained per action, not per application.
The 2025 NHI research from The 2025 State of NHIs and Secrets in Cybersecurity is relevant here because duplicated and overused tokens make runtime exposure much harder to contain once a fake SDK touches them. In parallel, the Shai Hulud npm malware campaign shows how quickly package compromise turns into secret harvesting when the environment is permissive. The practical takeaway is simple: if untrusted code can inherit powerful environment variables, the trust model has already failed.
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 Zero Trust (SP 800-207) set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-01 | Runtime secret exposure is a non-human identity trust failure. |
| OWASP Agentic AI Top 10 | A-03 | Autonomous code paths need runtime-scoped access, not static trust. |
| CSA MAESTRO | ID-01 | Maestro addresses identity and access control for agentic and automated workloads. |
| NIST AI RMF | GOVERN | AI RMF governance applies when automated code can access sensitive runtime context. |
| NIST Zero Trust (SP 800-207) | PR.AC-4 | Zero trust requires continuous authorization for each runtime request. |
Inventory every workload identity and remove shared secrets from dependency runtime paths.
Related resources from NHI Mgmt Group
- What breaks when a malicious npm package can read developer secrets during install?
- What breaks when a compromised package can read secrets during installation?
- What breaks when developer secrets are treated only as code security issues?
- What breaks when secrets are available in build and training environments?