CWE(s) in Kotlin not being detected by java-kotlin queries?
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
調査の方向性
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日 10時間
- マージ済み PR(30日)
- 134
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/codeql のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
C#: cs/simplifiable-boolean-expression false positive on Nullable<bool> compared with a literal オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
false-positive
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
false-positive
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
punkpeye/mcp-remote#369 ·
-
Mend: dependency security vulnerability untriaged
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
cisagov/vulnrichment#337 ·
-
bug DUP Reservations
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
bcgov/reserve-rec-public#896 ·