diff --git a/src/main/kotlin/com/bridgecrew/CheckovResult.kt b/src/main/kotlin/com/bridgecrew/CheckovResult.kt index af22b32..cb976a3 100644 --- a/src/main/kotlin/com/bridgecrew/CheckovResult.kt +++ b/src/main/kotlin/com/bridgecrew/CheckovResult.kt @@ -52,7 +52,11 @@ data class CheckovResult( data class Metadata( val code_locations: List?, - val taint_mode: List? + val taint_mode: TaintMode? +) + +data class TaintMode( + val data_flow: List? ) data class DataFlow( diff --git a/src/main/kotlin/com/bridgecrew/ui/rightPanel/dictionaryDetails/WeaknessDictionaryPanel.kt b/src/main/kotlin/com/bridgecrew/ui/rightPanel/dictionaryDetails/WeaknessDictionaryPanel.kt index 4bbeb19..d9731b5 100644 --- a/src/main/kotlin/com/bridgecrew/ui/rightPanel/dictionaryDetails/WeaknessDictionaryPanel.kt +++ b/src/main/kotlin/com/bridgecrew/ui/rightPanel/dictionaryDetails/WeaknessDictionaryPanel.kt @@ -51,7 +51,7 @@ class WeaknessDictionaryPanel(private val result: WeaknessCheckovResult, private } private fun extractDataFlow(result: WeaknessCheckovResult): String? { - val dataFlow = result.metadata?.code_locations ?: result.metadata?.taint_mode + val dataFlow = result.metadata?.code_locations ?: result.metadata?.taint_mode?.data_flow if (dataFlow !== null) { return this.calculateDataFlow(dataFlow); } @@ -66,7 +66,7 @@ class WeaknessDictionaryPanel(private val result: WeaknessCheckovResult, private private fun getDataFlowDictionary(result: WeaknessCheckovResult): Array? { - val dataFlow = result.metadata?.code_locations ?: result.metadata?.taint_mode + val dataFlow = result.metadata?.code_locations ?: result.metadata?.taint_mode?.data_flow if (dataFlow !== null) { return dataFlow.map { diff --git a/src/test/kotlin/com/bridgecrew/fixtures/WeaknessCheckovResultFixture.kt b/src/test/kotlin/com/bridgecrew/fixtures/WeaknessCheckovResultFixture.kt index af2bc21..cce77f9 100644 --- a/src/test/kotlin/com/bridgecrew/fixtures/WeaknessCheckovResultFixture.kt +++ b/src/test/kotlin/com/bridgecrew/fixtures/WeaknessCheckovResultFixture.kt @@ -35,29 +35,31 @@ const val metadataCodeCollectionJson = """ const val metadataTaintModeJson = """ "metadata": { - "taint_mode": [{ - "path": "/Users/sast-core/tests_policies/src/python/EncryptionKeySize.py", - "start": { - "row": 13, - "column": 0 - }, - "end": { - "row": 13, - "column": 66 - }, - "code_block": "cryptography.hazmat.primitives.asymmetric.rsa.generate_private_key" - }, { - "path": "/Users/sast-core/tests_policies/src/python/EncryptionKeySize.py", - "start": { - "row": 14, - "column": 73 - }, - "end": { - "row": 15, - "column": 86 - }, - "code_block": "key_size=size" - }] + "taint_mode":{ + "data_flow": [{ + "path": "/Users/sast-core/tests_policies/src/python/EncryptionKeySize.py", + "start": { + "row": 13, + "column": 0 + }, + "end": { + "row": 13, + "column": 66 + }, + "code_block": "cryptography.hazmat.primitives.asymmetric.rsa.generate_private_key" + }, { + "path": "/Users/sast-core/tests_policies/src/python/EncryptionKeySize.py", + "start": { + "row": 14, + "column": 73 + }, + "end": { + "row": 15, + "column": 86 + }, + "code_block": "key_size=size" + }] + } }, """