Skip to content

Commit ccf8ebe

Browse files
feat: Add support for Javascript package scanning (Fixes #1453)
1 parent ebb1375 commit ccf8ebe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cve_bin_tool/version_scanner.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import subprocess
77
import sys
88
from re import MULTILINE, compile, search
9+
from typing import List
910

1011
import defusedxml.ElementTree as ET
1112

@@ -252,12 +253,12 @@ def run_java_checker(self, filename: str) -> None:
252253

253254
self.logger.debug(f"Done scanning file: {filename}")
254255

255-
def find_js_vendor(self, product: str, version: str) -> list[str]:
256+
def find_js_vendor(self, product: str, version: str) -> List[List[str]]:
256257
"""Find vendor for Javascript product"""
257258
if version == "*":
258259
return None
259260
vendor_package_pair = self.cve_db.get_vendor_product_pairs(product)
260-
vendorlist = []
261+
vendorlist: List[List[str]] = []
261262
if vendor_package_pair != []:
262263
# To handle multiple vendors, return all combinations of product/vendor mappings
263264
for v in vendor_package_pair:
@@ -271,7 +272,7 @@ def find_js_vendor(self, product: str, version: str) -> list[str]:
271272
return vendorlist if len(vendorlist) > 0 else None
272273
return None
273274

274-
def run_js_checker(self, filename: str) -> None:
275+
def run_js_checker(self, filename: str) -> None:
275276
"""Process package-lock.json file and extract product and dependency details"""
276277
fh = open(filename)
277278
data = json.load(fh)

0 commit comments

Comments
 (0)