Skip to content

Commit

Permalink
Replace magic string with proper enum
Browse files Browse the repository at this point in the history
Co-authored-by: David Redmin <[email protected]>
  • Loading branch information
felddy and dav3r committed Oct 11, 2024
1 parent 8fff2b4 commit e5fdec2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cyhy_db/models/cve_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CVEDoc(Document):
@model_validator(mode="before")
def calculate_severity(cls, values: Dict[str, Any]) -> Dict[str, Any]:
"""Calculate CVE severity based on the CVSS score and version."""
if values["cvss_version"] == "2.0":
if values["cvss_version"] == CVSSVersion.V2:
if values["cvss_score"] == 10:
values["severity"] = 4
elif values["cvss_score"] >= 7.0:
Expand Down

0 comments on commit e5fdec2

Please sign in to comment.