Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 4.2.25 on 2025-12-31 10:45

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("vulnerabilities", "0108_advisoryv2_advisory_latest_by_avid_idx"),
]

operations = [
migrations.AlterField(
model_name="advisoryseverity",
name="scoring_elements",
field=models.CharField(
help_text="Supporting scoring elements used to compute the score values. For example a CVSS vector string as used to compute a CVSS score.",
max_length=250,
null=True,
),
),
migrations.AlterField(
model_name="vulnerabilityseverity",
name="scoring_elements",
field=models.CharField(
help_text="Supporting scoring elements used to compute the score values. For example a CVSS vector string as used to compute a CVSS score.",
max_length=250,
null=True,
),
),
]
4 changes: 2 additions & 2 deletions vulnerabilities/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class VulnerabilitySeverity(models.Model):
value = models.CharField(max_length=50, help_text="Example: 9.0, Important, High")

scoring_elements = models.CharField(
max_length=150,
max_length=250,
null=True,
help_text="Supporting scoring elements used to compute the score values. "
"For example a CVSS vector string as used to compute a CVSS score.",
Expand Down Expand Up @@ -2565,7 +2565,7 @@ class AdvisorySeverity(models.Model):
value = models.CharField(max_length=50, help_text="Example: 9.0, Important, High", null=True)

scoring_elements = models.CharField(
max_length=150,
max_length=250,
null=True,
help_text="Supporting scoring elements used to compute the score values. "
"For example a CVSS vector string as used to compute a CVSS score.",
Expand Down
15 changes: 15 additions & 0 deletions vulnerabilities/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
from vulnerabilities.importer import AdvisoryData
from vulnerabilities.importer import AffectedPackage
from vulnerabilities.importer import Reference
from vulnerabilities.models import AdvisorySeverity
from vulnerabilities.models import Alias
from vulnerabilities.models import Package
from vulnerabilities.models import Patch
from vulnerabilities.models import Vulnerability
from vulnerabilities.severity_systems import CVSSV4
from vulnerabilities.utils import compute_content_id


Expand Down Expand Up @@ -720,3 +722,16 @@ def test_constraint_none_empty(self):
with self.assertRaises(IntegrityError) as raised:
Patch.objects.create(patch_url=None, patch_text="")
self.assertIn("patch_url_or_patch_text", str(raised.exception))


class TestStoreLongCVSSV4(TestCase):
@pytest.mark.django_db
def test_constraint_none(self):
AdvisorySeverity.objects.create(
scoring_system=CVSSV4,
scoring_elements="CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:P/VC:N/VI:N/VA:N/SC:H/SI:H/SA:H/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
)
AdvisorySeverity.objects.create(
scoring_system=CVSSV4,
scoring_elements="CVSS:4.0/AV:P/AC:H/AT:P/PR:H/UI:A/VC:L/VI:L/VA:H/SC:H/SI:L/SA:L/E:A/CR:M/IR:M/AR:M/MAV:A/MAC:L/MAT:P/MPR:L/MVC:L/MVI:L/MVA:L/MSC:H/MSI:H/MSA:H/S:P/AU:Y/R:U/V:C/RE:M/U:Amber",
)
Loading