Skip to content

Commit

Permalink
🐛 fix kics, #7966 (#9542)
Browse files Browse the repository at this point in the history
* 🐛 fix kics, #7966

* 🐛 fix unittests

* add hashcode according to review

* update to retrigger failed pipeline
  • Loading branch information
manuel-sommer authored Feb 20, 2024
1 parent ba3af04 commit fc27a65
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dojo/settings/settings.dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,7 @@ def saml2_attrib_map_format(dict):
'Humble Json Importer': ['title'],
'MSDefender Parser': ['title', 'description'],
'HCLAppScan XML': ['title', 'description'],
'KICS Scan': ['file_path', 'line', 'severity', 'description', 'title'],
'MobSF Scan': ['title', 'description', 'severity'],
}

Expand Down Expand Up @@ -1409,7 +1410,6 @@ def saml2_attrib_map_format(dict):
'Meterian Scan': DEDUPE_ALGO_HASH_CODE,
'Github Vulnerability Scan': DEDUPE_ALGO_HASH_CODE,
'Cloudsploit Scan': DEDUPE_ALGO_HASH_CODE,
'KICS Scan': DEDUPE_ALGO_HASH_CODE,
'SARIF': DEDUPE_ALGO_UNIQUE_ID_FROM_TOOL_OR_HASH_CODE,
'Azure Security Center Recommendations Scan': DEDUPE_ALGO_UNIQUE_ID_FROM_TOOL,
'Hadolint Dockerfile check': DEDUPE_ALGO_HASH_CODE,
Expand Down Expand Up @@ -1452,6 +1452,7 @@ def saml2_attrib_map_format(dict):
'Wazuh Scan': DEDUPE_ALGO_UNIQUE_ID_FROM_TOOL,
'MSDefender Parser': DEDUPE_ALGO_HASH_CODE,
'HCLAppScan XML': DEDUPE_ALGO_HASH_CODE,
'KICS Scan': DEDUPE_ALGO_HASH_CODE,
'MobSF Scan': DEDUPE_ALGO_HASH_CODE,
}

Expand Down
1 change: 1 addition & 0 deletions dojo/tools/kics/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def get_findings(self, filename, test):
+ category
+ issue_type
+ file_name
+ expected_value
+ str(line_number)
).encode("utf-8")
).hexdigest()
Expand Down
6 changes: 3 additions & 3 deletions unittests/tools/test_kics_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_parse_many_findings(self):
testfile = open("unittests/scans/kics/many_findings.json")
parser = KICSParser()
findings = parser.get_findings(testfile, Test())
self.assertEqual(13, len(findings))
self.assertEqual(18, len(findings))
with self.subTest(i=0):
finding = findings[0]
self.assertEqual("Secret Management: Passwords And Secrets In Infrastructure Code", finding.title)
Expand Down Expand Up @@ -129,7 +129,7 @@ def test_parse_many_findings(self):
self.assertEqual(5, finding.line)
self.assertEqual("Terraform", finding.component_name)
self.assertIsNotNone(finding.description)
self.assertEqual(2, finding.nb_occurences)
self.assertEqual(1, finding.nb_occurences)

with self.subTest(i=8):
finding = findings[8]
Expand Down Expand Up @@ -181,7 +181,7 @@ def test_parse_many_findings(self):
self.assertEqual(20, finding.line)
self.assertEqual("Kubernetes", finding.component_name)
self.assertIsNotNone(finding.description)
self.assertEqual(5, finding.nb_occurences)
self.assertEqual(1, finding.nb_occurences)

with self.subTest(i=12):
finding = findings[12]
Expand Down

0 comments on commit fc27a65

Please sign in to comment.