Skip to content

Commit 452ec8c

Browse files
author
edvraa
committed
comments
1 parent 13655b5 commit 452ec8c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ import semmle.code.java.dataflow.FlowSources
1717
import semmle.code.java.dataflow.TaintTracking
1818
import DataFlow::PathGraph
1919

20+
/**
21+
* A data flow sink for untrusted user input used to construct regular expressions.
22+
*/
2023
class RegexSink extends DataFlow::ExprNode {
2124
RegexSink() {
2225
exists(MethodAccess ma, Method m | m = ma.getMethod() |
@@ -61,6 +64,10 @@ class RegexSink extends DataFlow::ExprNode {
6164

6265
abstract class Sanitizer extends DataFlow::ExprNode { }
6366

67+
/**
68+
* A call to a function whose name suggests that it escapes regular
69+
* expression meta-characters.
70+
*/
6471
class RegExpSanitizationCall extends Sanitizer {
6572
RegExpSanitizationCall() {
6673
exists(string calleeName, string sanitize, string regexp |
@@ -75,6 +82,9 @@ class RegExpSanitizationCall extends Sanitizer {
7582
}
7683
}
7784

85+
/**
86+
* A taint-tracking configuration for untrusted user input used to construct regular expressions.
87+
*/
7888
class RegexInjectionConfiguration extends TaintTracking::Configuration {
7989
RegexInjectionConfiguration() { this = "RegexInjectionConfiguration" }
8090

0 commit comments

Comments
 (0)