github / github/codeql

Using "Value::named" search for call to "os.path.join" not working

Đang mở
#3,261 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Python question
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

CodeQL version 2.1.0
```
from rest_framework.viewsets import ModelViewSet
from rest_framework.exceptions import ValidationError
import os
from rest_framework.decorators import list_route

def func1():
pass

def preprocess(request):
pass

class TestViewSet(ModelViewSet):
base = "111111"
@list_route(methods=['post'])
def upload(self, request):
try:
var1 = func1()
except:
raise ValidationError({'message': [_('1,1')]})
if var1['1']:
raise ValidationError({'message': [_('1,1')]})

(upload_file, file_name) = preprocess(request)
path1 = base.RELATED_DIR['11111111']
if not os.path.exists(path1):
os.makedirs(path1)
path2 = os.path.join(path1, file_name)
```

Query:
```
import python
from ControlFlowNode c
where Value::named("os.path.join").getACall() = c
select c
```

Expect result:
Can find the call to "os.path.join" on the last line

Actual result:
Just show 2 call in the python lib

Is this a bug or am I doing this in the wrong way?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.