mirror of
https://github.com/github/codeql.git
synced 2025-12-22 03:36:30 +01:00
python: rename summaries
This commit is contained in:
@@ -28,43 +28,43 @@ def SINK_F(x):
|
||||
print("OK")
|
||||
|
||||
|
||||
from Foo import identity
|
||||
from Foo import MS_identity
|
||||
|
||||
# Simple summary
|
||||
tainted = identity(SOURCE)
|
||||
tainted = MS_identity(SOURCE)
|
||||
SINK(tainted) # $ MISSING: flow="SOURCE, l:-1 -> tainted"
|
||||
|
||||
# Lambda summary
|
||||
tainted_lambda = apply_lambda(lambda x: x + 1, SOURCE)
|
||||
tainted_lambda = MS_apply_lambda(lambda x: x + 1, SOURCE)
|
||||
SINK(tainted_lambda) # $ MISSING: flow="SOURCE, l:-1 -> tainted_lambda"
|
||||
|
||||
# A lambda that breaks the flow
|
||||
untainted_lambda = apply_lambda(lambda x: 1, SOURCE)
|
||||
untainted_lambda = MS_apply_lambda(lambda x: 1, SOURCE)
|
||||
SINK_F(untainted_lambda)
|
||||
|
||||
# Collection summaries
|
||||
tainted_list = my_reversed([SOURCE])
|
||||
tainted_list = MS_reversed([SOURCE])
|
||||
SINK(tainted_list[0]) # $ MISSING: flow="SOURCE, l:-1 -> tainted_list[0]"
|
||||
|
||||
# Complex summaries
|
||||
def add_colon(x):
|
||||
return x + ":"
|
||||
|
||||
tainted_mapped = list_map(add_colon, [SOURCE])
|
||||
tainted_mapped = MS_list_map(add_colon, [SOURCE])
|
||||
SINK(tainted_mapped[0]) # $ MISSING: flow="SOURCE, l:-1 -> tainted_mapped[0]"
|
||||
|
||||
def explicit_identity(x):
|
||||
return x
|
||||
|
||||
tainted_mapped_explicit = list_map(explicit_identity, [SOURCE])
|
||||
tainted_mapped_explicit = MS_list_map(explicit_identity, [SOURCE])
|
||||
SINK(tainted_mapped_explicit[0]) # $ MISSING: flow="SOURCE, l:-1 -> tainted_mapped_explicit[0]"
|
||||
|
||||
tainted_mapped_summary = list_map(identity, [SOURCE])
|
||||
tainted_mapped_summary = MS_list_map(MS_identity, [SOURCE])
|
||||
SINK(tainted_mapped_summary[0]) # $ MISSING: flow="SOURCE, l:-1 -> tainted_mapped_summary[0]"
|
||||
|
||||
tainted_list = append_to_list([], SOURCE)
|
||||
tainted_list = MS_append_to_list([], SOURCE)
|
||||
SINK(tainted_list[0]) # $ MISSING: flow="SOURCE, l:-1 -> tainted_list[0]"
|
||||
|
||||
from json import my_loads as json_loads
|
||||
from json import MS_loads as json_loads
|
||||
tainted_resultlist = json_loads(SOURCE)
|
||||
SINK(tainted_resultlist[0]) # $ MISSING: flow="SOURCE, l:-1 -> tainted_resultlist[0]"
|
||||
|
||||
Reference in New Issue
Block a user