Files
codeql/ruby/ql/test/TestUtilities/InlineFlowTestUtil.qll
Asger F 00e52ad109 Ruby: add type-tracking variant of hash-flow test
Ruby: fixup type-tracking hash flow test

Fixup! type-tracking hash flow test result
2022-10-04 11:14:30 +02:00

23 lines
717 B
Plaintext

/**
* Defines the default source and sink recognition for `InlineFlowTest.qll`.
*
* We reuse these predicates in some type-tracking tests that don't wish to bring in the
* test configuration from `InlineFlowTest`.
*/
import codeql.ruby.AST
import codeql.ruby.DataFlow
predicate defaultSource(DataFlow::Node src) {
src.asExpr().getExpr().(MethodCall).getMethodName() = ["source", "taint"]
}
predicate defaultSink(DataFlow::Node sink) {
exists(MethodCall mc | mc.getMethodName() = "sink" | sink.asExpr().getExpr() = mc.getAnArgument())
}
string getSourceArgString(DataFlow::Node src) {
defaultSource(src) and
src.asExpr().getExpr().(MethodCall).getAnArgument().getConstantValue().toString() = result
}