From 129cce21f03bc492a570df3677b3f4c6519e5098 Mon Sep 17 00:00:00 2001 From: Sanskar Sharma Date: Thu, 13 Jun 2024 22:24:55 +0530 Subject: [PATCH] feat: purl in productinfo (#4185) --- cve_bin_tool/parsers/__init__.py | 10 ++++++++-- cve_bin_tool/util.py | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cve_bin_tool/parsers/__init__.py b/cve_bin_tool/parsers/__init__.py index c44ebe8420..843b210fb1 100644 --- a/cve_bin_tool/parsers/__init__.py +++ b/cve_bin_tool/parsers/__init__.py @@ -118,11 +118,17 @@ def find_vendor_from_purl(self, purl, ver) -> Tuple[List[ScanInfo], bool]: vendors.add((vendor, product)) else: return vendorlist, False - + purl_with_ver = f"{str(purl)}@{ver}" for vendor, product in vendors: vendorlist.append( ScanInfo( - ProductInfo(vendor, product, ver, "/usr/local/bin/product"), + ProductInfo( + vendor, + product, + ver, + "/usr/local/bin/product", + purl=purl_with_ver, + ), self.filename, ) ) diff --git a/cve_bin_tool/util.py b/cve_bin_tool/util.py index 6c9d5b247c..21ce7ccc22 100644 --- a/cve_bin_tool/util.py +++ b/cve_bin_tool/util.py @@ -155,12 +155,14 @@ class ProductInfo(NamedTuple): product: str version: str location: str + purl: Optional[str] """ vendor: str product: str version: str location: str + purl: str | None = None class ScanInfo(NamedTuple):