Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use set literal expression
  • Loading branch information
edvraa committed Apr 22, 2021
commit 86444bfa09e2e48ec37801abf3b80d537dce4f92
24 changes: 6 additions & 18 deletions java/ql/src/experimental/Security/CWE/CWE-730/RegexInjection.ql
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,23 @@ class RegexSink extends DataFlow::ExprNode {
m.getDeclaringType() instanceof TypeString and
(
Comment thread
This conversation was marked as resolved.
ma.getArgument(0) = this.asExpr() and
(
m.hasName("matches") or
m.hasName("split") or
m.hasName("replaceFirst") or
m.hasName("replaceAll")
)
m.hasName(["matches", "split", "replaceFirst", "replaceAll"])
)
or
m.getDeclaringType().hasQualifiedName("java.util.regex", "Pattern") and
(
ma.getArgument(0) = this.asExpr() and
(
m.hasName("compile") or
m.hasName("matches")
)
m.hasName(["compile", "matches"])
)
or
m.getDeclaringType().hasQualifiedName("org.apache.commons.lang3", "RegExUtils") and
(
ma.getArgument(1) = this.asExpr() and
m.getParameterType(1).(Class) instanceof TypeString and
Comment thread
This conversation was marked as resolved.
Outdated
(
m.hasName("removeAll") or
m.hasName("removeFirst") or
m.hasName("removePattern") or
m.hasName("replaceAll") or
m.hasName("replaceFirst") or
m.hasName("replacePattern")
)
m.hasName([
"removeAll", "removeFirst", "removePattern", "replaceAll", "replaceFirst",
"replacePattern"
])
)
)
)
Expand Down