You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently did a test with CodeQL on a new Kotlin project, and I included CWE-1204 to get a detection.
I copied the example from documentation and test case. I then used IntelliJ IDEA to convert it from Java to Kotlin.
@Throws(Exception::class)
funencryptWithZeroStaticIvByteArray(key:ByteArray?, plaintext:ByteArray?): ByteArray {
val iv =ByteArray(16) // $Source val ivSpec =GCMParameterSpec(128, iv)
val keySpec =SecretKeySpec(key, "AES")
val cipher =Cipher.getInstance("AES/GCM/PKCS5PADDING")
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec) // $Alert
cipher.update(plaintext)
return cipher.doFinal()
}
I got no detections, and assumed it was an issue with Actions setup, after debugging I decided to test out CWE-117 which I've heard works on Kotlin. After I ran the CI/CD setup it was detected.
I was recommended to try out example from CWE-1204 using a new Java project. After running the CI/CD setup, it was detected.
I spent some time trying to figure out why, decompiling the code, looking at logs. I then looked at sarif file, and I found following rule:
This specific piece here says that CodeQL does not recognize this bit of code and can't trace data through the ByteArray.
I will open a ticket with the team to have a look at this.
There is a short list of queries that are disabled for Kotlin: java/mutually-dependent-types, java/dead-class, java/dead-field, java/dead-function, java/dereferenced-value-may-be-null, java/return-value-ignored, java/non-static-nested-class.
Hi!
I recently did a test with CodeQL on a new Kotlin project, and I included CWE-1204 to get a detection.
I copied the example from documentation and test case. I then used IntelliJ IDEA to convert it from Java to Kotlin.
I got no detections, and assumed it was an issue with Actions setup, after debugging I decided to test out CWE-117 which I've heard works on Kotlin. After I ran the CI/CD setup it was detected.
I was recommended to try out example from CWE-1204 using a new Java project. After running the CI/CD setup, it was detected.
I spent some time trying to figure out why, decompiling the code, looking at logs. I then looked at sarif file, and I found following rule:
Questions:
The text was updated successfully, but these errors were encountered: