CWE(s) in Kotlin not being detected by java-kotlin queries?
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
從 CWE-1204 查詢說明及其連結的測試 java/ql/test/query-tests/security/CWE-1204/StaticInitializationVector.java 開始,接著將該 Java 案例與 issue 中的 Kotlin 範例進行比較。檢查 java/telemetry/unsupported-external-api 的 SARIF 項目,並判斷是否涵蓋 Kotlin ByteArray 處理。完成的標準是確認相容性差距,並找出所需的查詢或文件變更。
由索引模型根據 Issue 內容生成。
描述
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?__
- 主要語言
- CodeQL
- 星號
- 10.1k
- 分支
- 2.1k
- 平均合併
- 2 天 18 小時
- 30 天內合併 PR
- 153
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
github/codeql 的其他 Issue
-
agentic-workflows
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 1 天內回覆
-
false-positive javascript
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
false-positive
難度 2/5 1-3 小時 新手友好度 70/100
github/codeql#21076 · 3 則留言 · 3 個 reaction ·
維護者通常 1 天內回覆
相似的 Issue
-
security
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
area/profiles comp/tui duplicate P3 type/bug
難度 2/5 1-3 小時 新手友好度 86/100
NousResearch/hermes-agent#124852 ·
維護者通常 1 天內回覆
-
bug status/needs-triage
難度 2/5 1-3 小時 新手友好度 86/100
prowler-cloud/prowler#12885 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 90/100
JPHutchins/code-review#262 ·
維護者通常 1 天內回覆
-
owner:devin P3 security server
難度 2/5 1-3 小時 新手友好度 76/100
thetangstr/agentdash#811 ·
維護者通常 1 天內回覆