From 278c4790f404a4ae317613ecb8ca1491c2d98f7b Mon Sep 17 00:00:00 2001 From: Manuel Sommer Date: Mon, 22 Jan 2024 09:58:24 +0100 Subject: [PATCH 1/2] :tada: add cvssv4 --- dojo/models.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dojo/models.py b/dojo/models.py index 527d58aac2c..08155d07194 100755 --- a/dojo/models.py +++ b/dojo/models.py @@ -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, From bf30c6054c4c77eee00674143d0473a4178910cf Mon Sep 17 00:00:00 2001 From: Manuel Sommer Date: Mon, 22 Jan 2024 10:02:06 +0100 Subject: [PATCH 2/2] add db migrations --- ...199_finding_cvssv4_finding_cvssv4_score.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 dojo/db_migrations/0199_finding_cvssv4_finding_cvssv4_score.py diff --git a/dojo/db_migrations/0199_finding_cvssv4_finding_cvssv4_score.py b/dojo/db_migrations/0199_finding_cvssv4_finding_cvssv4_score.py new file mode 100644 index 00000000000..5aee695761d --- /dev/null +++ b/dojo/db_migrations/0199_finding_cvssv4_finding_cvssv4_score.py @@ -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'), + ), + ]