Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
8e23b0a
fix: permission classes for metrics: rename UserHasPermissionMetrics …
Gaviria9601 Nov 17, 2026
6f18381
build(deps): bump ruff from 0.17.4 to 0.17.5
dependabot[bot] Nov 18, 2026
e8f6b2c
build(deps): bump pypdf from 7.0.0 to 7.1.0
dependabot[bot] Nov 18, 2026
d503236
build(deps): bump soupsieve from 4.1 to 4.1.1
dependabot[bot] Nov 18, 2026
8868f8f
build(deps): bump the aws-boto group with 2 updates
dependabot[bot] Nov 18, 2026
c395a06
build(deps): bump django-dbbackup from 5.4.0 to 5.4.1
dependabot[bot] Nov 18, 2026
ebd849f
build(deps): bump argon2-cffi-bindings from 26.1.0 to 26.2.0
dependabot[bot] Nov 18, 2026
351d790
feat: Add engagement ID to devices without findings response
Nov 13, 2026
b3c81bb
build(deps): bump numpy from 2.5.4 to 2.5.5
dependabot[bot] Nov 19, 2026
a75b3d1
build(deps): bump pycryptodome from 4.4.0 to 4.5.0
dependabot[bot] Nov 19, 2026
34e51f3
build(deps): bump pikepdf from 10.18.1 to 10.18.2
dependabot[bot] Nov 19, 2026
e9b2c9e
fix: update create_finding_exclusion to conditionally call add_findin…
Gaviria9601 Nov 18, 2026
eff41a2
fix: Preserve SLA expiration date during finding re-import and increa…
Gaviria9601 Nov 20, 2026
0b88a97
fix: Enhance user permission checks by allowing group access via ID i…
Gaviria9601 Nov 20, 2026
a5fea96
fix: Alter unique_id_from_tool field to increase max_length and impro…
Gaviria9601 Nov 20, 2026
be163f5
Merge branch 'trunk' of https://github.com/bancolombia/django-DefectD…
Gaviria9601 Nov 20, 2026
5d48c73
fix: Update expected query counts in performance tests for reimport f…
Gaviria9601 Nov 20, 2026
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
2 changes: 1 addition & 1 deletion dojo/api_v2/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def has_object_permission(self, request, view, obj):
class UserHasDojoGroupPermission(permissions.BasePermission):
def has_permission(self, request, view):
if request.method == "GET":
if request.query_params.get("name") in GeneralSettings.get_value("GROUP_USER_PERMISSION_VIEW", ["Approvers_Risk"]):
if request.query_params.get("name") in GeneralSettings.get_value("GROUP_USER_PERMISSION_VIEW", ["Approvers_Risk"]) or request.query_params.get("id") in GeneralSettings.get_value("GROUP_USER_PERMISSION_VIEW", ["Approvers_Risk"]):
return True
else:
return user_has_configuration_permission(
Expand Down
2 changes: 2 additions & 0 deletions dojo/api_v2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ class DojoGroupViewSet(
def get_queryset(self):
if self.request.query_params.get("name") in GeneralSettings.get_value("GROUP_USER_PERMISSION_VIEW", []):
return Dojo_Group.objects.filter(name=self.request.query_params.get("name"))
if self.request.query_params.get("id") in GeneralSettings.get_value("GROUP_USER_PERMISSION_VIEW", []):
return Dojo_Group.objects.filter(id=self.request.query_params.get("id"))
else:
return get_authorized_groups(Permissions.Group_View).distinct()

Expand Down
18 changes: 18 additions & 0 deletions dojo/db_migrations/0293_alter_finding_unique_id_from_tool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.2.17 on 2026-11-20 19:50

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dojo', '0292_alter_engagement_long_risk_acceptances'),
]

operations = [
migrations.AlterField(
model_name='finding',
name='unique_id_from_tool',
field=models.CharField(blank=True, help_text='Vulnerability technical id from the source tool. Allows to track unique vulnerabilities over time across subsequent scans.', max_length=6000, null=True, verbose_name='Unique ID from tool'),
),
]
8 changes: 6 additions & 2 deletions dojo/importers/default_reimporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,16 @@ def process_findings(
finding,
unsaved_finding,
)
preserve_sla_expiration_date = bool(matched_findings)
# finding = new finding or existing finding still in the upload report
# to avoid pushing a finding group multiple times, we push those outside of the loop
if self.findings_groups_enabled and self.group_by:
finding.save()
finding.save(preserve_sla_expiration_date=preserve_sla_expiration_date)
else:
finding.save(push_to_jira=self.push_to_jira)
finding.save(
push_to_jira=self.push_to_jira,
preserve_sla_expiration_date=preserve_sla_expiration_date,
)

self.to_mitigate = (set(self.original_items) - set(self.reactivated_items) - set(self.unchanged_items))
# due to #3958 we can have duplicates inside the same report
Expand Down
6 changes: 3 additions & 3 deletions dojo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2815,7 +2815,7 @@ class Finding(models.Model):
on_delete=models.CASCADE)
unique_id_from_tool = models.CharField(null=True,
blank=True,
max_length=3000,
max_length=6000,
verbose_name=_("Unique ID from tool"),
help_text=_("Vulnerability technical id from the source tool. Allows to track unique vulnerabilities over time across subsequent scans."))
vuln_id_from_tool = models.CharField(null=True,
Expand Down Expand Up @@ -2949,7 +2949,7 @@ def update_fields(self, **kwargs):
self.__class__.objects.filter(pk=self.pk).update(**kwargs)

def save(self, dedupe_option=True, rules_option=True, product_grading_option=True, # noqa: FBT002
issue_updater_option=True, push_to_jira=False, user=None, *args, **kwargs): # noqa: FBT002 - this is bit hard to fix nice have this universally fixed
issue_updater_option=True, push_to_jira=False, user=None, *args, preserve_sla_expiration_date: bool = False, **kwargs): # noqa: FBT002 - this is bit hard to fix nice have this universally fixed
logger.debug("Start saving finding of id " + str(self.id) + " dedupe_option:" + str(dedupe_option) + " (self.pk is %s)", "None" if self.pk is None else "not None")
from dojo.finding import helper as finding_helper

Expand Down Expand Up @@ -3021,7 +3021,7 @@ def save(self, dedupe_option=True, rules_option=True, product_grading_option=Tru
self.static_finding = True

# update the SLA expiration date last, after all other finding fields have been updated
if self.active:
if self.active and not preserve_sla_expiration_date:
self.set_sla_expiration_date()

logger.debug("Saving finding of id " + str(self.id) + " dedupe_option:" + str(dedupe_option) + " (self.pk is %s)", "None" if self.pk is None else "not None")
Expand Down
22 changes: 22 additions & 0 deletions unittests/test_import_reimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,28 @@ def test_sonar_detailed_scan_base_active_verified(self):
# no notes expected
self.assertEqual(notes_count_before, self.db_notes_count())

def test_sonar_reimport_preserves_sla_expiration_date(self):
import0 = self.import_scan_with_params(self.sonarqube_file_name1, scan_type=self.scan_type_sonarqube_detailed)
test_id = import0["test"]
finding = Finding.objects.filter(
test_id=test_id,
unique_id_from_tool__isnull=False,
).exclude(severity="Low").first()
self.assertIsNotNone(finding)

original_severity = finding.severity
sla_expiration_date = datetime(2099, 1, 1).date()
Finding.objects.filter(id=finding.id).update(
severity="Low",
sla_expiration_date=sla_expiration_date,
)

self.reimport_scan_with_params(test_id, self.sonarqube_file_name1, scan_type=self.scan_type_sonarqube_detailed)

finding.refresh_from_db()
self.assertEqual(finding.severity, original_severity)
self.assertEqual(finding.sla_expiration_date, sla_expiration_date)

# Test re-import with unique_id_from_tool_or_hash_code algorithm
# import veracode scan, testing:
# - import
Expand Down
12 changes: 6 additions & 6 deletions unittests/test_importers_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ def test_import_reimport_reimport_performance(self):
self.import_reimport_performance(
expected_num_queries1=674,
expected_num_async_tasks1=10,
expected_num_queries2=629,
expected_num_queries2=609,
expected_num_async_tasks2=22,
expected_num_queries3=359,
expected_num_queries3=339,
expected_num_async_tasks3=20,
reconcile_tags=False,
)
Expand All @@ -187,9 +187,9 @@ def test_import_reimport_reimport_performance_no_async(self, mock):
self.import_reimport_performance(
expected_num_queries1=674,
expected_num_async_tasks1=10,
expected_num_queries2=629,
expected_num_queries2=609,
expected_num_async_tasks2=22,
expected_num_queries3=359,
expected_num_queries3=339,
expected_num_async_tasks3=20,
reconcile_tags=False,
)
Expand All @@ -212,9 +212,9 @@ def test_import_reimport_reimport_performance_no_async_with_product_grading(self
self.import_reimport_performance(
expected_num_queries1=694,
expected_num_async_tasks1=15,
expected_num_queries2=654,
expected_num_queries2=639,
expected_num_async_tasks2=28,
expected_num_queries3=379,
expected_num_queries3=364,
expected_num_async_tasks3=25,
reconcile_tags=False,
)
Loading