Skip to content

Commit 2230a03

Browse files
author
Valentijn Scholten
committed
reimport: support pro hash method
1 parent 6954cba commit 2230a03

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

dojo/importers/default_reimporter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,4 +779,6 @@ def calculate_unsaved_finding_hash_code(
779779
self,
780780
unsaved_finding: Finding,
781781
) -> str:
782+
# this is overridden in Pro, but will still call this via super()
783+
deduplicationLogger.debug("Calculating hash code for unsaved finding")
782784
return unsaved_finding.compute_hash_code()

dojo/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2913,6 +2913,11 @@ def risk_acceptance(self):
29132913
return None
29142914

29152915
def compute_hash_code(self):
2916+
# Allow Pro to overwrite compute hash_code which gets dedupe settings from a database instead of django.settings
2917+
from dojo.utils import get_custom_method # noqa: PLC0415 circular import
2918+
if compute_hash_code_method := get_custom_method("FINDING_COMPUTE_HASH_METHOD"):
2919+
deduplicationLogger.debug("using custom compute_hash_code method")
2920+
return compute_hash_code_method(self)
29162921

29172922
# Check if all needed settings are defined
29182923
if not hasattr(settings, "HASHCODE_FIELDS_PER_SCANNER") or not hasattr(settings, "HASHCODE_ALLOWS_NULL_CWE") or not hasattr(settings, "HASHCODE_ALLOWED_FIELDS"):

0 commit comments

Comments
 (0)