Characterizing Dependency Update Practice of NPM, PyPI and Cargo Packages

Imranur Rahman, Nusrat Zahan, Stephen Magill, William Enck, Laurie A. WilliamsarXiv 2024 · DOI · arXiv

TL;DR

This paper introduces two new metrics, MTTUdep and MTTRdep, to better measure how quickly software projects update their dependencies, especially vulnerable ones. They found that while most projects update dependencies relatively quickly, older projects tend to lag. Importantly, they show that MTTUdep can serve as a partial proxy for MTTRdep when vulnerability data is scarce, offering a practical way to assess security risks.

What Problem Does This Paper Address?

In today's software development, projects heavily rely on third-party dependencies. A significant concern is that these dependencies can contain vulnerabilities. While there's a push to update dependencies to secure versions, it's not always clear how quickly development teams actually do this. Existing metrics like "technical lag" measure general dependency updates but don't specifically focus on vulnerable dependencies or account for nuances like floating version constraints. Furthermore, the scarcity of publicly available vulnerability data makes it hard to assess the update practices for the vast majority of packages. This paper aims to bridge this gap by providing more accurate and actionable metrics for understanding dependency update practices, particularly concerning security.

Methods

The core contribution of this paper is the introduction of two novel metrics:

  • Mean-Time-To-Update for dependencies (MTTUdep): This metric measures the weighted average time a package uses an outdated direct dependency. It uses an exponential weighting function to prioritize recent update practices, meaning recent updates contribute more to the score than older ones.
  • Mean-Time-To-Remediate for vulnerable dependencies (MTTRdep): Similar to MTTUdep, this metric measures the weighted average time a package uses a vulnerable direct dependency for which a fix is available. It also employs exponential weighting to emphasize recent remediation efforts.

These metrics are designed to overcome limitations of existing approaches by:

  • Focusing on direct dependencies, which developers have direct control over.
  • Handling floating version constraints, allowing for automatic updates.
  • Aggregating data to a package level for easier interpretation.
  • Prioritizing recent update/remediation practices.

The authors also conducted a proxy analysis to see if MTTUdep could be used as a substitute for MTTRdep when vulnerability data is limited. This involved statistical tests like TOST (Two One-Sided Test), regression analysis with Wald tests, sensitivity analysis, and correlation analysis.

Datasets

The study utilized data from three major package ecosystems:

  • npm: The largest ecosystem.
  • PyPI: The oldest ecosystem.
  • Cargo: The newest ecosystem.

Data was collected from:

  • osv.dev: For vulnerability information (CVE data).
  • deps.dev: For package version release information and dependency relations.
  • libraries.io: For package characteristics (e.g., number of contributors, dependents, version count, package age, SourceRank).

The final dataset comprised 163,207 packages (117,129 npm, 42,777 PyPI, and 3,301 Cargo) that met inclusion criteria (at least two years old with recent activity).

Key Insights and Ideas

  • Recency Matters: The paper strongly advocates for weighting recent update practices more heavily, as they are more indicative of a project's current maintenance and security posture.
  • MTTUdep as a Practical Proxy: The scarcity of vulnerability data is a significant hurdle. The finding that MTTUdep can serve as a partial proxy for MTTRdep is crucial, offering a way to assess potential security risks even without explicit vulnerability reports.
  • General vs. Vulnerable Updates: The study suggests that improving general dependency update practices likely leads to better handling of vulnerable dependencies, implying that a focus on overall maintenance can indirectly boost security.
  • Older Projects Lag: A consistent finding across ecosystems is that older projects tend to have higher MTTUdep and MTTRdep, indicating a potential challenge in maintaining up-to-date dependencies as projects age.

Key Results

  • Fast Updates for Most: The majority of packages in npm, PyPI, and Cargo exhibit relatively fast dependency update practices, with small interquartile ranges for both MTTUdep and MTTRdep.
  • Long Tails Exist: Despite fast updates for most, a significant number of packages lag considerably behind in updating dependencies, leading to long-tailed distributions for both metrics.
  • MTTUdep as a Partial Proxy: Statistical tests indicated that MTTUdep is statistically equivalent to MTTRdep for npm and PyPI (but not Cargo). While MTTUdep explained a moderate portion of MTTRdep's variance (30.5%), it didn't fully meet all criteria for a strong proxy, suggesting its use with caution.
  • Package Characteristics: Most package characteristics showed weak or negligible correlations with dependency updatedness. However, packages with a higher version count were associated with lower MTTUdep and MTTRdep. Older packages were found to have higher MTTUdep and MTTRdep, while popular and better-quality packages (higher SourceRank) tended to have lower MTTUdep.

Limitations and Future Work

  • External Validity: The study focused on three major ecosystems; results might differ in other ecosystems with unique features.
  • Vulnerability Data: The study relied on OSV.dev, which might not be exhaustive. It also didn't consider the exploitability or reachability of vulnerabilities.
  • SEMVER Assumption: The analysis omitted packages not adhering to SEMVER rules, a conservative choice.
  • Transitive Dependencies: The metrics only consider direct dependencies, not transitive ones, which can still pose security risks.
  • Future Work: The authors suggest exploring the severity of vulnerabilities as a weighting factor, incorporating transitive dependencies, and investigating human factors (developer motivation, team dynamics) that influence update practices. They also recommend further research into better proxies for MTTRdep.

Summary updated

BibTeX
@misc{rahman2024characterizing,
  author = {Imranur Rahman and Nusrat Zahan and Stephen Magill and William Enck and Laurie A. Williams},
  title = {{Characterizing Dependency Update Practice of NPM, PyPI and Cargo Packages}},
  year = {2024},
  eprint = {2403.17382},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.17382},
}

Loading related content...

Figure