@@ -574,16 +574,16 @@ predicate globalVariableNestedFieldJumpStep(Node nodeFrom, Node nodeTo) {
574
574
) and
575
575
write .getAttributeName ( ) = read .getAttributeName ( ) and
576
576
nodeFrom = write .getValue ( ) and
577
- nodeTo = read and
578
- write .getEnclosingCallable ( ) != read .getEnclosingCallable ( )
577
+ nodeTo = read // and
578
+ // write.getEnclosingCallable() != read.getEnclosingCallable()
579
579
)
580
580
}
581
581
582
582
/**
583
583
* Maximum depth for global variable nested attribute access.
584
584
* Depth 0 = globalVar.foo, depth 1 = globalVar.foo.bar, depth 2 = globalVar.foo.bar.baz, etc.
585
585
*/
586
- private int getMaxGlobalVariableDepth ( ) { result = 1 }
586
+ private int getMaxGlobalVariableDepth ( ) { result = 10 }
587
587
588
588
/**
589
589
* Holds if `node` is an attribute access path starting from global variable `globalVar`.
@@ -592,7 +592,7 @@ private int getMaxGlobalVariableDepth() { result = 1 }
592
592
predicate globalVariableAttrPath ( ModuleVariableNode globalVar , string accessPath , Node node ) {
593
593
exists ( int depth |
594
594
globalVariableAttrPathAtDepth ( globalVar , accessPath , node , depth ) and
595
- depth > 0
595
+ depth >= 0
596
596
)
597
597
}
598
598
@@ -607,14 +607,15 @@ predicate globalVariableAttrPathAtDepth(
607
607
node in [ globalVar .getARead ( ) , globalVar .getAWrite ( ) ] and
608
608
accessPath = ""
609
609
or
610
- // Recursive case: Nested attribute access (depth > 0)
611
- exists ( AttrRef attr , Node n , string attrName , int parentDepth , string parentAccessPath |
612
- attr .accesses ( n , attrName ) and
613
- globalVariableAttrPathAtDepth ( globalVar , parentAccessPath , n , parentDepth ) and
614
- node = attr and
610
+ exists ( Node obj , string attrName , string parentAccessPath , int parentDepth |
611
+ node .( AttrRead ) .accesses ( obj , attrName )
612
+ or
613
+ exists ( AttrWrite aw | aw .accesses ( obj , attrName ) and aw .getValue ( ) = node )
614
+ |
615
+ globalVariableAttrPathAtDepth ( globalVar , parentAccessPath , obj , parentDepth ) and
616
+ accessPath = parentAccessPath + "." + attrName and
615
617
depth = parentDepth + 1 and
616
- depth <= getMaxGlobalVariableDepth ( ) and
617
- accessPath = parentAccessPath + "." + attrName
618
+ depth <= getMaxGlobalVariableDepth ( )
618
619
)
619
620
}
620
621
0 commit comments