summaryrefslogtreecommitdiff
path: root/checklists/models.py
diff options
context:
space:
mode:
authorSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2026-05-06 12:49:41 +0200
committerJacob Walls <jacobtylerwalls@gmail.com>2026-05-07 11:41:40 -0400
commit2469b99c2217d08c4772578469c6499b3d18ba7c (patch)
tree692f5cf42d2d7005c08fcb9b3484a519894c8502 /checklists/models.py
parent0c05b1b09f67838af63a3e99655a83f9a65e4e82 (diff)
[checklists] Added RegexValidator to cve_year_number to ensure created issues are compatible with cve_sort_key.
Diffstat (limited to 'checklists/models.py')
-rw-r--r--checklists/models.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/checklists/models.py b/checklists/models.py
index ad44dbf7..41b9a2b1 100644
--- a/checklists/models.py
+++ b/checklists/models.py
@@ -2,7 +2,7 @@ import datetime
import json
from django.contrib.auth.models import User
-from django.core.validators import MaxValueValidator, MinValueValidator
+from django.core.validators import MaxValueValidator, MinValueValidator, RegexValidator
from django.db import models
from django.db.models.functions import Cast, Substr
from django.shortcuts import reverse
@@ -467,7 +467,11 @@ class SecurityIssue(models.Model):
choices=[(i, i) for i in ("DSF", "MITRE")],
)
cve_year_number = models.CharField(
- "CVE ID", max_length=1024, unique=True, default=get_cve_default
+ "CVE ID",
+ max_length=1024,
+ unique=True,
+ default=get_cve_default,
+ validators=[RegexValidator(regex=r"CVE-\d{4}-\d{4,5}")],
)
objects = SecurityIssueManager()