JS: Update Redux test

This commit is contained in:
Asger F
2023-10-06 09:51:23 +02:00
parent d2053445a7
commit b9344134d3
2 changed files with 17 additions and 8 deletions

View File

@@ -1,3 +1,4 @@
legacyDataFlowDifference
reducerArg
| exportedReducer.js:12:12:12:35 | (state, ... > state |
| react-redux.jsx:12:33:17:9 | (state, ... } |

View File

@@ -44,20 +44,28 @@ query predicate reducerToStateStep = Redux::reducerToStateStep/2;
query Redux::StoreCreation storeCreation() { any() }
class BasicTaint extends TaintTracking::Configuration {
BasicTaint() { this = "BasicTaint" }
module TestConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) { node.(DataFlow::CallNode).getCalleeName() = "source" }
override predicate isSource(DataFlow::Node node) {
node.(DataFlow::CallNode).getCalleeName() = "source"
}
override predicate isSink(DataFlow::Node node) {
predicate isSink(DataFlow::Node node) {
node = any(DataFlow::CallNode call | call.getCalleeName() = "sink").getAnArgument()
}
}
module TestFlow = TaintTracking::Global<TestConfig>;
class LegacyConfig extends TaintTracking::Configuration {
LegacyConfig() { this = "LegacyConfig" }
override predicate isSource(DataFlow::Node source) { TestConfig::isSource(source) }
override predicate isSink(DataFlow::Node sink) { TestConfig::isSink(sink) }
}
import testUtilities.LegacyDataFlowDiff::DataFlowDiff<TestFlow, LegacyConfig>
query predicate taintFlow(DataFlow::Node source, DataFlow::Node sink) {
any(BasicTaint cfg).hasFlow(source, sink)
TestFlow::flow(source, sink)
}
query DataFlow::SourceNode reactComponentRef(ReactComponent component) {