False Negative - Python `abc.ABC` makes method's `getACall` unavailable
- Vorherrschende Sprache
- CodeQL
- Sterne
- 10.1k
- Forks
- 2.1k
- Ø Merge
- 2 T. 15 Std.
- Gemergte PRs (30 T.)
- 141
Beschreibung
If we have this Python code:
```python
class MyClass():
def method(self):
print("xxx")
def wrapper(self):
self.method()
mc = MyClass()
mc.method()
```
and this query:
```codeql
import python
from PythonFunctionValue method
select method.getACall()
```
It's OK that `self.method()` and `mc.method()` will be marked as positive.
However, those will be false negative as long as the class `MyClass` inherits `abc.ABC`. It looks like:
```python
from abc import ABC
class MyClass(ABC):
def method(self):
print("xxx")
def wrapper(self):
self.method()
mc = MyClass()
mc.method()
```
Why does the `abc.ABC` make the result wrong?
Beitragsleitfaden
Rechercherichtung
Reproduziere die beiden Python-Beispiele und führe die gezeigte CodeQL-Abfrage aus, die PythonFunctionValue importiert. Vergleiche, ob getACall() Methodenaufrufe mit und ohne abc.ABC-Vererbung meldet, und untersuche anschließend das Verhalten der Python-Bibliothek, das für den Unterschied verantwortlich ist. Erledigt ist die Aufgabe, wenn die Abfrage die Aufrufe in beiden Beispielen konsistent erkennt oder das Issue die unterstützte Einschränkung dokumentiert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100