Skip to content

Commit 24ac437

Browse files
Store fingerprint from bearer in unique_id_from_tool (#12346)
* Store fingerprint from bearer in unique_id_from_tool * Update dojo/tools/bearer_cli/parser.py * Updated bearer unit test to assert on the fingerprint being set into unique_id_from_tool --------- Co-authored-by: valentijnscholten <valentijnscholten@gmail.com>
1 parent 7c29ecf commit 24ac437

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

dojo/settings/settings.dist.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,7 @@ def saml2_attrib_map_format(din):
15841584
"MobSF Scorecard Scan": DEDUPE_ALGO_HASH_CODE,
15851585
"OSV Scan": DEDUPE_ALGO_HASH_CODE,
15861586
"Nosey Parker Scan": DEDUPE_ALGO_UNIQUE_ID_FROM_TOOL_OR_HASH_CODE,
1587+
# The bearer fingerprint is not unique across multiple scans, so it shouldn't be used for deduplication (https://github.com/DefectDojo/django-DefectDojo/pull/12346#issuecomment-2841561634)
15871588
"Bearer CLI": DEDUPE_ALGO_HASH_CODE,
15881589
"Wiz Scan": DEDUPE_ALGO_UNIQUE_ID_FROM_TOOL_OR_HASH_CODE,
15891590
"Deepfence Threatmapper Report": DEDUPE_ALGO_HASH_CODE,

dojo/tools/bearer_cli/parser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def get_findings(self, file, test):
4646
sast_source_line=bearerfinding["source"]["start"],
4747
sast_source_file_path=bearerfinding["filename"],
4848
vuln_id_from_tool=bearerfinding["id"],
49+
# the fingerprint is not constant over time, but because it's not used for dedupe it's safe and useful to set it
50+
unique_id_from_tool=bearerfinding["fingerprint"],
4951
)
5052

5153
items.append(finding)

unittests/tools/test_bearer_cli_parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def test_bearer_parser_with_one_vuln_has_one_findings(self):
2020
self.assertEqual("https://docs.bearer.com/reference/rules/javascript_lang_dangerous_insert_html", findings[0].references)
2121
self.assertEqual("js/adminer/editing.js", findings[0].file_path)
2222
self.assertEqual(581, findings[0].line)
23+
self.assertEqual("804174abc284c6bc747d886b3e9ba757_0", findings[0].unique_id_from_tool)
2324

2425
def test_bearer_parser_with_many_vuln_has_many_findings(self):
2526
testfile = (get_unit_tests_scans_path("bearer_cli") / "bearer_cli_many_vul.json").open(encoding="utf-8")

0 commit comments

Comments
 (0)