mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Ruby: Fix query compilation.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* See `shared/util/codeql/dataflow/test/InlineFlowTest.qll`
|
||||
*/
|
||||
|
||||
import ruby
|
||||
private import ruby
|
||||
private import codeql.Locations
|
||||
private import codeql.dataflow.test.InlineFlowTest
|
||||
private import codeql.ruby.dataflow.internal.DataFlowImplSpecific
|
||||
|
||||
@@ -16,7 +16,6 @@ import codeql.ruby.ast.internal.Constant
|
||||
import codeql.ruby.Concepts
|
||||
import codeql.ruby.frameworks.ActiveRecord
|
||||
private import codeql.ruby.TaintTracking
|
||||
private import codeql.ruby.CFG
|
||||
private import codeql.ruby.controlflow.internal.Guards as Guards
|
||||
|
||||
/** Gets the name of a built-in method that involves a loop operation. */
|
||||
@@ -42,7 +41,7 @@ class LoopingCall extends DataFlow::CallNode {
|
||||
|
||||
/** Holds if `ar` influences a guard that may control the execution of a loop. */
|
||||
predicate usedInLoopControlGuard(ActiveRecordInstance ar) {
|
||||
exists(DataFlow::Node insideGuard, CfgNodes::ExprCfgNode guard |
|
||||
exists(DataFlow::Node insideGuard, Cfg::CfgNodes::ExprCfgNode guard |
|
||||
// For a guard like `cond && ar`, the whole guard will not be tainted
|
||||
// so we need to look at the taint of the individual parts.
|
||||
insideGuard.asExpr().getExpr() = guard.getExpr().getAChild*()
|
||||
@@ -53,12 +52,12 @@ predicate usedInLoopControlGuard(ActiveRecordInstance ar) {
|
||||
}
|
||||
|
||||
/** Holds if `guard` controls `break` and `break` would break out of a loop. */
|
||||
predicate guardForLoopControl(CfgNodes::ExprCfgNode guard, CfgNodes::AstCfgNode break) {
|
||||
predicate guardForLoopControl(Cfg::CfgNodes::ExprCfgNode guard, Cfg::CfgNodes::AstCfgNode break) {
|
||||
Guards::guardControlsBlock(guard, break.getBasicBlock(), _) and
|
||||
(
|
||||
break.(CfgNodes::ExprNodes::MethodCallCfgNode).getMethodName() = "raise"
|
||||
break.(Cfg::CfgNodes::ExprNodes::MethodCallCfgNode).getMethodName() = "raise"
|
||||
or
|
||||
break instanceof CfgNodes::ReturningCfgNode
|
||||
break instanceof Cfg::CfgNodes::ReturningCfgNode
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import ruby
|
||||
import codeql.ruby.controlflow.ControlFlowGraph
|
||||
import codeql.ruby.controlflow.BasicBlocks
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* @kind path-problem
|
||||
*/
|
||||
|
||||
import codeql.ruby.AST
|
||||
import codeql.ruby.CFG
|
||||
import ruby
|
||||
import utils.test.InlineFlowTest
|
||||
import codeql.ruby.dataflow.BarrierGuards
|
||||
import PathGraph
|
||||
|
||||
Reference in New Issue
Block a user