Skip to content

Commit b9862b4

Browse files
authored
Merge pull request #10885 from DefectDojo/release/2.38.1
Release: Merge release into master from: release/2.38.1
2 parents ac1e87c + ef35d4c commit b9862b4

34 files changed

Lines changed: 5117 additions & 15 deletions

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.38.0",
3+
"version": "2.38.1",
44
"license" : "BSD-3-Clause",
55
"private": true,
66
"dependencies": {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: "Legitify"
3+
toc_hide: true
4+
---
5+
### File Types
6+
This DefectDojo parser accepts JSON files (in flattened format) from Legitify. For further details regarding the results, please consult the relevant [documentation](https://github.com/Legit-Labs/legitify?tab=readme-ov-file#output-options).
7+
8+
### Sample Scan Data
9+
Sample scan data for testing purposes can be found [here](https://github.com/DefectDojo/django-DefectDojo/tree/master/unittests/scans/legitify).
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: "Threat Composer"
3+
toc_hide: true
4+
---
5+
### File Types
6+
This DefectDojo parser accepts JSON files from Threat Composer. The tool supports the [export](https://github.com/awslabs/threat-composer/tree/main?#features) of JSON report out of the browser local storage to a local file.
7+
8+
### Sample Scan Data
9+
Sample scan data for testing purposes can be found [here](https://github.com/DefectDojo/django-DefectDojo/tree/master/unittests/scans/threat_composer).

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.38.0"
7+
__version__ = "2.38.1"
88
__url__ = "https://github.com/DefectDojo/django-DefectDojo"
99
__docs__ = "https://documentation.defectdojo.com"

dojo/api_v2/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ class TestTypeSerializer(TaggitSerializer, serializers.ModelSerializer):
14111411

14121412
class Meta:
14131413
model = Test_Type
1414-
fields = "__all__"
1414+
exclude = ("dynamically_generated",)
14151415

14161416

14171417
class TestToNotesSerializer(serializers.Serializer):
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.0.8 on 2024-09-04 19:23
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('dojo', '0213_system_settings_enable_ui_table_based_searching'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='test_type',
15+
name='dynamically_generated',
16+
field=models.BooleanField(default=False, help_text='Set to True for test types that are created at import time'),
17+
),
18+
]

dojo/forms.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def __init__(self, *args, **kwargs):
285285
class Test_TypeForm(forms.ModelForm):
286286
class Meta:
287287
model = Test_Type
288-
exclude = [""]
288+
exclude = ["dynamically_generated"]
289289

290290

291291
class Development_EnvironmentForm(forms.ModelForm):
@@ -321,6 +321,8 @@ class ProductForm(forms.ModelForm):
321321
def __init__(self, *args, **kwargs):
322322
super().__init__(*args, **kwargs)
323323
self.fields["prod_type"].queryset = get_authorized_product_types(Permissions.Product_Type_Add_Product)
324+
if prod_type_id := getattr(kwargs.get("instance", Product()), "prod_type_id"): # we are editing existing instance
325+
self.fields["prod_type"].queryset |= Product_Type.objects.filter(pk=prod_type_id) # even if user does not have permission for any other ProdType we need to add at least assign ProdType to make form submittable (otherwise empty list was here which generated invalid form)
324326

325327
# if this product has findings being asynchronously updated, disable the sla config field
326328
if self.instance.async_updating:

dojo/importers/base_importer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,8 @@ def get_or_create_test_type(
491491
test_type, created = Test_Type.objects.get_or_create(name=test_type_name)
492492
if created:
493493
logger.info(f"Created new Test_Type with name {test_type.name} because a report is being imported")
494+
test_type.dynamically_generated = True
495+
test_type.save()
494496
return test_type
495497

496498
def verify_tool_configuration_from_test(self):

dojo/importers/default_reimporter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ def finding_post_processing(
704704
finding.unsaved_files = finding_from_report.unsaved_files
705705
self.process_files(finding)
706706
# Process vulnerability IDs
707+
if finding_from_report.unsaved_vulnerability_ids:
708+
finding.unsaved_vulnerability_ids = finding_from_report.unsaved_vulnerability_ids
707709
finding = self.process_vulnerability_ids(finding)
708710

709711
return finding

dojo/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,9 @@ class Test_Type(models.Model):
817817
static_tool = models.BooleanField(default=False)
818818
dynamic_tool = models.BooleanField(default=False)
819819
active = models.BooleanField(default=True)
820+
dynamically_generated = models.BooleanField(
821+
default=False,
822+
help_text=_("Set to True for test types that are created at import time"))
820823

821824
class Meta:
822825
ordering = ("name",)

0 commit comments

Comments
 (0)