mirror of
https://github.com/github/codeql.git
synced 2026-05-02 04:05:14 +02:00
Query to detect unsafe request dispatcher usage
This commit is contained in:
@@ -347,3 +347,27 @@ predicate isRequestGetParamMethod(MethodAccess ma) {
|
||||
ma.getMethod() instanceof ServletRequestGetParameterMapMethod or
|
||||
ma.getMethod() instanceof HttpServletRequestGetQueryStringMethod
|
||||
}
|
||||
|
||||
/** The Java EE RequestDispatcher. */
|
||||
library class RequestDispatcher extends RefType {
|
||||
RequestDispatcher() {
|
||||
this.hasQualifiedName(["javax.servlet", "jakarta.servlet"], "RequestDispatcher") or
|
||||
this.hasQualifiedName("javax.portlet", "PortletRequestDispatcher")
|
||||
}
|
||||
}
|
||||
|
||||
/** The `getRequestDispatcher` method. */
|
||||
library class GetRequestDispatcherMethod extends Method {
|
||||
GetRequestDispatcherMethod() {
|
||||
this.getReturnType() instanceof RequestDispatcher and
|
||||
this.getName() = "getRequestDispatcher"
|
||||
}
|
||||
}
|
||||
|
||||
/** The request dispatch method. */
|
||||
library class RequestDispatchMethod extends Method {
|
||||
RequestDispatchMethod() {
|
||||
this.getDeclaringType() instanceof RequestDispatcher and
|
||||
this.hasName(["forward", "include"])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user