Skip to content

Commit 4746cfd

Browse files
committed
JS: Add clarifying comment
1 parent e1784bb commit 4746cfd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

javascript/ql/lib/semmle/javascript/ApiGraphs.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,14 @@ module API {
866866
.getAReturn()
867867
)
868868
or
869+
// Handle rest parameters escaping into external code. For example:
870+
//
871+
// function foo(...rest) {
872+
// externalFunc(rest);
873+
// }
874+
//
875+
// Here, 'rest' reaches a def-node at the call to externalFunc, so we need to ensure
876+
// the arguments passed to 'foo' are stored in the 'rest' array.
869877
exists(Function fun, DataFlow::InvokeNode invoke, int argIndex, Parameter rest |
870878
fun.getRestParameter() = rest and
871879
rest.flow() = pred and

0 commit comments

Comments
 (0)