Skip to content

Commit 51618b4

Browse files
committed
Sync ApiGraphModels.qll
1 parent 2fc5961 commit 51618b4

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

python/ql/lib/semmle/python/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,12 @@ private API::Node getNodeFromSubPath(API::Node base, AccessPath subPath, int n)
502502
result =
503503
getNodeFromSubPath(getNodeFromSubPath(base, subPath, n - 1), getSubPathAt(subPath, n - 1))
504504
or
505-
typeStep(getNodeFromSubPath(base, subPath, n), result)
505+
typeStep(getNodeFromSubPath(base, subPath, n), result) and
506+
// Only apply type-steps strictly between the steps on the sub path, not before and after.
507+
// Steps before/after lead to unnecessary transitive edges, which the user of the sub-path
508+
// will themselves find by following type-steps.
509+
n > 0 and
510+
n < subPath.getNumToken()
506511
}
507512

508513
/**

ruby/ql/lib/codeql/ruby/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,12 @@ private API::Node getNodeFromSubPath(API::Node base, AccessPath subPath, int n)
502502
result =
503503
getNodeFromSubPath(getNodeFromSubPath(base, subPath, n - 1), getSubPathAt(subPath, n - 1))
504504
or
505-
typeStep(getNodeFromSubPath(base, subPath, n), result)
505+
typeStep(getNodeFromSubPath(base, subPath, n), result) and
506+
// Only apply type-steps strictly between the steps on the sub path, not before and after.
507+
// Steps before/after lead to unnecessary transitive edges, which the user of the sub-path
508+
// will themselves find by following type-steps.
509+
n > 0 and
510+
n < subPath.getNumToken()
506511
}
507512

508513
/**

0 commit comments

Comments
 (0)