github / github/codeql

False Negative - Python `abc.ABC` makes method's `getACall` unavailable

Aperta
#18,725 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
question
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

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?

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Reproduce the two Python examples and run the shown CodeQL query importing PythonFunctionValue. Compare whether getACall() reports method calls with and without abc.ABC inheritance, then inspect the Python library behavior responsible for the difference. Done means the query consistently recognizes the calls in both examples or the issue documents the supported limitation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.