Software Security
New system predicts future security vulnerabilities hidden in open-source code dependencies
Researchers introduce PatchRisk, a machine-learning benchmark that forecasts which transitive dependencies in open-source projects will later receive vulnerability warnings.
A team of researchers has developed PatchRisk, a new approach to identifying security risk before it becomes visible—by predicting which indirect dependencies in software packages will eventually be flagged as vulnerable.
The Hidden Vulnerability Problem#
In today's open-source ecosystems, a software package's security posture depends not just on its own code, but on the health of every library it depends on, and every library those libraries depend on. Known as transitive dependencies, these indirect connections can introduce vulnerabilities weeks or months after a package is released, when one of those upstream libraries receives a security advisory. Existing tools mostly check whether a package currently contains known vulnerabilities, but they miss the forward-looking question: which of my dependencies will likely become exposed to new threats in the coming months?
A Leakage-Aware Benchmark#
The researchers built PatchRisk as a rigorous, carefully designed benchmark that avoids common evaluation pitfalls. The system was trained on security advisories and dependency graphs from npm and PyPI, the major package registries for JavaScript and Python. Crucially, the team designed filtration-aware labels to prevent "label leakage"—where current vulnerabilities accidentally reveal the answer—and used package-disjoint evaluation to block different versions of the same package from appearing in both training and testing data at once. They also applied temporal testing to reflect real-world forecasting conditions.
The cleaned benchmark contains 9,007 root package-version dependency graphs representing 4,157 distinct packages, across multiple sampling scales (1K, 3K, 5K, and 10K examples).
Strong Performance on Longer Forecasts#
Three feature approaches were tested: TimeOnly (using only temporal patterns), GraphStruct (capturing the shape of the dependency tree), and HistoryGraph (combining both structure and historical vulnerability patterns). On the largest 10K test set:
- For 90-day forecasting, HistoryGraph raised the area under the precision-recall curve from 0.351 to 0.640 compared to TimeOnly alone
- For 365-day forecasting, performance improved from 0.473 to 0.813
These gains held steady across smaller benchmark scales and robustness tests, suggesting the approach generalizes well to real-world dependency networks.