Skip to content

Commit dbc6cf6

Browse files
committed
JS: Fix bad join order in PropertyProjection
1 parent bd3f6d1 commit dbc6cf6

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ private DataFlow::SourceNode getASimplePropertyProjectionCallee(
7575
) {
7676
singleton = false and
7777
(
78-
result = LodashUnderscore::member("pick") and
79-
objectIndex = 0 and
80-
selectorIndex = [1 .. max(result.getACall().getNumArgument())]
81-
or
8278
result = LodashUnderscore::member("pickBy") and
8379
objectIndex = 0 and
8480
selectorIndex = 1
@@ -131,6 +127,19 @@ private class SimplePropertyProjection extends PropertyProjection::Range {
131127
override predicate isSingletonProjection() { singleton = true }
132128
}
133129

130+
/**
131+
* A property projection with a variable number of selector indices.
132+
*/
133+
private class VarArgsPropertyProjection extends PropertyProjection::Range {
134+
VarArgsPropertyProjection() { this = LodashUnderscore::member("pick").getACall() }
135+
136+
override DataFlow::Node getObject() { result = getArgument(0) }
137+
138+
override DataFlow::Node getASelector() { result = getArgument(any(int i | i > 0)) }
139+
140+
override predicate isSingletonProjection() { none() }
141+
}
142+
134143
/**
135144
* A taint step for a property projection.
136145
*/

0 commit comments

Comments
 (0)