Skip to content

Commit d269a7e

Browse files
committed
CWE-598 reduction
1 parent 216f204 commit d269a7e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

java/ql/src/experimental/Security/CWE/CWE-598/SensitiveGetQuery.ql

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* @name Sensitive GET Query
33
* @description Use of GET request method with sensitive query strings.
44
* @kind path-problem
5+
* @problem.severity warning
6+
* @precision medium
57
* @id java/sensitive-query-with-get
68
* @tags security
79
* external/cwe-598
@@ -23,6 +25,16 @@ class SensitiveInfoExpr extends Expr {
2325
}
2426
}
2527

28+
/** Holds if `m` is a method of some override of `HttpServlet.doGet`. */
29+
private predicate isGetServletMethod(Method m) {
30+
isServletRequestMethod(m) and m.getName() = "doGet"
31+
}
32+
33+
/** The `doGet` method of `HttpServlet`. */
34+
class DoGetServletMethod extends Method {
35+
DoGetServletMethod() { isGetServletMethod(this) }
36+
}
37+
2638
/** Holds if `ma` is (perhaps indirectly) called from the `doGet` method of `HttpServlet`. */
2739
predicate isReachableFromServletDoGet(MethodAccess ma) {
2840
ma.getEnclosingCallable() instanceof DoGetServletMethod
@@ -64,4 +76,4 @@ from DataFlow::PathNode source, DataFlow::PathNode sink, SensitiveGetQueryConfig
6476
where c.hasFlowPath(source, sink)
6577
select sink.getNode(), source, sink,
6678
"$@ uses the GET request method to transmit sensitive information.", source.getNode(),
67-
"This request"
79+
"This request"

0 commit comments

Comments
 (0)