mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Python: Update globalVariableAttrPathAtDepth base case
This commit is contained in:
@@ -604,7 +604,7 @@ predicate globalVariableAttrPathAtDepth(
|
||||
) {
|
||||
// Base case: Direct global variable access (depth 0)
|
||||
depth = 0 and
|
||||
node in [globalVar.getARead(), globalVar.getAWrite()] and
|
||||
node in [globalVar.getARead(), globalVar.getAWrite(), globalVar] and
|
||||
accessPath = ""
|
||||
or
|
||||
exists(Node obj, string attrName, string parentAccessPath, int parentDepth |
|
||||
|
||||
@@ -301,12 +301,12 @@ def set_to_source():
|
||||
@expects(4) # $ unresolved_call=expects(..) unresolved_call=expects(..)(..)
|
||||
def test_global_flow_to_class_attribute():
|
||||
inst = WithTuple2()
|
||||
SINK_F(WithTuple2.my_tuple[0])
|
||||
SINK_F(WithTuple2.my_tuple[0]) # $ SPURIOUS: flow="SOURCE, l:-5 -> WithTuple2.my_tuple[0]"
|
||||
SINK_F(inst.my_tuple[0])
|
||||
|
||||
set_to_source()
|
||||
|
||||
SINK(WithTuple2.my_tuple[0]) # $ MISSING: flow="SOURCE, l:-10 -> WithTuple2.my_tuple[0]"
|
||||
SINK(WithTuple2.my_tuple[0]) # $ flow="SOURCE, l:-10 -> WithTuple2.my_tuple[0]"
|
||||
SINK(inst.my_tuple[0]) # $ MISSING: flow="SOURCE, l:-11 -> inst.my_tuple[0]"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user