Skip to content

Commit fdf1dca

Browse files
authored
Merge pull request #19735 from geoffw0/canonical
Rust: Update RegexInjectionExtensions to use getCanonicalPath.
2 parents 7f76f5b + 0c05fa4 commit fdf1dca

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

rust/ql/lib/codeql/rust/security/regex/RegexInjectionExtensions.qll

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ module RegexInjection {
5353
*/
5454
private class NewSink extends Sink {
5555
NewSink() {
56-
exists(CallExprCfgNode call, PathExpr path |
57-
path = call.getFunction().getExpr() and
58-
path.getResolvedCrateOrigin() = "repo:https://github.com/rust-lang/regex:regex" and
59-
path.getResolvedPath() = "<crate::regex::string::Regex>::new" and
60-
this.asExpr() = call.getArgument(0) and
56+
exists(CallExprBase call, Addressable a |
57+
call.getStaticTarget() = a and
58+
a.getCanonicalPath() = "<regex::regex::string::Regex>::new" and
59+
this.asExpr().getExpr() = call.getArg(0) and
6160
not this.asExpr() instanceof LiteralExprCfgNode
6261
)
6362
}

0 commit comments

Comments
 (0)