Skip to content

Commit 7fa224c

Browse files
committed
Python: Update globalVariableAttrPathAtDepth base case
1 parent 11185c3 commit 7fa224c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ predicate globalVariableAttrPathAtDepth(
604604
) {
605605
// Base case: Direct global variable access (depth 0)
606606
depth = 0 and
607-
node in [globalVar.getARead(), globalVar.getAWrite()] and
607+
node in [globalVar.getARead(), globalVar.getAWrite(), globalVar] and
608608
accessPath = ""
609609
or
610610
exists(Node obj, string attrName, string parentAccessPath, int parentDepth |

python/ql/test/library-tests/dataflow/fieldflow/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,12 @@ def set_to_source():
301301
@expects(4) # $ unresolved_call=expects(..) unresolved_call=expects(..)(..)
302302
def test_global_flow_to_class_attribute():
303303
inst = WithTuple2()
304-
SINK_F(WithTuple2.my_tuple[0])
304+
SINK_F(WithTuple2.my_tuple[0]) # $ SPURIOUS: flow="SOURCE, l:-5 -> WithTuple2.my_tuple[0]"
305305
SINK_F(inst.my_tuple[0])
306306

307307
set_to_source()
308308

309-
SINK(WithTuple2.my_tuple[0]) # $ MISSING: flow="SOURCE, l:-10 -> WithTuple2.my_tuple[0]"
309+
SINK(WithTuple2.my_tuple[0]) # $ flow="SOURCE, l:-10 -> WithTuple2.my_tuple[0]"
310310
SINK(inst.my_tuple[0]) # $ MISSING: flow="SOURCE, l:-11 -> inst.my_tuple[0]"
311311

312312

0 commit comments

Comments
 (0)