Understanding and Detecting Peer Dependency Resolving Loop in npm Ecosystem
Xingyu Wang, Mingsen Wang, Wenbo Shen, Rui Chang
摘要
As the default package manager for Node.js, npm has become one of the largest package management systems in the world. To facilitate dependency management for developers, npm supports a special type of dependency, Peer Dependency, whose installation and usage differ from regular dependencies. However, conflicts between peer dependencies can trap the npm client into infinite loops, leading to resource exhaustion and system crashes. We name this problem PeerSpin. Although PeerSpin poses a severe risk to ecosystems, it was overlooked by previous studies, and its impacts have not been explored. To bridge this gap, this paper conducts the first in-depth study to understand and detect PeerSpin in the npm ecosystem. First, by systematically analyzing the npm dependency resolution, we identify the root cause of PeerSpin and characterize two peer dependency patterns to guide detection. Second, we propose a novel technique called Node-Replacement-Conflict based PeerSpin Detection, which leverages the state of the directory tree during dependency resolution to achieve accurate and efficient PeerSpin detection. Based on this technique, we developed a tool called PeerChecker to detect PeerSpin. Finally, we apply PeerChecker to the entire npm ecosystem and find that 5,662 packages, totaling 72,968 versions, suffer from PeerSpin. Until now, we have selected 100 problematic packages to report and received 28 confirmations. We also open source all PeerSpin analysis implementations, tools, and data sets to the public to help the community detect PeerSpin issues and enhance the reliability of the npm ecosystem.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
脉络
- HERO: On the Chaos When PATH Meets Modules 引用了 Watchman: monitoring dependency conflicts for Python library ecosystem
- HERO: On the Chaos When PATH Meets Modules 引用了 Small World with High Risks: A Study of Security Threats in the npm Ecosystem
- Demystifying the Vulnerability Propagation and Its Evolution via Dependency Trees in the NPM Ecosystem 引用了 Small World with High Risks: A Study of Security Threats in the npm Ecosystem
它引用的 Paper7
- Small World with High Risks: A Study of Security Threats in the npm EcosystemMarkus Zimmermann, Cristian-Alexandru Staicu, Cam Tenny, Michael PradelUSENIX Security 2019 · 281 次引用
- Demystifying the Vulnerability Propagation and Its Evolution via Dependency Trees in the NPM EcosystemChengwei Liu, Sen Chen, Lingling Fan, Bihuan Chen 等ICSE 2022 · 94 次引用
- Watchman: monitoring dependency conflicts for Python library ecosystemYing Wang, Ming Wen, Yepang Liu, Yibo Wang 等ICSE 2020 · 65 次引用
- Not All Dependencies are Equal: An Empirical Study on Production Dependencies in NPMJasmine Latendresse, Suhaib Mujahid, Diego Elias Costa, Emad ShihabASE 2022 · 17 次引用
- HERO: On the Chaos When PATH Meets ModulesYing Wang, Liang Qiao, Chang Xu, Yepang Liu 等ICSE 2021 · 8 次引用
相关 Paper
- What the Fork? Finding Hidden Code Clones in npmElizabeth Wyss, Lorenzo De Carli, Drew DavidsonICSE 2022 · 10 次引用
- Flexible and Optimal Dependency Management via Max-SMTDonald Pinckney, Federico Cassano, Arjun Guha, Jonathan Bell 等ICSE 2023 · 10 次引用
- Pinning Is Futile: You Need More Than Local Dependency Versioning to Defend against Supply Chain AttacksHao He, Bogdan Vasilescu, Christian KästnerFSE 2025 · 3 次引用
- SpiderScan: Practical Detection of Malicious NPM Packages Based on Graph-Based Behavior Modeling and MatchingYiheng Huang, Ruisi Wang, Wen Zheng, Zhuotong Zhou 等ASE 2024 · 4 次引用
- From Noise to Signal: Precisely Identify Affected Packages of Known Vulnerabilities in npm EcosystemYingyuan Pu, Lingyun Ying, Yacong GuNDSS 2026 · 4 次引用
