Skip to content

Commit 86885f4

Browse files
committed
JS: Address comments
1 parent 7c9d20a commit 86885f4

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

javascript/ql/src/semmle/javascript/dataflow/Configuration.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,9 @@ private predicate flowThroughCall(
613613
DataFlow::exceptionalFunctionReturnNode(ret, f) and
614614
DataFlow::exceptionalInvocationReturnNode(output, invk.asExpr()) and
615615
calls(invk, f) and
616-
reachableFromInput(f, invk, input, ret, cfg, summary)
616+
reachableFromInput(f, invk, input, ret, cfg, summary) and
617+
not cfg.isBarrier(ret, output) and
618+
not cfg.isLabeledBarrier(output, summary.getEndLabel())
617619
)
618620
}
619621

javascript/ql/src/semmle/javascript/dataflow/internal/FlowSteps.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ private module CachedSteps {
163163
}
164164

165165
/**
166-
* Holds if there is a flow step from `pred` to `succ` through returning
167-
* from a function call or the receiver flowing out of a constructor call.
166+
* Holds if there is a flow step from `pred` to `succ` through:
167+
* - returning a value from a function call, or
168+
* - throwing an exception out of a function call, or
169+
* - the receiver flowing out of a constructor call.
168170
*/
169171
cached
170172
predicate returnStep(DataFlow::Node pred, DataFlow::Node succ) {

javascript/ql/src/semmle/javascript/frameworks/LodashUnderscore.qll

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -369,29 +369,30 @@ module LodashUnderscore {
369369
exists(string name |
370370
this = member(name).getACall()
371371
|
372-
// Collection methods
373-
name = "countBy" or
372+
// Members ending with By, With, or While indicate that they are a variant of
373+
// another function that takes a callback.
374+
name.matches("%By") or
375+
name.matches("%With") or
376+
name.matches("%While") or
377+
378+
// Other members that don't fit the above pattern.
374379
name = "each" or
375380
name = "eachRight" or
376-
name = "forEach" or
377-
name = "forEachRight" or
378381
name = "every" or
379382
name = "filter" or
380-
name = "groupBy" or
381-
name = "orderBy" or
383+
name = "find" or
384+
name = "findLast" or
385+
name = "flatMap" or
386+
name = "flatMapDeep" or
387+
name = "flatMapDepth" or
388+
name = "forEach" or
389+
name = "forEachRight" or
382390
name = "partition" or
383391
name = "reduce" or
384392
name = "reduceRight" or
393+
name = "replace"
385394
name = "some" or
386-
name = "sortBy" or
387-
388-
// Array methods
389-
name = "dropRightWhile" or
390-
name = "dropWhile" or
391-
name = "sortedIndexBy" or
392-
name = "sortedUniqBy" or
393-
name = "takeRightWhile" or
394-
name = "takeWhile"
395+
name = "transform" or
395396
)
396397
}
397398

0 commit comments

Comments
 (0)