File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
lib/semmle/python/dataflow/new/internal
test/experimental/dataflow/variable-capture Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,12 @@ module LocalFlow {
299
299
nodeTo .( CfgNode ) .getNode ( ) = def .getDefiningNode ( )
300
300
)
301
301
or
302
+ // General definition
303
+ // TODO: remove other cases that are now redundant
304
+ nodeFrom .( CfgNode ) .getNode ( ) = nodeTo .( CfgNode ) .getNode ( ) .( DefinitionNode ) .getValue ( ) and
305
+ // remove jump steps (such as assignment of parameter default values)
306
+ nodeFrom .getEnclosingCallable ( ) = nodeTo .getEnclosingCallable ( )
307
+ or
302
308
// With definition
303
309
// `with f(42) as x:`
304
310
// nodeFrom is `f(42)`
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ def captureOut1():
38
38
nonlocal sinkO1
39
39
sinkO1 = SOURCE
40
40
captureOut1 ()
41
- SINK (sinkO1 ) #$ MISSING: captured
41
+ SINK (sinkO1 ) #$ captured
42
42
43
43
sinkO2 = ""
44
44
def captureOut2 ():
@@ -47,7 +47,7 @@ def m():
47
47
sinkO2 = SOURCE
48
48
m ()
49
49
captureOut2 ()
50
- SINK (sinkO2 ) #$ MISSING: captured
50
+ SINK (sinkO2 ) #$ captured
51
51
52
52
nonSink1 = ""
53
53
def captureOut1NotCalled ():
@@ -74,7 +74,7 @@ def captureOut1():
74
74
nonlocal sinkO1
75
75
sinkO1 = tainted
76
76
captureOut1 ()
77
- SINK (sinkO1 ) #$ MISSING: captured
77
+ SINK (sinkO1 ) #$ captured
78
78
79
79
sinkO2 = ""
80
80
def captureOut2 ():
@@ -83,7 +83,7 @@ def m():
83
83
sinkO2 = tainted
84
84
m ()
85
85
captureOut2 ()
86
- SINK (sinkO2 ) #$ MISSING: captured
86
+ SINK (sinkO2 ) #$ captured
87
87
88
88
nonSink1 = ""
89
89
def captureOut1NotCalled ():
You can’t perform that action at this time.
0 commit comments