Whether there are Python SDK for Programmatic Access to CodeQL Database Facts
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- developer-experience, tooling
Direzione di ricerca
Non vengono indicati file, test o punti di ingresso. Inizia esaminando il database CodeQL esistente e le interfacce delle query QL-query, quindi confrontali con il modello di accesso Python proposto e con l’attuale soluzione alternativa di esportazione/importazione CSV. Il lavoro sarebbe completato con un ambito dell’API concordato e un piano di implementazione, anziché con una modifica localizzata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- CodeQL
- Stelle
- 10.1k
- Fork
- 2.1k
- Merge medio
- 2g 11h
- PR unite (30g)
- 129
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/codeql
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
C#: cs/simplifiable-boolean-expression false positive on Nullable<bool> compared with a literal Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
false-positive
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
False positive Apertafalse-positive
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
Tutte le issue di github/codeql
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
duckdb/duckdb-python#627 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
nearform/ag-grid-url-sync#160 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
idean3885/claude-ops-agent#521 ·