Skip to content

Commit e48fa44

Browse files
committed
Make review changes (Final Polish ;) )
Signed-off-by: Shivam Sandbhor <[email protected]>
1 parent e94d2a0 commit e48fa44

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

vulnerabilities/api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ def bulk_search(self, request):
176176

177177

178178
class VulnerabilityFilterSet(filters.FilterSet):
179-
vulnerability_id = filters.CharFilter(field_name="vulnerability_id")
180179

181180
class Meta:
182181
model = Vulnerability

vulnerabilities/import_runner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def process_advisories(data_source: DataSource) -> None:
118118
# Treat updated_advisories and added_advisories as same. Eventually
119119
# we want to refactor all data sources to provide advisories via a
120120
# single method.
121-
vulcoid_timestamp = datetime.datetime.now()
122121
advisory_batches = chain(data_source.updated_advisories(), data_source.added_advisories())
123122
for batch in advisory_batches:
124123
for advisory in batch:

vulnerabilities/models.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Vulnerability(models.Model):
4444

4545
vulnerability_id = models.CharField(
4646
max_length=50,
47-
help_text="Unique vulnerability_id for a vulnerability: this is either a published CVE id"
47+
help_text="Unique identifier for a vulnerability: this is either a published CVE id"
4848
" (as in CVE-2020-7965) if it exists. Otherwise this is a VulnerableCode-assigned VULCOID"
4949
" (as in VULCOID-20210222-1315-16461541). When a vulnerability CVE is assigned later we"
5050
" replace this with the CVE and keep the 'old' VULCOID in the 'old_vulnerability_id'"
@@ -63,9 +63,8 @@ class Vulnerability(models.Model):
6363
)
6464

6565
def save(self, *args, **kwargs):
66-
if self.vulnerability_id:
67-
return super().save(*args, **kwargs)
68-
self.vulnerability_id = self.generate_vulcoid()
66+
if not self.vulnerability_id:
67+
self.vulnerability_id = self.generate_vulcoid()
6968
return super().save(*args, **kwargs)
7069

7170
@staticmethod

0 commit comments

Comments
 (0)