Django: Fix DjangoRouteHandler char-pred

Before it the class would contain _all_ functions xD
This commit is contained in:
Rasmus Wriedt Larsen
2021-02-10 16:06:44 +01:00
parent 78a3206fce
commit b428945bc2

View File

@@ -2029,7 +2029,7 @@ private module Django {
DjangoViewClassDef() { this.getABase() = django::views::generic::View::subclassRef().asExpr() }
/** Gets a function that could handle incoming requests, if any. */
DjangoRouteHandler getARequestHandler() {
Function getARequestHandler() {
// TODO: This doesn't handle attribute assignment. Should be OK, but analysis is not as complete as with
// points-to and `.lookup`, which would handle `post = my_post_handler` inside class def
result = this.getAMethod() and
@@ -2076,7 +2076,7 @@ private module Django {
*/
private class DjangoRouteHandler extends Function {
DjangoRouteHandler() {
exists(djangoRouteHandlerFunctionTracker(this))
exists(DjangoRouteSetup route | route.getViewArg() = djangoRouteHandlerFunctionTracker(this))
or
any(DjangoViewClassDef vc).getARequestHandler() = this
}