Whether there are Python SDK for Programmatic Access to CodeQL Database Facts
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 25/100
- Issue 類型
- 功能
- 描述清晰度
- 需要釐清
- 活躍度
- 活躍
- 技術堆疊
- python
研究方向
沒有指定檔案、測試或進入點。先檢視現有的 CodeQL 資料庫和 QL-query 介面,接著將它們與提議的 Python 存取模型以及目前的 CSV 匯出/匯入替代方案進行比較。完成這項工作需要達成共識的 API 範圍和實作計畫,而不是進行局部變更。
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- CodeQL
- 星號
- 10.1k
- 分支
- 2.1k
- 平均合併
- 2 天 17 小時
- 30 天內合併 PR
- 145
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
github/codeql 的其他 Issue
-
agentic-workflows
難度 2/5 1-3 小時 新手友好度 70/100
-
false-positive javascript
難度 2/5 1-3 小時 新手友好度 84/100
-
難度 2/5 1-3 小時 新手友好度 82/100
-
難度 2/5 1-3 小時 新手友好度 78/100
-
false-positive
難度 2/5 1-3 小時 新手友好度 70/100
相似的 Issue
-
kaliscan.com 未關閉N: AdGuard for iOS P3: Medium T: Ads
難度 2/5 1-3 小時 新手友好度 68/100
AdguardTeam/AdguardFilters#242501 ·
-
難度 2/5 1-3 小時 新手友好度 84/100
-
[BUG] createTool tools cannot be registered with Mastra when exactOptionalPropertyTypes is enabled 未關閉customer-eng status: needs triage
難度 2/5 1-3 小時 新手友好度 84/100
-
add-toolnames MCP Toolnames Toolnames checkup
難度 2/5 1-3 小時 新手友好度 68/100
rajbos/ai-engineering-fluency#2190 · 3 則留言 ·
-
enhancement
難度 2/5 1-3 小時 新手友好度 78/100
gajus/eslint-plugin-jsdoc#1776 · 1 個 reaction ·