Skip to content

Commit 0d405c2

Browse files
committed
Java: Convert PlayRequestGetMethod to CSV based flow source
1 parent e0b1a86 commit 0d405c2

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

java/ql/src/semmle/code/java/dataflow/ExternalFlow.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,12 @@ private predicate sourceModelCsv(string row) {
172172
"org.springframework.web.client;RestTemplate;false;getForEntity;;;ReturnValue;remote",
173173
"org.springframework.web.client;RestTemplate;false;postForEntity;;;ReturnValue;remote",
174174
// WebSocketMessageParameterSource
175-
"java.net.http;WebSocket$Listener;true;onText;(WebSocket,CharSequence,boolean);;Parameter[1];remote"
175+
"java.net.http;WebSocket$Listener;true;onText;(WebSocket,CharSequence,boolean);;Parameter[1];remote",
176+
// PlayRequestGetMethod
177+
"play.mvc;Http$RequestHeader;false;queryString;;;ReturnValue;remote",
178+
"play.mvc;Http$RequestHeader;false;getQueryString;;;ReturnValue;remote",
179+
"play.mvc;Http$RequestHeader;false;header;;;ReturnValue;remote",
180+
"play.mvc;Http$RequestHeader;false;getHeader;;;ReturnValue;remote"
176181
]
177182
}
178183

java/ql/src/semmle/code/java/dataflow/FlowSources.qll

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ private class ExternalRemoteFlowSource extends RemoteFlowSource {
3939
override string getSourceType() { result = "external" }
4040
}
4141

42-
private class RemoteTaintedMethodAccessSource extends RemoteFlowSource {
43-
RemoteTaintedMethodAccessSource() {
44-
this.asExpr().(MethodAccess).getMethod() instanceof RemoteTaintedMethod
45-
}
46-
47-
override string getSourceType() { result = "network data source" }
48-
}
49-
5042
private class RmiMethodParameterSource extends RemoteFlowSource {
5143
RmiMethodParameterSource() {
5244
exists(RemoteCallableMethod method |
@@ -204,17 +196,6 @@ class DatabaseInput extends LocalUserInput {
204196
DatabaseInput() { this.asExpr().(MethodAccess).getMethod() instanceof ResultSetGetStringMethod }
205197
}
206198

207-
private class RemoteTaintedMethod extends Method {
208-
RemoteTaintedMethod() { this instanceof PlayRequestGetMethod }
209-
}
210-
211-
private class PlayRequestGetMethod extends Method {
212-
PlayRequestGetMethod() {
213-
this.getDeclaringType() instanceof PlayMvcHttpRequestHeader and
214-
this.hasName(["queryString", "getQueryString", "header", "getHeader"])
215-
}
216-
}
217-
218199
/** A method that reads from the environment, such as `System.getProperty` or `System.getenv`. */
219200
class EnvReadMethod extends Method {
220201
EnvReadMethod() {

0 commit comments

Comments
 (0)