Skip to content

Commit c674afb

Browse files
committed
JS: Fix condition in getRouteHandlerNode
Previous version did not account for arrays
1 parent 682ff23 commit c674afb

File tree

1 file changed

+2
-2
lines changed
  • javascript/ql/lib/semmle/javascript/frameworks

1 file changed

+2
-2
lines changed

javascript/ql/lib/semmle/javascript/frameworks/Express.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ module Express {
164164
*/
165165
DataFlow::Node getRouteHandlerNode(int index) {
166166
// The first argument is a URI pattern if it is a string. If it could possibly be
167-
// a function, we consider it to be a route handler, otherwise a URI pattern.
167+
// a non-string value, we consider it to be a route handler, otherwise a URI pattern.
168168
exists(AnalyzedNode firstArg | firstArg = this.getArgument(0).analyze() |
169-
if firstArg.getAType() = TTFunction()
169+
if firstArg.getAType() != TTString()
170170
then result = this.getArgument(index)
171171
else (
172172
index >= 0 and result = this.getArgument(index + 1)

0 commit comments

Comments
 (0)