Skip to content

Commit 9605218

Browse files
authored
Merge pull request DefectDojo#9954 from DefectDojo/release/2.33.4
Release: Merge release into master from: release/2.33.4
2 parents 7fe7670 + fd6dcae commit 9605218

File tree

16 files changed

+145
-87
lines changed

16 files changed

+145
-87
lines changed

.github/workflows/detect-merge-conflicts.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: check if prs are conflicted
19-
uses: eps1lon/actions-label-merge-conflict@releases/2.x
19+
uses: eps1lon/actions-label-merge-conflict@v3
2020
with:
2121
dirtyLabel: "conflicts-detected"
2222
repoToken: "${{ secrets.GITHUB_TOKEN }}"

components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "defectdojo",
3-
"version": "2.33.3",
3+
"version": "2.33.4",
44
"license" : "BSD-3-Clause",
55
"private": true,
66
"dependencies": {

docker/entrypoint.sh

Lines changed: 0 additions & 55 deletions
This file was deleted.

dojo/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
# Django starts so that shared_task will use this app.
55
from .celery import app as celery_app # noqa: F401
66

7-
__version__ = '2.33.3'
7+
__version__ = '2.33.4'
88
__url__ = 'https://github.com/DefectDojo/django-DefectDojo'
99
__docs__ = 'https://documentation.defectdojo.com'

dojo/api_v2/serializers.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,6 +1795,13 @@ def validate(self, data):
17951795

17961796
return data
17971797

1798+
def validate_severity(self, value: str) -> str:
1799+
if value not in SEVERITIES:
1800+
raise serializers.ValidationError(
1801+
f"Severity must be one of the following: {SEVERITIES}"
1802+
)
1803+
return value
1804+
17981805
def build_relational_field(self, field_name, relation_info):
17991806
if field_name == "notes":
18001807
return NoteSerializer, {"many": True, "read_only": True}
@@ -1922,6 +1929,13 @@ def validate(self, data):
19221929

19231930
return data
19241931

1932+
def validate_severity(self, value: str) -> str:
1933+
if value not in SEVERITIES:
1934+
raise serializers.ValidationError(
1935+
f"Severity must be one of the following: {SEVERITIES}"
1936+
)
1937+
return value
1938+
19251939

19261940
class VulnerabilityIdTemplateSerializer(serializers.ModelSerializer):
19271941
class Meta:
@@ -1998,6 +2012,13 @@ class Meta:
19982012
model = Stub_Finding
19992013
fields = "__all__"
20002014

2015+
def validate_severity(self, value: str) -> str:
2016+
if value not in SEVERITIES:
2017+
raise serializers.ValidationError(
2018+
f"Severity must be one of the following: {SEVERITIES}"
2019+
)
2020+
return value
2021+
20012022

20022023
class StubFindingCreateSerializer(serializers.ModelSerializer):
20032024
test = serializers.PrimaryKeyRelatedField(queryset=Test.objects.all())
@@ -2009,6 +2030,13 @@ class Meta:
20092030
"reporter": {"default": serializers.CurrentUserDefault()},
20102031
}
20112032

2033+
def validate_severity(self, value: str) -> str:
2034+
if value not in SEVERITIES:
2035+
raise serializers.ValidationError(
2036+
f"Severity must be one of the following: {SEVERITIES}"
2037+
)
2038+
return value
2039+
20122040

20132041
class ProductSerializer(TaggitSerializer, serializers.ModelSerializer):
20142042
findings_count = serializers.SerializerMethodField()
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 4.1.13 on 2024-04-17 17:59
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('dojo', '0208_merge_acunetix'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='finding',
15+
name='severity',
16+
field=models.CharField(help_text='The severity level of this flaw (Critical, High, Medium, Low, Info).', max_length=200, verbose_name='Severity'),
17+
),
18+
]

dojo/fixtures/defect_dojo_sample_data.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10190,7 +10190,7 @@
1019010190
"cvssv3": null,
1019110191
"cvssv3_score": null,
1019210192
"url": null,
10193-
"severity": "HIGH",
10193+
"severity": "High",
1019410194
"description": "test finding",
1019510195
"mitigation": "test mitigation",
1019610196
"impact": "HIGH",
@@ -10259,7 +10259,7 @@
1025910259
"cvssv3": null,
1026010260
"cvssv3_score": null,
1026110261
"url": null,
10262-
"severity": "HIGH",
10262+
"severity": "High",
1026310263
"description": "test finding",
1026410264
"mitigation": "test mitigation",
1026510265
"impact": "HIGH",
@@ -10328,7 +10328,7 @@
1032810328
"cvssv3": null,
1032910329
"cvssv3_score": null,
1033010330
"url": null,
10331-
"severity": "HIGH",
10331+
"severity": "High",
1033210332
"description": "test finding",
1033310333
"mitigation": "test mitigation",
1033410334
"impact": "HIGH",
@@ -10397,7 +10397,7 @@
1039710397
"cvssv3": null,
1039810398
"cvssv3_score": null,
1039910399
"url": null,
10400-
"severity": "HIGH",
10400+
"severity": "High",
1040110401
"description": "test finding",
1040210402
"mitigation": "test mitigation",
1040310403
"impact": "HIGH",
@@ -10466,7 +10466,7 @@
1046610466
"cvssv3": null,
1046710467
"cvssv3_score": null,
1046810468
"url": null,
10469-
"severity": "HIGH",
10469+
"severity": "High",
1047010470
"description": "test finding",
1047110471
"mitigation": "test mitigation",
1047210472
"impact": "HIGH",
@@ -10535,7 +10535,7 @@
1053510535
"cvssv3": null,
1053610536
"cvssv3_score": null,
1053710537
"url": "http://www.example.com",
10538-
"severity": "HIGH",
10538+
"severity": "High",
1053910539
"description": "TEST finding",
1054010540
"mitigation": "MITIGATION",
1054110541
"impact": "HIGH",
@@ -34058,7 +34058,7 @@
3405834058
"fields": {
3405934059
"title": "test stub finding 1",
3406034060
"date": "2017-12-20",
34061-
"severity": "HIGH",
34061+
"severity": "High",
3406234062
"description": "test stub finding",
3406334063
"test": 3,
3406434064
"reporter": 1
@@ -34070,7 +34070,7 @@
3407034070
"fields": {
3407134071
"title": "test stub finding 2",
3407234072
"date": "2017-12-20",
34073-
"severity": "HIGH",
34073+
"severity": "High",
3407434074
"description": "test stub finding",
3407534075
"test": 14,
3407634076
"reporter": 1
@@ -34082,7 +34082,7 @@
3408234082
"fields": {
3408334083
"title": "test stub finding 3",
3408434084
"date": "2017-12-20",
34085-
"severity": "HIGH",
34085+
"severity": "High",
3408634086
"description": "test stub finding",
3408734087
"test": 13,
3408834088
"reporter": 1
@@ -34096,7 +34096,7 @@
3409634096
"cwe": null,
3409734097
"cve": null,
3409834098
"cvssv3": null,
34099-
"severity": "HIGH",
34099+
"severity": "High",
3410034100
"description": "XSS test template",
3410134101
"mitigation": "",
3410234102
"impact": "",
@@ -34116,7 +34116,7 @@
3411634116
"cwe": null,
3411734117
"cve": null,
3411834118
"cvssv3": null,
34119-
"severity": "HIGH",
34119+
"severity": "High",
3412034120
"description": "SQLi test template",
3412134121
"mitigation": "",
3412234122
"impact": "",

dojo/metrics/views.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -314,15 +314,20 @@ def get_in_period_details(findings):
314314
elif obj.age > 90:
315315
age_detail[3] += 1
316316

317-
in_period_counts[obj.severity] += 1
318-
in_period_counts['Total'] += 1
319-
320-
if obj.test.engagement.product.name not in in_period_details:
321-
in_period_details[obj.test.engagement.product.name] = {
322-
'path': reverse('product_open_findings', args=(obj.test.engagement.product.id,)),
323-
'Critical': 0, 'High': 0, 'Medium': 0, 'Low': 0, 'Info': 0, 'Total': 0}
324-
in_period_details[obj.test.engagement.product.name][obj.severity] += 1
325-
in_period_details[obj.test.engagement.product.name]['Total'] += 1
317+
# This condition should be true in nearly all cases,
318+
# but there are some far edge cases
319+
if obj.severity in in_period_counts:
320+
in_period_counts[obj.severity] += 1
321+
in_period_counts['Total'] += 1
322+
# This condition should be true in nearly all cases,
323+
# but there are some far edge cases
324+
if obj.severity in in_period_details:
325+
if obj.test.engagement.product.name not in in_period_details:
326+
in_period_details[obj.test.engagement.product.name] = {
327+
'path': reverse('product_open_findings', args=(obj.test.engagement.product.id,)),
328+
'Critical': 0, 'High': 0, 'Medium': 0, 'Low': 0, 'Info': 0, 'Total': 0}
329+
in_period_details[obj.test.engagement.product.name][obj.severity] += 1
330+
in_period_details[obj.test.engagement.product.name]['Total'] += 1
326331

327332
return in_period_counts, in_period_details, age_detail
328333

dojo/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2248,7 +2248,7 @@ class Finding(models.Model):
22482248
help_text=_("External reference that provides more information about this flaw.")) # not displayed and pretty much the same as references. To remove?
22492249
severity = models.CharField(max_length=200,
22502250
verbose_name=_('Severity'),
2251-
help_text=_('The severity level of this flaw (Critical, High, Medium, Low, Informational).'))
2251+
help_text=_('The severity level of this flaw (Critical, High, Medium, Low, Info).'))
22522252
description = models.TextField(verbose_name=_('Description'),
22532253
help_text=_("Longer more descriptive information about the flaw."))
22542254
mitigation = models.TextField(verbose_name=_('Mitigation'),

dojo/settings/settings.dist.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,6 @@ def generate_url(scheme, double_slashes, user, password, host, port, path, param
817817
'polymorphic', # provides admin templates
818818
'django.contrib.admin',
819819
'django.contrib.humanize',
820-
'gunicorn',
821820
'auditlog',
822821
'dojo',
823822
'watson',

0 commit comments

Comments
 (0)