@@ -574,16 +574,15 @@ 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
579
578
)
580
579
}
581
580
582
581
/**
583
582
* Maximum depth for global variable nested attribute access.
584
583
* Depth 0 = globalVar.foo, depth 1 = globalVar.foo.bar, depth 2 = globalVar.foo.bar.baz, etc.
585
584
*/
586
- private int getMaxGlobalVariableDepth ( ) { result = 10 }
585
+ private int getMaxGlobalVariableDepth ( ) { result = 2 }
587
586
588
587
/**
589
588
* Holds if `node` is an attribute access path starting from global variable `globalVar`.
@@ -604,13 +603,15 @@ predicate globalVariableAttrPathAtDepth(
604
603
) {
605
604
// Base case: Direct global variable access (depth 0)
606
605
depth = 0 and
607
- node in [ globalVar .getARead ( ) , globalVar .getAWrite ( ) , globalVar ] and
606
+ // We use `globalVar` instead of `globalVar.getAWrite()` due to some weirdness with how
607
+ // attribute writes are handled in the global scope (see `GlobalAttributeAssignmentAsAttrWrite`).
608
+ node in [ globalVar .getARead ( ) , globalVar ] and
608
609
accessPath = ""
609
610
or
610
611
exists ( Node obj , string attrName , string parentAccessPath , int parentDepth |
611
- node .( AttrRead ) .accesses ( obj , attrName )
612
+ node .( AttrRead ) .reads ( obj , attrName )
612
613
or
613
- exists ( AttrWrite aw | aw . accesses ( obj , attrName ) and aw . getValue ( ) = node )
614
+ any ( AttrWrite aw ) . writes ( obj , attrName , node )
614
615
|
615
616
globalVariableAttrPathAtDepth ( globalVar , parentAccessPath , obj , parentDepth ) and
616
617
accessPath = parentAccessPath + "." + attrName and
0 commit comments