Skip to content

Commit 7a7295c

Browse files
committed
WIP
Signed-off-by: Haiko Schol <[email protected]>
1 parent 3265803 commit 7a7295c

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed
File renamed without changes.

vulnerabilities/scraper/safety_db.py renamed to vulnerabilities/importers/safety_db.py

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def import_vulnerabilities():
4040
cve_id = advisory.get('cve')
4141
vuln_id = advisory['id']
4242
vuln_version_ranges = advisory['specs']
43+
affected_versions = set()
4344
for vuln_version_range in vuln_version_ranges:
4445
version_range = RangeSpecifier(vuln_version_range)
4546
affected_versions = set()

vulnerabilities/management/commands/import.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ def list_sources(self):
7676
def import_data(self, names, cutoff_date):
7777
importers = []
7878
unknown_importers = set()
79-
79+
8080
# make sure all arguments are valid before running any importers
8181
for name in names:
8282
try:
8383
importers.append(Importer.objects.get(name=name))
8484
except Importer.DoesNotExist:
8585
unknown_importers.add(name)
86-
86+
8787
if unknown_importers:
8888
unknown_importers = ', '.join(unknown_importers)
8989
raise CommandError(f'Unknown data sources: {unknown_importers}')

vulnerabilities/models.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ class Importer(models.Model):
138138
name = models.CharField(max_length=100, unique=True, help_text='Name of the importer')
139139
license = models.CharField(max_length=100, blank=True, help_text='License of the vulnerability data')
140140
last_run = models.DateTimeField(null=True, help_text='UTC Timestamp of the last run')
141-
141+
142142
data_source = models.CharField(
143143
max_length=100,
144-
help_text='Class name of the data source implementation importable from vulnerabilities.importers',
144+
help_text='Class name of the data source implementation importable from vulnerabilities.importers',
145145
)
146146
data_source_cfg = pgfields.JSONField(
147147
null=False,

vulnerabilities/tests/test_rust.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
# VulnerableCode is a free software code scanning tool from nexB Inc. and others.
2222
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
2323

24-
from vulnerabilities.scraper.rust import rust_crate_advisories
25-
from vulnerabilities.scraper.rust import load_advisory
24+
from vulnerabilities.importers.rust import rust_crate_advisories
25+
from vulnerabilities.importers.rust import load_advisory
2626

2727
RUSTSEC_DB_URL = 'https://github.com/RustSec/advisory-db/archive/master.zip'
2828

0 commit comments

Comments
 (0)