Skip to content

Commit d22ce30

Browse files
author
Prabhu Subramanian
committed
New year bug
1 parent f73308f commit d22ce30

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="appthreat-vulnerability-db",
8-
version="1.6.2",
8+
version="1.6.3",
99
author="Team AppThreat",
1010
author_email="[email protected]",
1111
description="AppThreat's vulnerability database and package search library with a built-in file based storage. CVE, GitHub, npm are the primary sources of vulnerabilities.",

vdb/lib/db.py

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def store(db, datas):
5757
:param datas: Data list to store
5858
:return: Stored packed documents
5959
"""
60+
if datas is None:
61+
return None
6062
global index_data, vendor_index_data
6163
docs = storage.store(datas, db_file=db["db_file"], index_file=db["index_file"])
6264
# Re-read the index

vdb/lib/nvd.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ def download_all(self, local_store=True):
5555
data_list = []
5656
for y in range(now.year, int(start_year) - 1, -1):
5757
data = self.fetch(y)
58+
if not data:
59+
continue
5860
if local_store:
5961
self.store(data)
6062
data_list += data
@@ -72,7 +74,11 @@ def fetch(self, year):
7274
url = config.nvd_url % dict(year=year)
7375
LOG.debug("Download NVD CVE from {}".format(url))
7476
with tempfile.NamedTemporaryFile() as tf:
75-
r = requests.get(url, stream=True)
77+
try:
78+
r = requests.get(url, stream=True)
79+
except Exception:
80+
logging.warning(f"Exception while downloading NVD feed from {url}")
81+
return None
7682
for chunk in r.iter_content(chunk_size=download_chunk_size):
7783
tf.write(chunk)
7884
tf.flush()

0 commit comments

Comments
 (0)