Skip to content

Commit 3c00235

Browse files
committed
Add SqlSanitization to Concepts and turn private
1 parent f46620c commit 3c00235

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

ruby/ql/lib/codeql/ruby/Concepts.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ module SqlExecution {
7878
}
7979
}
8080

81+
/**
82+
* A data-flow node that performs SQL sanitization.
83+
*/
84+
class SqlSanitization extends DataFlow::Node instanceof SqlSanitization::Range { }
85+
86+
/** Provides a class for modeling new SQL sanitization APIs. */
87+
module SqlSanitization {
88+
/**
89+
* A data-flow node that performs SQL sanitization.
90+
*/
91+
abstract class Range extends DataFlow::Node { }
92+
}
93+
8194
/**
8295
* A data-flow node that executes a regular expression.
8396
*

ruby/ql/lib/codeql/ruby/Frameworks.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ private import codeql.ruby.frameworks.Slim
3232
private import codeql.ruby.frameworks.Sinatra
3333
private import codeql.ruby.frameworks.Twirp
3434
private import codeql.ruby.frameworks.Sqlite3
35+
private import codeql.ruby.frameworks.Mysql2

ruby/ql/lib/codeql/ruby/security/SqlInjectionCustomizations.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module SqlInjection {
5757
/**
5858
* A call to `Mysql2::Client.escape`, considered as a sanitizer.
5959
*/
60-
class Mysql2EscapeSanitization extends Sanitizer {
60+
private class Mysql2EscapeSanitization extends Sanitizer {
6161
Mysql2EscapeSanitization() {
6262
this = API::getTopLevelMember("Mysql2").getMember("Client").getAMethodCall("escape")
6363
}
@@ -66,7 +66,7 @@ module SqlInjection {
6666
/**
6767
* A call to `SQLite3::Database.quote`, considered as a sanitizer.
6868
*/
69-
class SQLite3EscapeSanitization extends Sanitizer {
69+
private class SQLite3EscapeSanitization extends Sanitizer {
7070
SQLite3EscapeSanitization() {
7171
this = API::getTopLevelMember("SQLite3").getMember("Database").getAMethodCall("quote")
7272
}

0 commit comments

Comments
 (0)