mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Python: Add tests of methods in summaries
This commit is contained in:
@@ -66,3 +66,21 @@ SINK(tainted_list[0]) # $ flow="SOURCE, l:-1 -> tainted_list[0]"
|
||||
from json import loads as json_loads
|
||||
tainted_resultlist = json_loads(SOURCE)
|
||||
SINK(tainted_resultlist[0]) # $ flow="SOURCE, l:-1 -> tainted_resultlist[0]"
|
||||
|
||||
|
||||
# Class methods are not handled right now
|
||||
|
||||
class MyClass:
|
||||
@staticmethod
|
||||
def foo(x):
|
||||
return x
|
||||
|
||||
def bar(self, x):
|
||||
return x
|
||||
|
||||
through_staticmethod = apply_lambda(MyClass.foo, SOURCE)
|
||||
through_staticmethod # $ MISSING: flow
|
||||
|
||||
mc = MyClass()
|
||||
through_method = apply_lambda(mc.bar, SOURCE)
|
||||
through_method # $ MISSING: flow
|
||||
|
||||
@@ -59,3 +59,20 @@ r # $ tracked
|
||||
y # $ tracked=secret
|
||||
TTS_set_secret(y, tracked) # $ tracked tracked=secret
|
||||
y.secret # $ tracked tracked=secret
|
||||
|
||||
# Class methods are not handled right now
|
||||
|
||||
class MyClass:
|
||||
@staticmethod
|
||||
def foo(x):
|
||||
return x
|
||||
|
||||
def bar(self, x):
|
||||
return x
|
||||
|
||||
through_staticmethod = TTS_apply_lambda(MyClass.foo, tracked) # $ tracked
|
||||
through_staticmethod # $ MISSING: tracked
|
||||
|
||||
mc = MyClass()
|
||||
through_method = TTS_apply_lambda(mc.bar, tracked) # $ tracked
|
||||
through_method # $ MISSING: tracked
|
||||
|
||||
Reference in New Issue
Block a user