Skip to content

Commit e677b62

Browse files
committed
use type-tracking instead of global dataflow for tracking regular expressions
1 parent e9f1e99 commit e677b62

File tree

5 files changed

+106
-424
lines changed

5 files changed

+106
-424
lines changed

config/identical-files.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl2.qll",
4949
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl3.qll",
5050
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl4.qll",
51-
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplForRegExp.qll",
5251
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl1.qll",
5352
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl2.qll",
5453
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForHttpClientLibraries.qll",

python/ql/lib/semmle/python/dataflow/new/Regexp.qll

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
private import semmle.python.RegexTreeView
66
private import semmle.python.regex
77
private import semmle.python.dataflow.new.DataFlow
8+
private import semmle.python.regexp.internal.RegExpTracking
89

910
/**
1011
* Provides utility predicates related to regular expressions.
@@ -25,18 +26,18 @@ deprecated module RegExpPatterns {
2526
* as a part of a regular expression.
2627
*/
2728
class RegExpPatternSource extends DataFlow::CfgNode {
28-
private Regex astNode;
29+
private DataFlow::Node sink;
2930

30-
RegExpPatternSource() { astNode = this.asExpr() }
31+
RegExpPatternSource() { this = regExpSource(sink) }
3132

3233
/**
3334
* Gets a node where the pattern of this node is parsed as a part of
3435
* a regular expression.
3536
*/
36-
DataFlow::Node getAParse() { result = this }
37+
DataFlow::Node getAParse() { result = sink }
3738

3839
/**
3940
* Gets the root term of the regular expression parsed from this pattern.
4041
*/
41-
RegExpTerm getRegExpTerm() { result.getRegex() = astNode }
42+
RegExpTerm getRegExpTerm() { result.getRegex() = this.asExpr() }
4243
}

0 commit comments

Comments
 (0)