@@ -71,7 +71,6 @@ def parse_iac_vulnerabilities(
71
71
"description" : (
72
72
f"{ query .get ('description' )} \n \n "
73
73
f"**Category**: { query .get ('category' )} \n " ),
74
- "verified" : query .get ("state" ) != "TO_VERIFY" ,
75
74
"test" : test ,
76
75
}
77
76
# Iterate over the individual issues
@@ -81,6 +80,8 @@ def parse_iac_vulnerabilities(
81
80
date = self ._parse_date (instance .get ("firstDetectionDate" ))
82
81
else :
83
82
date = self ._parse_date (instance .get ("lastDetectionDate" ))
83
+ instance_details = self .determine_state (instance )
84
+ instance_details .update (base_finding_details )
84
85
# Create the finding object
85
86
finding = Finding (
86
87
severity = instance .get ("severity" ).title (),
@@ -90,7 +91,7 @@ def parse_iac_vulnerabilities(
90
91
f"**Actual Value**: { instance .get ('actualValue' )} \n "
91
92
f"**Expected Value**: { instance .get ('expectedValue' )} \n "
92
93
),
93
- ** base_finding_details ,
94
+ ** instance_details ,
94
95
)
95
96
# Add some details to the description
96
97
finding .description += (
@@ -174,14 +175,15 @@ def get_node_snippet(nodes: list) -> str:
174
175
date = self ._parse_date (instance .get ("firstFoundDate" ))
175
176
else :
176
177
date = self ._parse_date (instance .get ("foundDate" ))
178
+ instance_details = self .determine_state (instance )
179
+ instance_details .update (base_finding_details )
177
180
# Create the finding object
178
181
finding = Finding (
179
182
severity = instance .get ("severity" ).title (),
180
183
date = date ,
181
184
file_path = instance .get ("destinationFileName" ),
182
185
line = instance .get ("destinationLine" ),
183
- verified = instance .get ("state" ) != "TO_VERIFY" ,
184
- ** base_finding_details ,
186
+ ** instance_details ,
185
187
)
186
188
# Add some details to the description
187
189
if node_snippet := get_node_snippet (instance .get ("nodes" , [])):
@@ -219,11 +221,9 @@ def parse_vulnerabilities(
219
221
+ "**uri**: " + locations_uri + "\n "
220
222
+ "**startLine**: " + str (locations_startLine ) + "\n "
221
223
+ "**endLine**: " + str (locations_endLine ) + "\n " ,
222
- false_p = False ,
223
- duplicate = False ,
224
- out_of_scope = False ,
225
224
static_finding = True ,
226
225
dynamic_finding = False ,
226
+ ** self .determine_state (result ),
227
227
)
228
228
findings .append (finding )
229
229
return findings
@@ -273,6 +273,7 @@ def get_results_sast(
273
273
test = test ,
274
274
static_finding = True ,
275
275
unique_id_from_tool = unique_id_from_tool ,
276
+ ** self .determine_state (vulnerability ),
276
277
)
277
278
278
279
def get_results_kics (
@@ -290,11 +291,11 @@ def get_results_kics(
290
291
title = description ,
291
292
description = description ,
292
293
severity = vulnerability .get ("severity" ).title (),
293
- verified = vulnerability .get ("state" ) != "TO_VERIFY" ,
294
294
file_path = file_path ,
295
295
test = test ,
296
296
static_finding = True ,
297
297
unique_id_from_tool = unique_id_from_tool ,
298
+ ** self .determine_state (vulnerability ),
298
299
)
299
300
300
301
def get_results_sca (
@@ -311,10 +312,10 @@ def get_results_sca(
311
312
title = description ,
312
313
description = description ,
313
314
severity = vulnerability .get ("severity" ).title (),
314
- verified = vulnerability .get ("state" ) != "TO_VERIFY" ,
315
315
test = test ,
316
316
static_finding = True ,
317
317
unique_id_from_tool = unique_id_from_tool ,
318
+ ** self .determine_state (vulnerability ),
318
319
)
319
320
if (cveId := vulnerability .get ("cveId" )) is not None :
320
321
finding .unsaved_vulnerability_ids = [cveId ]
@@ -332,3 +333,18 @@ def get_findings(self, file, test):
332
333
findings = self .parse_results (test , results )
333
334
334
335
return findings
336
+
337
+ def determine_state (self , data : dict ) -> dict :
338
+ """
339
+ Determine the state of the findings as set by Checkmarx One docs
340
+ https://docs.checkmarx.com/en/34965-68516-managing--triaging--vulnerabilities0.html#UUID-bc2397a3-1614-48bc-ff2f-1bc342071c5a_UUID-ad4991d6-161f-f76e-7d04-970f158eff9b
341
+ """
342
+ state = data .get ("state" )
343
+ return {
344
+ "active" : state in {"TO_VERIFY" , "PROPOSED_NOT_EXPLOITABLE" , "CONFIRMED" , "URGENT" },
345
+ "verified" : state in {"NOT_EXPLOITABLE" , "CONFIRMED" , "URGENT" },
346
+ "false_p" : state == "NOT_EXPLOITABLE" ,
347
+ # These are not managed by checkmarx one, but is nice to explicitly set them
348
+ "duplicate" : False ,
349
+ "out_of_scope" : False ,
350
+ }
0 commit comments