Skip to content

Commit 2fc5961

Browse files
committed
JS: Restrict where sub path edges are computed
1 parent 2c3d1de commit 2fc5961

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

javascript/ql/lib/semmle/javascript/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)