Skip to content

Commit

Permalink
Consider deprecated packages as more risky (#284)
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
  • Loading branch information
prabhu committed Apr 2, 2024
1 parent c6893f5 commit 82d0fd9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions depscan/lib/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,7 @@ def analyse_pkg_risks(
if risk_metrics.get("risk_score") and (
risk_metrics.get("risk_score") > config.pkg_max_risk_score
or risk_metrics.get("pkg_private_on_public_registry_risk")
or risk_metrics.get("pkg_deprecated_risk")
):
risk_score = f"""{round(risk_metrics.get("risk_score"), 2)}"""
data = [
Expand Down
5 changes: 5 additions & 0 deletions depscan/lib/pkg_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ def pypi_pkg_risk(pkg_metadata, is_private_pkg, scope):
versions_dict = pkg_metadata.get("releases", {})
versions = [ver[0] for k, ver in versions_dict.items() if ver]
is_deprecated = info.get("yanked") and info.get("yanked_reason")
# Some packages like pypi:azure only mention deprecated in the description
# without yanking the package
pkg_description = info.get("description", "").lower()
if not is_deprecated and ("is deprecated" in pkg_description or "no longer maintained" in pkg_description):
is_deprecated = True
latest_deprecated = False
first_version = None
latest_version = None
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "owasp-depscan"
version = "5.2.15"
version = "5.3.0"
description = "Fully open-source security audit for project dependencies based on known vulnerabilities and advisories."
authors = [
{name = "Team AppThreat", email = "cloud@appthreat.com"},
Expand Down

0 comments on commit 82d0fd9

Please sign in to comment.