Security teams should search for the package at the pull request level, then map each match to the exact repository, contributor, and timestamp where it was introduced. That gives a defensible exposure timeline and narrows containment to the affected branches, not the whole estate. The goal is rapid blast radius assessment, followed by targeted remediation and review of related developer activity.
How to trace a compromised npm package to the pull requests that introduced it
The practical starting point is to treat the package as a code-introduction problem, not just a dependency problem. Search at pull request granularity, then connect each hit to the repository, contributor, and timestamp that introduced the package so you can isolate affected branches and build a defensible exposure timeline.
That approach is especially useful when the package may have entered through a reviewable change rather than a direct install event. Pull request history gives you the narrowest auditable trail back to the codebase, which is what makes containment targeted instead of estate-wide.
What investigators should reconstruct from the pull request trail
The main question is not only “where is the package used?” but “where did it first appear in source control, and who approved or merged it?” A reliable trace links the package name, version or package manifest entry, the repository path, the specific PR, and the merge timestamp.
That trace lets teams separate introduction from propagation. A package may appear in multiple branches or repos, but only one pull request may explain the original entry point. When you can identify that first insertion, you can scope review to the branches, teams, and release lines that actually absorbed the compromise.
For supply chain cases like LiteLLM PyPI package breach, the same investigative logic applies: identify where the malicious or compromised artifact first entered the delivery path, then work outward from that event rather than assuming every downstream consumer is equally exposed.
How to narrow blast radius without over-rotating the whole estate
Once the introduction point is known, containment should follow the code path, not the entire organisation. The highest-value outcome is to map the package to the branches, release trains, and environments that actually inherited it, then prioritise those first for fix-forward, rebuild, or rollback.
That is also where adjacent developer activity matters. A compromised package often sits alongside other changes in the same PR, the same maintainer workflow, or the same dependency update process, so you should review nearby merges for signs of parallel tampering, suspicious automation, or unexpected dependency drift.
When a package reached the estate through a maintainer workflow or dependency update, the coa and rc npm hijacks 2021 illustrate why source control history and merge context matter together: the entry point is only half the story, because the surrounding workflow often reveals how far the compromise was able to spread before detection.
What evidence makes the trace defensible
Use evidence that can be repeated and explained to engineering, legal, and incident response stakeholders. The strongest package-to-PR trace usually includes the repository diff, the PR author and reviewer record, the merge or rebase event, and the first commit or release tag where the package becomes visible.
Timestamp correlation should be treated carefully. A package may be introduced in one PR and only executed later, so teams should distinguish the first code appearance from the first runtime exposure. That distinction matters when deciding whether remediation is limited to source cleanup, or whether deployed artifacts and credentials may also need review.
Related supply chain incidents such as eslint-scope npm compromise 2018 show why immutable evidence from repo history is valuable: once a malicious package has moved through normal development flow, your traceability depends on preserving the exact merge and release record.
Risk and Threat Considerations
A compromised npm package can enter through routine developer activity and then fan out quickly across branches, builds, and downstream releases. The risk is not only malicious code execution, but also the loss of confidence in which pull request, maintainer, or branch actually introduced the exposure.
Failure mechanism: The attacker hides the package inside a legitimate-looking dependency update or repository change, then uses normal merge and release processes to propagate it before defenders identify the first insertion point.
Impact: Teams waste time on broad cleanup, miss the true entry path, and may fail to remove all affected branches or reintroduced versions, which increases the chance of reinfection or repeated release of the same compromise.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK addresses the attack and risk surface, while SLSA, CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| MITRE ATT&CK | T1195 — Supply Chain Compromise | Covers malicious packages entering software through trusted development workflows. |
| Recommendation — Map the package introduction path to T1195 and hunt for related supply-chain tampering. | ||
| SLSA | Supply chain integrity | Applies to tracing how an artifact entered the build and release path. |
| Recommendation — Require provenance evidence that ties the package to a verified source and build path. | ||
| CIS Controls v8 | CIS-16 — Application Software Security | Supports secure review and control of software changes that introduce dependencies. |
| Recommendation — Review dependency-introducing pull requests with the same rigor as code changes. | ||
| NIST CSF 2.0 | ID.AM-01 — Physical Devices and Systems Are Inventoried | The trace depends on identifying where the package exists across repositories and branches. |
| DE.CM-08 — Vulnerabilities Are Detected in a Timely Manner | Timely detection is needed to find the package soon after introduction. | |
| Recommendation — Inventory affected repositories and branches before scoping remediation. Detect suspicious dependency changes quickly and alert on unexpected package additions. | ||
Practitioner Guidance
What to verify: Confirm the first PR where the package appears, not just the first repo that contains it. Then verify whether the same dependency was copied into sibling branches, release backports, or forked repositories.
Decision rule: If the package entered through a reviewed change, prioritise the merge record, reviewer context, and surrounding dependency edits before widening the investigation to the full dependency graph. If it arrived through automation, inspect the bot account, token, and pipeline event that created the change.
Practitioner takeaway: The most useful trace is the one that turns a suspicious package into a specific code-introduction event, because that is what supports targeted containment instead of broad, noisy remediation.
Related resources from NHI Mgmt Group
- Who is accountable for tracing compromised package requests back to the right developer machine or CI pipeline?
- How should security teams reduce blast radius when a popular npm package is compromised and used in CI/CD or developer environments?
- How should security teams harden package release workflows so untrusted pull requests cannot publish signed builds?
- When does a compromised developer package become a major security risk?
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 3, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org