Skip to content

Commit d814e15

Browse files
committed
Ruby: Refactor
1 parent 9c3d141 commit d814e15

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

ruby/ql/lib/codeql/ruby/frameworks/ActiveRecord.qll

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,15 @@ class ActiveRecordSqlExecutionRange extends SqlExecution::Range {
214214
this.asExpr().getNode() = mc.getSqlFragmentSinkArgument()
215215
)
216216
or
217-
exists(DataFlow::CallNode executeCall |
218-
executeCall.getReceiver() = activeRecordConnectionInstance() and
219-
executeCall.getMethodName() = "execute" and
220-
this = executeCall.getArgument(0) and
221-
unsafeSqlExpr(this.asExpr().getExpr())
222-
)
217+
this = activeRecordConnectionInstance().getAMethodCall("execute").getArgument(0) and
218+
unsafeSqlExpr(this.asExpr().getExpr())
223219
}
224220

225221
override DataFlow::Node getSql() { result = this }
226222
}
227223

228-
private DataFlow::Node activeRecordConnectionInstance() {
229-
result = activeRecordClassApiNode().getAMethodCall("connection")
224+
private API::Node activeRecordConnectionInstance() {
225+
result = activeRecordClassApiNode().getReturn("connection")
230226
}
231227

232228
// TODO: model `ActiveRecord` sanitizers

0 commit comments

Comments
 (0)