Skip to content

Commit c7667d3

Browse files
committed
JS: Address review comments
1 parent 6ab7846 commit c7667d3

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,6 @@ private class ComposedFunctionTaintStep extends TaintTracking::AdditionalTaintSt
124124

125125
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
126126
exists(int fnIndex, DataFlow::FunctionNode fn | fn = composed.getOperandFunction(fnIndex) |
127-
// flow out of the composed call
128-
fnIndex = 0 and
129-
pred = fn.getReturnNode() and
130-
succ = this
131-
or
132127
// flow into the first function
133128
fnIndex = composed.getNumOperand() - 1 and
134129
exists(int callArgIndex |
@@ -141,6 +136,11 @@ private class ComposedFunctionTaintStep extends TaintTracking::AdditionalTaintSt
141136
pred = predFn.getReturnNode() and
142137
succ = fn.getParameter(0)
143138
)
139+
or
140+
// flow out of the composed call
141+
fnIndex = 0 and
142+
pred = fn.getReturnNode() and
143+
succ = this
144144
)
145145
}
146146
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ private class ReactRouterLocationSource extends DOM::LocationSource::Range {
734734
* version of that component, which we model as a direct reference to the underlying component.
735735
*/
736736
private DataFlow::SourceNode higherOrderComponentBuilder() {
737+
// `memo(f)` returns a function that behaves as `f` but caches results
738+
// It is sometimes used to wrap an entire functional component.
737739
result = react().getAPropertyRead("memo")
738740
or
739741
result = DataFlow::moduleMember("react-redux", "connect").getACall()
@@ -760,8 +762,6 @@ private class HigherOrderComponentStep extends PreCallGraphStep {
760762
}
761763

762764
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
763-
// `memo(f)` returns a function behaves as `f` but caches results
764-
// It is sometimes used to wrap an entire functional component.
765765
exists(DataFlow::CallNode call |
766766
call = higherOrderComponentBuilder().getACall() and
767767
pred = call.getArgument(0) and

0 commit comments

Comments
 (0)