File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
python/ql/test/experimental/dataflow/fieldflow Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,39 @@ def test_nested_obj_method():
193
193
SINK (a .obj .foo ) # $ flow="SOURCE, l:-3 -> a.obj.foo"
194
194
195
195
196
+ # ------------------------------------------------------------------------------
197
+ # Field access on compound arguments
198
+ # ------------------------------------------------------------------------------
199
+
200
+ # TODO: Add support for this, see https://github.com/github/codeql/pull/10444
201
+
202
+ @expects (5 ) # $ unresolved_call=expects(..) unresolved_call=expects(..)(..)
203
+ def test_field_on_compound_arg (cond_true = True , cond_false = False ):
204
+ class Ex :
205
+ def __init__ (self ):
206
+ self .attr = None
207
+
208
+ def set_attr (obj ):
209
+ obj .attr = SOURCE
210
+
211
+ x = Ex ()
212
+ y = Ex ()
213
+ set_attr (x if cond_true else y )
214
+ SINK (x .attr ) # $ MISSING: flow
215
+
216
+ x = Ex ()
217
+ y = Ex ()
218
+ set_attr (x if cond_false else y )
219
+ SINK (y .attr ) # $ MISSING: flow
220
+
221
+ x = Ex ()
222
+ y = Ex ()
223
+ z = Ex ()
224
+ set_attr (x if cond_false else (y if cond_true else z ))
225
+ SINK_F (x .attr ) # $ MISSING: flow
226
+ SINK (y .attr ) # $ MISSING: flow
227
+ SINK_F (z .attr ) # $ MISSING: flow
228
+
196
229
# ------------------------------------------------------------------------------
197
230
# Crosstalk test -- using different function based on conditional
198
231
# ------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments