Python: Consider routed parameter if URL pattern unknown

This commit is contained in:
Rasmus Wriedt Larsen
2020-10-06 11:03:25 +02:00
parent 16bad003a0
commit b82727d0b8
2 changed files with 7 additions and 1 deletions

View File

@@ -117,6 +117,12 @@ private module Flask {
/** A route setup made by flask (sharing handling of URL patterns). */
abstract private class FlaskRouteSetup extends HTTP::Server::RouteSetup::Range {
override Parameter getARoutedParameter() {
// If we don't know the URL pattern, we simply mark all parameters as a routed
// parameter. This should give us more RemoteFlowSources but could also lead to
// more FPs. If this turns out to be the wrong tradeoff, we can always change our mind.
not exists(this.getUrlPattern()) and
result = this.getARouteHandler().getArgByName(_)
or
exists(string name |
result = this.getARouteHandler().getArgByName(name) and
exists(string match |

View File

@@ -24,7 +24,7 @@ app.view_functions['later_set'] = later_set
@app.route(UNKNOWN_ROUTE) # $routeSetup
def unkown_route(foo, bar): # $routeHandler
def unkown_route(foo, bar): # $routeHandler $routedParameter=foo $routedParameter=bar
return make_response("unkown_route")