github / github/codeql

Github Code Scanning - false positive: Contradictory type checks

Đang mở
#6,638 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
false-positive Java
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

**Description of the false positive**
The alert indicates that the variable `response` cannot be of type `HttpServletResponse` here, since [this expression](https://github.com/ganeshkumarsv/dd-trace-java/blob/3954d6e79259ad9ef0781710057b3a3229df1b37/dd-java-agent/instrumentation/servlet/request-2/src/main/java/datadog/trace/instrumentation/servlet2/Servlet2Advice.java#L95) ensures that it is not of type `HttpServletResponse`.

I think there is a bug in the query/tool as it misunderstood this independent if block [here](https://github.com/ganeshkumarsv/dd-trace-java/blob/3954d6e79259ad9ef0781710057b3a3229df1b37/dd-java-agent/instrumentation/servlet/request-2/src/main/java/datadog/trace/instrumentation/servlet2/Servlet2Advice.java#L102) as else if block, thats why it says the expression is guaranteed to return false as it failed in [line 95](https://github.com/ganeshkumarsv/dd-trace-java/blob/3954d6e79259ad9ef0781710057b3a3229df1b37/dd-java-agent/instrumentation/servlet/request-2/src/main/java/datadog/trace/instrumentation/servlet2/Servlet2Advice.java#L95)

**URL to the Github Code Scanning alert**
https://github.com/ganeshkumarsv/dd-trace-java/security/code-scanning/61

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.