github / github/codeql

Java: static field access of unknown class breaks dataflow (build-mode=none)

Đang mở
#19,597 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
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ả

This is another issue we encountered when analysing databases created with `build-mode=none`.
It appears that dataflow graphs are broken when static fields are accessed on unknown classes.
Please take a look [codeql_issue2.zip](https://github.com/user-attachments/files/20458091/codeql_issue2.zip) for more information.

Here is the example java code:
```
// This import is from a dependency that is not resolved
import com.foo.mycompany.UnknownClass;

public class DataFlowNotConnected {
static class MyClass {
public static String staticField = "static";
}

private int run() {
// data source 1 should flow to sink e and f, but dataflow is broken by UnknownClass.staticField
int a = 1;
int b = a;

// static class field access from known class
String staticField1 = MyClass.staticField;

int c = b;
int d = c;

// static class field access from unknown class breaks dataflow
String staticField2 = UnknownClass.staticField;

int e = d;
int f = e;

return f;
}
}
```

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

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

Hướng nghiên cứu

Start by reproducing the example from codeql_issue2.zip with build-mode=none, focusing on the Java dataflow graph around UnknownClass.staticField. Compare the graph with and without that static access; done means the flow from a through d remains connected to sinks e and f.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
devtools, security
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

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.