比较固定与浮动版本约束,发现浮动更少导致依赖过时
Which Is Better For Reducing Outdated and Vulnerable Dependencies: Pinning or Floating?
- 用生存分析模型对比不同版本约束类型
- 浮动-主版本最不易过时,浮动-次版本最不易变漏洞
- 适合关注依赖安全与维护的开发者参考
开发者常用版本约束来指定项目依赖的可接受版本。固定版本可减少破坏性变更风险,但需手动更新过时或有漏洞的依赖;浮动版本能自动获取修复,但存在破坏性变更风险。安全实践者建议固定依赖以防范供应链攻击,但固定也最可能导致依赖过时。本研究通过在npm、PyPI和Cargo生态中分析版本约束使用趋势与变更模式,采用生存分析建模依赖状态转移,评估不同约束类型下依赖过时或引入漏洞的概率。结果显示,过时和有漏洞的依赖中,最常用的约束是浮动-次版本,其次为固定;其中浮动-主版本最不易过时,浮动-次版本最不易引入漏洞。
原文摘要 · Abstract (English)
Developers consistently use version constraints to specify acceptable versions of the dependencies for their project. Pinning dependencies can reduce the likelihood of breaking changes, but comes with a cost of manually managing the replacement of outdated and vulnerable dependencies. On the other hand, floating can be used to automatically get bug fixes and security fixes, but comes with the risk of breaking changes. Security practitioners advocate pinning dependencies to prevent against software supply chain attacks, e.g., malicious package updates. However, since pinning is the tightest version constraint, pinning is the most likely to result in outdated dependencies. Nevertheless, how the likelihood of becoming outdated or vulnerable dependencies changes across version constraint types is unknown. The goal of this study is to aid developers in making an informed dependency version constraint choice by empirically evaluating the likelihood of dependencies becoming outdated or vulnerable across version constraint types at scale. In this study, we first identify the trends in dependency version constraint usage and the patterns of version constraint type changes made by developers in the npm, PyPI, and Cargo ecosystems. We then modeled the dependency state transitions using survival analysis and estimated how the likelihood of becoming outdated or vulnerable changes when using pinning as opposed to the rest of the version constraint types. We observe that among outdated and vulnerable dependencies, the most commonly used version constraint type is floating-minor, with pinning being the next most common. We also find that floating-major is the least likely to result in outdated and floating-minor is the least likely to result in vulnerable dependencies.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。