Skip to content

Commit e82fe9d

Browse files
committed
Python: Updated doc string and removed redundant predicate.
1 parent e228aac commit e82fe9d

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

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

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -565,12 +565,12 @@ predicate runtimeJumpStep(Node nodeFrom, Node nodeTo) {
565565
* Holds if there is a jump step from `nodeFrom` to `nodeTo` through global variable field access.
566566
* This supports tracking nested object field access through global variables like `app.obj.foo`.
567567
*/
568-
predicate globalVariableNestedFieldJumpStep(Node nodeFrom, Node nodeTo) {
568+
private predicate globalVariableNestedFieldJumpStep(Node nodeFrom, Node nodeTo) {
569569
exists(ModuleVariableNode globalVar, AttrWrite write, AttrRead read |
570570
// Match writes and reads on the same global variable attribute path
571571
exists(string accessPath |
572-
globalVariableAttrPath(globalVar, accessPath, write.getObject()) and
573-
globalVariableAttrPath(globalVar, accessPath, read.getObject())
572+
globalVariableAttrPathAtDepth(globalVar, accessPath, write.getObject(), _) and
573+
globalVariableAttrPathAtDepth(globalVar, accessPath, read.getObject(), _)
574574
) and
575575
write.getAttributeName() = read.getAttributeName() and
576576
nodeFrom = write.getValue() and
@@ -580,25 +580,14 @@ predicate globalVariableNestedFieldJumpStep(Node nodeFrom, Node nodeTo) {
580580

581581
/**
582582
* Maximum depth for global variable nested attribute access.
583-
* Depth 0 = globalVar.foo, depth 1 = globalVar.foo.bar, depth 2 = globalVar.foo.bar.baz, etc.
583+
* Depth 1 = globalVar.foo, depth 2 = globalVar.foo.bar, depth 3 = globalVar.foo.bar.baz, etc.
584584
*/
585585
private int getMaxGlobalVariableDepth() { result = 2 }
586586

587-
/**
588-
* Holds if `node` is an attribute access path starting from global variable `globalVar`.
589-
* Supports configurable nesting depth via getMaxGlobalVariableDepth().
590-
*/
591-
predicate globalVariableAttrPath(ModuleVariableNode globalVar, string accessPath, Node node) {
592-
exists(int depth |
593-
globalVariableAttrPathAtDepth(globalVar, accessPath, node, depth) and
594-
depth >= 0
595-
)
596-
}
597-
598587
/**
599588
* Holds if `node` is an attribute access path starting from global variable `globalVar` at specific `depth`.
600589
*/
601-
predicate globalVariableAttrPathAtDepth(
590+
private predicate globalVariableAttrPathAtDepth(
602591
ModuleVariableNode globalVar, string accessPath, Node node, int depth
603592
) {
604593
// Base case: Direct global variable access (depth 0)

0 commit comments

Comments
 (0)