Skip to content

Commit eb30e8f

Browse files
Jami CogswellJami Cogswell
authored andcommitted
move Pattern.quote and Pattern.LITERAL models to Regex.qll
1 parent 81ad10b commit eb30e8f

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

java/ql/lib/semmle/code/java/frameworks/Regex.qll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ class TypeRegexPattern extends Class {
77
TypeRegexPattern() { this.hasQualifiedName("java.util.regex", "Pattern") }
88
}
99

10+
/** The `quote` method of the `java.util.regex.Pattern` class. */
11+
class PatternQuoteMethod extends Method {
12+
PatternQuoteMethod() {
13+
this.getDeclaringType() instanceof TypeRegexPattern and
14+
this.hasName(["quote"])
15+
}
16+
}
17+
18+
/** The `LITERAL` field of the `java.util.regex.Pattern` class. */
19+
class PatternLiteral extends Field {
20+
PatternLiteral() {
21+
this.getDeclaringType() instanceof TypeRegexPattern and
22+
this.hasName("LITERAL")
23+
}
24+
}
25+
1026
private class RegexModel extends SummaryModelCsv {
1127
override predicate row(string s) {
1228
s =

java/ql/lib/semmle/code/java/security/RegexInjection.qll

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,6 @@ private class PatternRegexMethod extends Method {
9292
}
9393
}
9494

95-
/** The `quote` method of the `java.util.regex.Pattern` class. */
96-
private class PatternQuoteMethod extends Method {
97-
PatternQuoteMethod() { this.hasName(["quote"]) }
98-
}
99-
100-
/** The `LITERAL` field of the `java.util.regex.Pattern` class. */
101-
private class PatternLiteral extends Field {
102-
PatternLiteral() {
103-
this.getDeclaringType() instanceof TypeRegexPattern and
104-
this.hasName("LITERAL")
105-
}
106-
}
107-
10895
/**
10996
* The methods of the class `org.apache.commons.lang3.RegExUtils` that take
11097
* a regular expression of type `String` as a parameter.

0 commit comments

Comments
 (0)