Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Haiko Schol <hs@haikoschol.com>
  • Loading branch information
haikoschol committed Mar 15, 2020
1 parent 3265803 commit 7a7295c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def import_vulnerabilities():
cve_id = advisory.get('cve')
vuln_id = advisory['id']
vuln_version_ranges = advisory['specs']
affected_versions = set()
for vuln_version_range in vuln_version_ranges:
version_range = RangeSpecifier(vuln_version_range)
affected_versions = set()
Expand Down
4 changes: 2 additions & 2 deletions vulnerabilities/management/commands/import.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ def list_sources(self):
def import_data(self, names, cutoff_date):
importers = []
unknown_importers = set()

# make sure all arguments are valid before running any importers
for name in names:
try:
importers.append(Importer.objects.get(name=name))
except Importer.DoesNotExist:
unknown_importers.add(name)

if unknown_importers:
unknown_importers = ', '.join(unknown_importers)
raise CommandError(f'Unknown data sources: {unknown_importers}')
Expand Down
4 changes: 2 additions & 2 deletions vulnerabilities/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ class Importer(models.Model):
name = models.CharField(max_length=100, unique=True, help_text='Name of the importer')
license = models.CharField(max_length=100, blank=True, help_text='License of the vulnerability data')
last_run = models.DateTimeField(null=True, help_text='UTC Timestamp of the last run')

data_source = models.CharField(
max_length=100,
help_text='Class name of the data source implementation importable from vulnerabilities.importers',
help_text='Class name of the data source implementation importable from vulnerabilities.importers',
)
data_source_cfg = pgfields.JSONField(
null=False,
Expand Down
4 changes: 2 additions & 2 deletions vulnerabilities/tests/test_rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
# VulnerableCode is a free software code scanning tool from nexB Inc. and others.
# Visit https://github.com/nexB/vulnerablecode/ for support and download.

from vulnerabilities.scraper.rust import rust_crate_advisories
from vulnerabilities.scraper.rust import load_advisory
from vulnerabilities.importers.rust import rust_crate_advisories
from vulnerabilities.importers.rust import load_advisory

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

Expand Down

0 comments on commit 7a7295c

Please sign in to comment.