Skip to content

Commit 86444bf

Browse files
author
edvraa
committed
Use set literal expression
1 parent 9774b24 commit 86444bf

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

java/ql/src/experimental/Security/CWE/CWE-730/RegexInjection.ql

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,23 @@ class RegexSink extends DataFlow::ExprNode {
2727
m.getDeclaringType() instanceof TypeString and
2828
(
2929
ma.getArgument(0) = this.asExpr() and
30-
(
31-
m.hasName("matches") or
32-
m.hasName("split") or
33-
m.hasName("replaceFirst") or
34-
m.hasName("replaceAll")
35-
)
30+
m.hasName(["matches", "split", "replaceFirst", "replaceAll"])
3631
)
3732
or
3833
m.getDeclaringType().hasQualifiedName("java.util.regex", "Pattern") and
3934
(
4035
ma.getArgument(0) = this.asExpr() and
41-
(
42-
m.hasName("compile") or
43-
m.hasName("matches")
44-
)
36+
m.hasName(["compile", "matches"])
4537
)
4638
or
4739
m.getDeclaringType().hasQualifiedName("org.apache.commons.lang3", "RegExUtils") and
4840
(
4941
ma.getArgument(1) = this.asExpr() and
5042
m.getParameterType(1).(Class) instanceof TypeString and
51-
(
52-
m.hasName("removeAll") or
53-
m.hasName("removeFirst") or
54-
m.hasName("removePattern") or
55-
m.hasName("replaceAll") or
56-
m.hasName("replaceFirst") or
57-
m.hasName("replacePattern")
58-
)
43+
m.hasName([
44+
"removeAll", "removeFirst", "removePattern", "replaceAll", "replaceFirst",
45+
"replacePattern"
46+
])
5947
)
6048
)
6149
)

0 commit comments

Comments
 (0)