Skip to content

Commit 986f2f4

Browse files
committed
Add SQLEscape module
1 parent 2a65917 commit 986f2f4

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

python/ql/src/experimental/semmle/python/Concepts.qll

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,36 @@ class LDAPEscape extends DataFlow::Node {
146146
*/
147147
DataFlow::Node getAnInput() { result = range.getAnInput() }
148148
}
149+
150+
/** Provides classes for modeling SQL sanitization libraries. */
151+
module SQLEscape {
152+
/**
153+
* A data-flow node that collects functions that escape SQL statements.
154+
*
155+
* Extend this class to model new APIs. If you want to refine existing API models,
156+
* extend `SQLEscape` instead.
157+
*/
158+
abstract class Range extends DataFlow::Node {
159+
/**
160+
* Gets the argument containing the raw SQL statement.
161+
*/
162+
abstract DataFlow::Node getAnInput();
163+
}
164+
}
165+
166+
/**
167+
* A data-flow node that collects functions escaping SQL statements.
168+
*
169+
* Extend this class to refine existing API models. If you want to model new APIs,
170+
* extend `SQLEscape::Range` instead.
171+
*/
172+
class SQLEscape extends DataFlow::Node {
173+
SQLEscape::Range range;
174+
175+
SQLEscape() { this = range }
176+
177+
/**
178+
* Gets the argument containing the raw SQL statement.
179+
*/
180+
DataFlow::Node getAnInput() { result = range.getAnInput() }
181+
}

0 commit comments

Comments
 (0)