зеркало из https://github.com/github/codeql.git
Ruby: update SQLite3 model
This commit is contained in:
Родитель
2ef010f1c0
Коммит
b305c13b65
|
@ -15,21 +15,19 @@ private import codeql.ruby.Concepts
|
|||
* https://github.com/sparklemotion/sqlite3-ruby
|
||||
*/
|
||||
module Sqlite3 {
|
||||
private API::Node databaseConst() {
|
||||
result = API::getTopLevelMember("SQLite3").getMember("Database")
|
||||
}
|
||||
|
||||
private API::Node dbInstance() {
|
||||
result = databaseConst().getInstance()
|
||||
or
|
||||
result = databaseConst().getMethod("new").getBlock().getParameter(0)
|
||||
}
|
||||
|
||||
/** Gets a method call with a receiver that is a database instance. */
|
||||
private DataFlow::CallNode getADatabaseMethodCall(string methodName) {
|
||||
exists(API::Node dbInstance |
|
||||
dbInstance = API::getTopLevelMember("SQLite3").getMember("Database").getInstance() and
|
||||
(
|
||||
result = dbInstance.getAMethodCall(methodName)
|
||||
or
|
||||
// e.g. SQLite3::Database.new("foo.db") |db| { db.some_method }
|
||||
exists(DataFlow::BlockNode block |
|
||||
result.getMethodName() = methodName and
|
||||
block = dbInstance.getAValueReachableFromSource().(DataFlow::CallNode).getBlock() and
|
||||
block.getParameter(0).flowsTo(result.getReceiver())
|
||||
)
|
||||
)
|
||||
)
|
||||
result = dbInstance().getAMethodCall(methodName)
|
||||
}
|
||||
|
||||
/** A prepared but unexecuted SQL statement. */
|
||||
|
|
Загрузка…
Ссылка в новой задаче