Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 25d4ab7

Browse files
committed
JS: ComposedFunctions
1 parent a2f7ece commit 25d4ab7

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,12 @@ module FunctionCompositionCall {
110110
}
111111
}
112112

113-
/**
114-
* A taint step for a composed function.
115-
*/
116-
private class ComposedFunctionTaintStep extends TaintTracking::AdditionalTaintStep {
117-
FunctionCompositionCall composed;
118-
DataFlow::CallNode call;
119-
120-
ComposedFunctionTaintStep() {
121-
call = composed.getACall() and
122-
this = call
123-
}
124-
113+
private class ComposedFunctionTaintStep extends TaintTracking::SharedTaintStep {
125114
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
126-
exists(int fnIndex, DataFlow::FunctionNode fn | fn = composed.getOperandFunction(fnIndex) |
115+
exists(int fnIndex, DataFlow::FunctionNode fn, FunctionCompositionCall composed, DataFlow::CallNode call |
116+
fn = composed.getOperandFunction(fnIndex) and
117+
call = composed.getACall()
118+
|
127119
// flow into the first function
128120
fnIndex = composed.getNumOperand() - 1 and
129121
exists(int callArgIndex |
@@ -140,7 +132,7 @@ private class ComposedFunctionTaintStep extends TaintTracking::AdditionalTaintSt
140132
// flow out of the composed call
141133
fnIndex = 0 and
142134
pred = fn.getReturnNode() and
143-
succ = this
135+
succ = call
144136
)
145137
}
146138
}

0 commit comments

Comments
 (0)