CWE(s) in Kotlin not being detected by java-kotlin queries?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia dalla guida della query CWE-1204 e dal test collegato in java/ql/test/query-tests/security/CWE-1204/StaticInitializationVector.java, quindi confronta quel caso Java con l'esempio Kotlin nell'issue. Ispeziona la voce SARIF per java/telemetry/unsupported-external-api e determina se la gestione di Kotlin ByteArray è coperta. Il lavoro è completato quando è stata stabilita la lacuna di compatibilità e identificata la modifica necessaria alla query o alla documentazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
@Throws(Exception::class)
fun encryptWithZeroStaticIvByteArray(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:
"ruleId": "java/telemetry/unsupported-external-api",
"value": 4,
"message": { "text": "kotlin.ByteArray#ByteArray(int)" }
Questions:
- Is there a known list which queries have been tested and works with Kotlin?
- or a list of queries that is not working with Kotlin?
- Is there anything I can do while waiting for queries to be fully compatible with Kotlin?__
- Lingua principale
- CodeQL
- Stelle
- 10.1k
- Fork
- 2.1k
- Merge medio
- 2g 10h
- PR unite (30g)
- 134
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/codeql
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
C#: cs/simplifiable-boolean-expression false positive on Nullable<bool> compared with a literal Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
false-positive
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
false-positive
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
Tutte le issue di github/codeql
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
sipyourdrink-ltd/bernstein#6191 ·
-
security severity:low track:open-source
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
[addtool] DeepZero Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
gwen001/offsectools_www#2055 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
WalletConnect/actions#112 ·