Skip to content

Commit d93887e

Browse files
committed
Rebase and resolve confilcts
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
1 parent 0ab075b commit d93887e

8 files changed

Lines changed: 19 additions & 19 deletions

File tree

vulnerabilities/import_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def process_advisories(data_source: DataSource) -> None:
132132
for score in vuln_ref.severities:
133133
models.VulnerabilitySeverity.objects.update_or_create(
134134
vulnerability=vuln,
135-
scoring_system=score.system.vulnerability_id,
135+
scoring_system=score.system.identifier,
136136
reference=ref,
137137
defaults={"value": str(score.value)},
138138
)

vulnerabilities/importers/apache_kafka.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def to_advisory(self, advisory_page):
8282

8383
advisories.append(
8484
Advisory(
85-
cve_id=cve_id,
85+
vulnerability_id=cve_id,
8686
summary=cve_description_paragraph.text,
8787
impacted_package_urls=affected_packages,
8888
resolved_package_urls=fixed_packages,

vulnerabilities/importers/suse_scores.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def to_advisory(score_data):
8080

8181
advisories.append(
8282
Advisory(
83-
cve_id=cve_id,
83+
vulnerability_id=cve_id,
8484
summary="",
8585
impacted_package_urls=[],
8686
vuln_references=[

vulnerabilities/migrations/0001_initial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 3.0.7 on 2021-02-11 15:51
1+
# Generated by Django 3.0.7 on 2021-02-18 06:13
22

33
import django.contrib.postgres.fields.jsonb
44
from django.db import migrations, models
@@ -91,7 +91,7 @@ class Migration(migrations.Migration):
9191
fields=[
9292
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
9393
('value', models.CharField(help_text='Example: 9.0, Important, High', max_length=50)),
94-
('scoring_system', models.CharField(choices=[('cvssv2', 'CVSSv2 Base Score'), ('cvssv2_vector', 'CVSSv2 Vector'), ('cvssv3', 'CVSSv3 Base Score'), ('cvssv3_vector', 'CVSSv3 Vector'), ('rhbs', 'RedHat Bugzilla severity'), ('rhas', 'RedHat Aggregate severity')], help_text='vulnerability_id for the scoring system used. Available choices are: cvssv2 is vulnerability_id for CVSSv2 Base Score system, cvssv2_vector is vulnerability_id for CVSSv2 Vector system, cvssv3 is vulnerability_id for CVSSv3 Base Score system, cvssv3_vector is vulnerability_id for CVSSv3 Vector system, rhbs is vulnerability_id for RedHat Bugzilla severity system, rhas is vulnerability_id for RedHat Aggregate severity system ', max_length=50)),
94+
('scoring_system', models.CharField(choices=[('cvssv2', 'CVSSv2 Base Score'), ('cvssv2_vector', 'CVSSv2 Vector'), ('cvssv3', 'CVSSv3 Base Score'), ('cvssv3_vector', 'CVSSv3 Vector'), ('cvssv3.1', 'CVSSv3.1 Base Score'), ('cvssv3.1_vector', 'CVSSv3.1 Vector'), ('rhbs', 'RedHat Bugzilla severity'), ('rhas', 'RedHat Aggregate severity'), ('avgs', 'Archlinux Vulnerability Group Severity')], help_text='vulnerability_id for the scoring system used. Available choices are: cvssv2 is vulnerability_id for CVSSv2 Base Score system, cvssv2_vector is vulnerability_id for CVSSv2 Vector system, cvssv3 is vulnerability_id for CVSSv3 Base Score system, cvssv3_vector is vulnerability_id for CVSSv3 Vector system, cvssv3.1 is vulnerability_id for CVSSv3.1 Base Score system, cvssv3.1_vector is vulnerability_id for CVSSv3.1 Vector system, rhbs is vulnerability_id for RedHat Bugzilla severity system, rhas is vulnerability_id for RedHat Aggregate severity system, avgs is vulnerability_id for Archlinux Vulnerability Group Severity system ', max_length=50)),
9595
('reference', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='vulnerabilities.VulnerabilityReference')),
9696
('vulnerability', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='vulnerabilities.Vulnerability')),
9797
],

vulnerabilities/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,16 @@ def __str__(self):
240240

241241
class VulnerabilitySeverity(models.Model):
242242

243-
scoring_system_choices = ((system.vulnerability_id, system.name) for system in scoring_systems.values()) # nopep8
243+
scoring_system_choices = ((system.identifier, system.name) for system in scoring_systems.values()) # nopep8
244244
vulnerability = models.ForeignKey(Vulnerability, on_delete=models.CASCADE)
245245
value = models.CharField(max_length=50, help_text="Example: 9.0, Important, High")
246246
scoring_system = models.CharField(
247247
max_length=50,
248248
choices=scoring_system_choices,
249-
help_text="vulnerability_id for the scoring system used. Available choices are: {} ".format(
249+
help_text="identifier for the scoring system used. Available choices are: {} ".format(
250250
", ".join(
251251
[
252-
f"{ss.vulnerability_id} is vulnerability_id for {ss.name} system"
252+
f"{ss.identifier} is vulnerability_id for {ss.name} system"
253253
for ss in scoring_systems.values()
254254
]
255255
))

vulnerabilities/severity_systems.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
@dataclasses.dataclass
55
class ScoringSystem:
66

7-
# a short vulnerability_id for the scoring system.
8-
vulnerability_id: str
7+
# a short identifier for the scoring system.
8+
identifier: str
99
# a name which represents the scoring system such as `RedHat bug severity`.
1010
# This is for human understanding
1111
name: str
@@ -25,25 +25,25 @@ def as_score(self, value):
2525

2626
scoring_systems = {
2727
"cvssv2": ScoringSystem(
28-
vulnerability_id="cvssv2",
28+
identifier="cvssv2",
2929
name="CVSSv2 Base Score",
3030
url="https://www.first.org/cvss/v2/",
3131
notes="cvssv2 base score",
3232
),
3333
"cvssv2_vector": ScoringSystem(
34-
vulnerability_id="cvssv2_vector",
34+
identifier="cvssv2_vector",
3535
name="CVSSv2 Vector",
3636
url="https://www.first.org/cvss/v2/",
3737
notes="cvssv2 vector, used to get additional info about nature and severity of vulnerability", # nopep8
3838
),
3939
"cvssv3": ScoringSystem(
40-
vulnerability_id="cvssv3",
40+
identifier="cvssv3",
4141
name="CVSSv3 Base Score",
4242
url="https://www.first.org/cvss/v3-0/",
4343
notes="cvssv3 base score",
4444
),
4545
"cvssv3_vector": ScoringSystem(
46-
vulnerability_id="cvssv3_vector",
46+
identifier="cvssv3_vector",
4747
name="CVSSv3 Vector",
4848
url="https://www.first.org/cvss/v3-0/",
4949
notes="cvssv3 vector, used to get additional info about nature and severity of vulnerability", # nopep8
@@ -61,12 +61,12 @@ def as_score(self, value):
6161
notes="cvssv3.1 vector, used to get additional info about nature and severity of vulnerability", # nopep8
6262
),
6363
"rhbs": ScoringSystem(
64-
vulnerability_id="rhbs",
64+
identifier="rhbs",
6565
name="RedHat Bugzilla severity",
6666
url="https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity",
6767
),
6868
"rhas": ScoringSystem(
69-
vulnerability_id="rhas",
69+
identifier="rhas",
7070
name="RedHat Aggregate severity",
7171
url="https://access.redhat.com/security/updates/classification/",
7272
),

vulnerabilities/tests/test_apache_kafka.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_to_advisory(self):
9393
reference_id="CVE-2018-17196",
9494
),
9595
],
96-
cve_id="CVE-2018-17196",
96+
vulnerability_id="CVE-2018-17196",
9797
)
9898
]
9999
with open(TEST_DATA) as f:

vulnerabilities/tests/test_suse_scores.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_to_advisory(self):
8686
],
8787
)
8888
],
89-
cve_id="CVE-2004-0230",
89+
vulnerability_id="CVE-2004-0230",
9090
),
9191
Advisory(
9292
summary="",
@@ -118,7 +118,7 @@ def test_to_advisory(self):
118118
],
119119
)
120120
],
121-
cve_id="CVE-2003-1605",
121+
vulnerability_id="CVE-2003-1605",
122122
),
123123
]
124124

0 commit comments

Comments
 (0)