Skip to content

Commit 2fad406

Browse files
committed
move StdLibRegExpInterpretation to Stdlib.qll
1 parent a64848c commit 2fad406

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

python/ql/lib/semmle/python/frameworks/Stdlib.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3015,6 +3015,19 @@ private module StdlibPrivate {
30153015
override string getKind() { result = Escaping::getRegexKind() }
30163016
}
30173017

3018+
private import semmle.python.regex as Regex
3019+
3020+
/**
3021+
* A node interpreted as a regular expression.
3022+
* Speficically nodes where string values are interpreted as regular expressions.
3023+
*/
3024+
class StdLibRegExpInterpretation extends Regex::RegExpInterpretation::Range {
3025+
StdLibRegExpInterpretation() {
3026+
this =
3027+
API::moduleImport("re").getMember("compile").getACall().getParameter(0, "pattern").asSink()
3028+
}
3029+
}
3030+
30183031
// ---------------------------------------------------------------------------
30193032
// urllib
30203033
// ---------------------------------------------------------------------------

python/ql/lib/semmle/python/regex.qll

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ private import semmle.python.Frameworks
44
private import regexp.internal.RegExpTracking as RegExpTracking
55
private import semmle.python.Concepts as Concepts
66
private import semmle.python.regexp.RegexTreeView
7+
private import semmle.python.dataflow.new.DataFlow
78
import regexp.internal.ParseRegExp
89

910
/** Gets a parsed regular expression term that is executed at `exec`. */
@@ -24,19 +25,6 @@ module RegExpInterpretation {
2425
abstract class Range extends DataFlow::Node { }
2526
}
2627

27-
private import semmle.python.ApiGraphs
28-
29-
/**
30-
* A node interpreted as a regular expression.
31-
* Speficically nodes where string values are interpreted as regular expressions.
32-
*/
33-
class StdLibRegExpInterpretation extends RegExpInterpretation::Range {
34-
StdLibRegExpInterpretation() {
35-
this =
36-
API::moduleImport("re").getMember("compile").getACall().getParameter(0, "pattern").asSink()
37-
}
38-
}
39-
4028
/** A StrConst used as a regular expression */
4129
deprecated class RegexString extends Regex {
4230
RegexString() { this = RegExpTracking::regExpSource(_).asExpr() }

0 commit comments

Comments
 (0)