Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions dojo/db_migrations/0199_finding_cvssv4_finding_cvssv4_score.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.1.13 on 2024-01-22 08:59

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dojo', '0198_alter_system_settings_enable_deduplication'),
]

operations = [
migrations.AddField(
model_name='finding',
name='cvssv4',
field=models.TextField(help_text='Common Vulnerability Scoring System version 4 (CVSSv4) score associated with this flaw.', max_length=117, null=True, validators=[django.core.validators.RegexValidator(message="CVSS must be entered in format: 'AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:N/SA:N'", regex='^AV:[NALP]|AC:[LH]|AT:[NP]|PR:[NLH]|UI:[NPA]|VC:[HLN]|[VI]:[HLN]|[VA]:[HLN]|[SC]:[HLN]|[SI]:[HLN]|[SA]:[HLN]')], verbose_name='CVSS v4'),
),
migrations.AddField(
model_name='finding',
name='cvssv4_score',
field=models.FloatField(blank=True, help_text='Numerical CVSSv4 score for the vulnerability. If the vector is given, the score is updated while saving the finding', null=True, verbose_name='CVSSv4 score'),
),
]
11 changes: 10 additions & 1 deletion dojo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2142,7 +2142,16 @@ class Finding(models.Model):
blank=True,
verbose_name=_('CVSSv3 score'),
help_text=_("Numerical CVSSv3 score for the vulnerability. If the vector is given, the score is updated while saving the finding"))

cvssv4_regex = RegexValidator(regex=r'^AV:[NALP]|AC:[LH]|AT:[NP]|PR:[NLH]|UI:[NPA]|VC:[HLN]|[VI]:[HLN]|[VA]:[HLN]|[SC]:[HLN]|[SI]:[HLN]|[SA]:[HLN]', message="CVSS must be entered in format: 'AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:N/SA:N'")
cvssv4 = models.TextField(validators=[cvssv4_regex],
max_length=117,
null=True,
verbose_name=_('CVSS v4'),
help_text=_('Common Vulnerability Scoring System version 4 (CVSSv4) score associated with this flaw.'))
cvssv4_score = models.FloatField(null=True,
blank=True,
verbose_name=_('CVSSv4 score'),
help_text=_("Numerical CVSSv4 score for the vulnerability. If the vector is given, the score is updated while saving the finding"))
url = models.TextField(null=True,
blank=True,
editable=False,
Expand Down