Skip to content

Commit 921e99a

Browse files
authored
Fixes UTF-8 issues when computing Hashes
Fixes an issue where reports containing certain characters were not being properly decoded by `str(self.description)` Waiting for @madchap to also confirm that snyk reports are coming in nicely with these changes .
1 parent 5908433 commit 921e99a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

dojo/models.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ class Meta:
10781078
ordering = ('numerical_severity', '-date', 'title')
10791079

10801080
def compute_hash_code(self):
1081-
hash_string = self.title + str(self.cwe) + str(self.line) + str(self.file_path) + str(self.description).decode('utf-8')
1081+
hash_string = self.title + str(self.cwe) + str(self.line) + str(self.file_path) + self.description
10821082

10831083
if self.dynamic_finding:
10841084
endpoint_str = u''
@@ -1091,8 +1091,7 @@ def compute_hash_code(self):
10911091
return hashlib.sha256(hash_string.encode('utf-8')).hexdigest()
10921092
except:
10931093
hash_string = hash_string.strip()
1094-
1095-
return hashlib.sha256(hash_string).hexdigest()
1094+
return hashlib.sha256(hash_string).hexdigest()
10961095

10971096

10981097
def duplicate_finding_set(self):

0 commit comments

Comments
 (0)