github / github/codeql

java: false positive: javax.validation.constraints are not identified as input validation

未關閉
#8,705 8 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
false-positive
主要語言
CodeQL
星號
10.1k
分支
2.1k
平均合併
2 天 15 小時
30 天內合併 PR
141

描述

**Description of the false positive**

`java.validation.constraints.*` are not identified for input validation. For example in following example the `id` path param is considered to be insecure.

Example
```java
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public interface API {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/api/v1/thing/{id}")
Something get(@NotNull @PathParam("id") @Min(1) @Max(30) @DefaultValue("1") Integer id);
}
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。