Files
codeql/javascript/ql/test/library-tests/InterProceduralFlow/DataFlowConfig.qll
Max Schaefer 86e96c6dc3 JavaScript: Introduce is{Barrier,Sanitizer}Edge predicate.
This name is more intuitive than the previous binary
`is{Barrier,Sanitizer}` predicates, and is consistent with the other
languages.
2019-05-28 08:08:14 +01:00

31 lines
908 B
Plaintext

import javascript
class TestDataFlowConfiguration extends DataFlow::Configuration {
TestDataFlowConfiguration() { this = "TestDataFlowConfiguration" }
override predicate isSource(DataFlow::Node src) {
exists(VariableDeclarator vd |
vd.getBindingPattern().(VarDecl).getName().matches("%source%") and
src.asExpr() = vd.getInit()
)
}
override predicate isSink(DataFlow::Node snk) {
exists(VariableDeclarator vd |
vd.getBindingPattern().(VarDecl).getName().matches("%sink%") and
snk.asExpr() = vd.getInit()
)
}
override predicate isBarrierEdge(DataFlow::Node src, DataFlow::Node snk) {
src = src and
snk.asExpr().(PropAccess).getPropertyName() = "notTracked"
or
exists(Function f |
f.getName().matches("%noReturnTracking%") and
src = f.getAReturnedExpr().flow() and
snk.(DataFlow::InvokeNode).getACallee() = f
)
}
}