Whether there are Python SDK for Programmatic Access to CodeQL Database Facts
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- developer-experience, tooling
Hướng nghiên cứu
Không có tệp, kiểm thử hoặc điểm vào nào được nêu. Hãy bắt đầu bằng việc xem xét cơ sở dữ liệu CodeQL hiện có và các giao diện truy vấn QL-query, sau đó so sánh chúng với mô hình truy cập Python được đề xuất và giải pháp tạm thời xuất/nhập CSV hiện tại. Công việc chỉ được xem là hoàn tất khi có phạm vi API đã được thống nhất và kế hoạch triển khai, thay vì một thay đổi cục bộ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
CodeQL provides powerful built-in analyses and program representations, such as AST, CFG, data flow, call graphs, and class hierarchies. However, these representations are currently primarily accessed through QL queries after a CodeQL database has been created.
For more complex analyses or for extending CodeQL's existing analyses (e.g., custom data-flow or alias analyses), implementing everything directly in QL can become quite difficult and cumbersome.
Currently, I use the following workaround:
- Build a CodeQL database for the target project.
- Write basic QL queries to export selected facts to CSV., such as:
- Interested AST nodes and their relationships
- Class/interface information and inheritance relationships
- Call sites and call relationships
- Other program facts relevant to my analysis
Define my own schema and load the CSV facts into memory.
Implement more sophisticated analyses using Python and custom algorithms.
This works, but it requires an additional export/import layer and also means that I have to manually reconstruct program representations that CodeQL already maintains internally. Would it be possible to provide an official Python SDK/API (or another programmatic API) that allows users to directly access the facts stored in a CodeQL database?
For example, something along the lines of:
db = codeql.Database("my-project-db")
ast = db.ast()
cfg = db.cfg()
dataflow = db.dataflow()
classes = db.class_hierarchy()
calls = db.call_graph()
The exact API is not important; the key idea is that Python code could directly access the program facts represented in the CodeQL database, without first exporting them through QL queries. This would make it possible to use CodeQL as a powerful program representation and fact extraction backend, while implementing more complex or experimental analyses in Python.
- Ngôn ngữ chính
- CodeQL
- Star
- 10.1k
- Fork
- 2.1k
- Merge trung bình
- 2 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 129
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/codeql
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
C#: cs/simplifiable-boolean-expression false positive on Nullable<bool> compared with a literal Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
false-positive
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
False positive Đang mởfalse-positive
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
Tất cả issue của github/codeql
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
duckdb/duckdb-python#627 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
phpstan/phpstan-doctrine#794 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
nearform/ag-grid-url-sync#160 ·
-
스택 PR 머지 시 하위 PR base 재지정 단계 부재 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
idean3885/claude-ops-agent#521 ·