Skip to content

Commit 783292b

Browse files
committed
Make PR review changes for PR #290
* Correct typo in severity_systems.py * Use typo for scoring fields instead of list in models.py * Handle absence of bugzilla and RHSA better in redhat.py Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
1 parent b0aeef5 commit 783292b

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

vulnerabilities/importers/redhat.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ def to_advisory(advisory_data):
7676
affected_purls.append(rpm_to_purl(rpm))
7777

7878
references = []
79-
if advisory_data.get("bugzilla"):
80-
bugzilla = advisory_data.get("bugzilla")
79+
bugzilla = advisory_data.get("bugzilla")
80+
if bugzilla:
8181
url = "https://bugzilla.redhat.com/show_bug.cgi?id={}".format(bugzilla)
8282
bugzilla_data = requests.get(f"https://bugzilla.redhat.com/rest/bug/{bugzilla}").json()
8383
bugzilla_severity_val = bugzilla_data["bugs"][0]["severity"]
@@ -98,7 +98,7 @@ def to_advisory(advisory_data):
9898
# RH provides 3 types of advisories RHSA, RHBA, RHEA. Only RHSA's contain severity score.
9999
# See https://access.redhat.com/articles/2130961 for more details.
100100

101-
if "RHSA" in rh_adv:
101+
if "RHSA" in rh_adv.upper():
102102
rhsa_data = requests.get(f"https://access.redhat.com/hydra/rest/securitydata/cvrf/{rh_adv}.json").json() # nopep8
103103
value = rhsa_data["cvrfdoc"]["aggregate_severity"]
104104
rhsa_aggregate_severity = VulnerabilitySeverity(

vulnerabilities/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def __str__(self):
204204

205205
class VulnerabilitySeverity(models.Model):
206206

207-
scoring_system_choices = [(system.identifier, system.name) for system in scoring_systems.values()] # nopep8
207+
scoring_system_choices = ((system.identifier, system.name) for system in scoring_systems.values()) # nopep8
208208
vulnerability = models.ForeignKey(Vulnerability, on_delete=models.CASCADE)
209209
value = models.CharField(max_length=50, help_text="Example: 9.0, Important, High")
210210
scoring_system = models.CharField(

vulnerabilities/severity_systems.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ScoringSystem:
1717
def as_score(self, value):
1818
"""
1919
Return a normalized numeric score for this scoring system given a raw
20-
value. For instance htis can be used to convert a CVSS vector to a base
20+
value. For instance this can be used to convert a CVSS vector to a base
2121
score.
2222
"""
2323
raise NotImplementedError

0 commit comments

Comments
 (0)