github / github/codeql

[Rust] Proc macro expansion support

Offen
#20,659 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
question
Vorherrschende Sprache
CodeQL
Sterne
10.1k
Forks
2.1k
Ø Merge
2 T. 15 Std.
Gemergte PRs (30 T.)
141

Beschreibung

Hello, is there any way or are you planning to implement analysis on expanded proc macros? Im currently trying codeQL on [Anchor](https://crates.io/crates/anchor-lang), which makes heavy use of proc macros.

When running a simple test, I see that by default, codeQL doesn't fully resolve references that exist in the expanded code, meaning i only get a reference to the macro that generated the referenced code, but I dont know which part of the macro is to blame (i used `cargo expand`) to test that. It seems though that placing the expanded file in the root dir does indeed make it be analyzed, but I dont know if this fully supported at the moment.

Is there a better way to do this?

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start with the simple Anchor test described in the issue and use cargo expand to compare the original proc-macro source with the expanded file placed in the repository root. Check how CodeQL resolves references in each case. Done means establishing whether expanded proc macros are supported and documenting a reliable analysis approach or the required implementation scope.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
security
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.