Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8f644af

Browse files
committed
Make MissingRegexpAnchor use new API
1 parent 442f687 commit 8f644af

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

go/ql/src/Security/CWE-020/MissingRegexpAnchor.ql

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,22 @@ predicate isInterestingUnanchoredRegexpString(string re, string msg) {
6060
"hosts may come before or after it."
6161
}
6262

63-
class Config extends DataFlow::Configuration {
64-
Config() { this = "MissingRegexpAnchor::Config" }
65-
66-
predicate isSourceString(DataFlow::Node source, string msg) {
63+
module Config implements DataFlow::ConfigSig {
64+
additional predicate isSourceString(DataFlow::Node source, string msg) {
6765
exists(Expr e | e = source.asExpr() |
6866
isInterestingUnanchoredRegexpString(e.getStringValue(), msg)
6967
or
7068
isInterestingSemiAnchoredRegexpString(e.getStringValue(), msg)
7169
)
7270
}
7371

74-
override predicate isSource(DataFlow::Node source) { this.isSourceString(source, _) }
72+
predicate isSource(DataFlow::Node source) { isSourceString(source, _) }
7573

76-
override predicate isSink(DataFlow::Node sink) { sink instanceof RegexpPattern }
74+
predicate isSink(DataFlow::Node sink) { sink instanceof RegexpPattern }
7775
}
7876

79-
from Config c, DataFlow::PathNode source, string msg
80-
where c.hasFlowPath(source, _) and c.isSourceString(source.getNode(), msg)
81-
select source.getNode(), msg
77+
module Flow = DataFlow::Global<Config>;
78+
79+
from DataFlow::Node source, string msg
80+
where Flow::flow(source, _) and Config::isSourceString(source, msg)
81+
select source, msg

0 commit comments

Comments
 (0)