False positive on "Query built by concatenation with a possibly-untrusted string" - "java/concatenated-sql-query"
- 主要語言
- CodeQL
- 星號
- 10.1k
- 分支
- 2.1k
- 平均合併
- 2 天 15 小時
- 30 天內合併 PR
- 141
描述
False positive on `Query built by concatenation with a possibly-untrusted string` - `java/concatenated-sql-query`
* https://github.com/github/codeql/blob/ff0c1ca2d6401e63914f20b650b49c2b82cac148/java/ql/src/Security/CWE/CWE-089/SqlConcatenated.ql
We have a constant value from enum
```
public enum CommentType {
REVIEW_SIMPLE_COMMENT("comment.review.simple"),
SIMPLE_COMMENT("comment.simple");
private final String type;
private CommentType(String type) {
this.type = type;
}
public String getType() {
return this.type;
}
}
```
Used in query
```
sql.append(" AND REVIEW_COMMENT.COMMENT_TYPE = '").append(CommentType.REVIEW_SIMPLE_COMMENT.getType()).append("') ");
```
And CodeQL is stating `Query built by concatenation with a possibly-untrusted string` in `CommentType.REVIEW_SIMPLE_COMMENT.getType()`. From my understanding the enum is immutable. Could you take a look?
貢獻指南
研究方向
從 java/ql/src/Security/CWE/CWE-089/SqlConcatenated.ql 開始,使用提供的 enum 與 SQL 建構範例重現該報告。追蹤 query 如何將衍生自 enum 的值分類為可能不受信任,然後判斷該範例是否仍應被報告。對於此案例,false positive 行為獲得解決或有明確的理由說明,即視為完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java
- 領域
- security
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100