mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Python: Add simpel model of a django path/re_path route setup
Also had to change the annotation to not include the `r` prefix for the raw-string... not sure why that isn't replicated, but ¯\_(ツ)_/¯
This commit is contained in:
@@ -13,15 +13,9 @@
|
||||
| routing_test.py:44:62:44:120 | Comment # $routeHandler $routedParameter=arg0 $routedParameter=arg1 | Missing result:routeHandler= |
|
||||
| routing_test.py:44:62:44:120 | Comment # $routeHandler $routedParameter=arg0 $routedParameter=arg1 | Missing result:routedParameter=arg0 |
|
||||
| routing_test.py:44:62:44:120 | Comment # $routeHandler $routedParameter=arg0 $routedParameter=arg1 | Missing result:routedParameter=arg1 |
|
||||
| routing_test.py:49:75:49:131 | Comment # $routeSetup=r"^url_match/(?P<foo>[^/]+)/(?P<bar>[^/]+)" | Missing result:routeSetup=r"^url_match/(?P<foo>[^/]+)/(?P<bar>[^/]+)" |
|
||||
| routing_test.py:50:47:50:74 | Comment # $routeSetup=r"^get_params" | Missing result:routeSetup=r"^get_params" |
|
||||
| routing_test.py:51:49:51:77 | Comment # $routeSetup=r"^post_params" | Missing result:routeSetup=r"^post_params" |
|
||||
| routing_test.py:52:53:52:85 | Comment # $routeSetup=r"^http_resp_write" | Missing result:routeSetup=r"^http_resp_write" |
|
||||
| routing_test.py:53:70:53:115 | Comment # $routeSetup=r"^class_view/(?P<untrusted>.+)" | Missing result:routeSetup=r"^class_view/(?P<untrusted>.+)" |
|
||||
| routing_test.py:56:76:56:133 | Comment # $routeSetup=r"articles/^(?:page-(?P<page_number>\\d+)/)?" | Missing result:routeSetup=r"articles/^(?:page-(?P<page_number>\\d+)/)?" |
|
||||
| routing_test.py:59:95:59:139 | Comment # $routeSetup=r"^([^/]+)/(?:foo\|bar)/([^/]+)" | Missing result:routeSetup=r"^([^/]+)/(?:foo\|bar)/([^/]+)" |
|
||||
| routing_test.py:65:31:65:45 | Comment # $routeHandler | Missing result:routeHandler= |
|
||||
| routing_test.py:70:84:70:138 | Comment # $routeSetup=r"^specifying-as-kwargs-is-not-a-problem" | Missing result:routeSetup=r"^specifying-as-kwargs-is-not-a-problem" |
|
||||
| routing_test.py:70:5:70:81 | ControlFlowNode for re_path() | Unexpected result: routeSetup= |
|
||||
| routing_test.py:70:84:70:137 | Comment # $routeSetup="^specifying-as-kwargs-is-not-a-problem" | Missing result:routeSetup="^specifying-as-kwargs-is-not-a-problem" |
|
||||
| routing_test.py:78:43:78:86 | Comment # $routeHandler $routedParameter=page_number | Missing result:routeHandler= |
|
||||
| routing_test.py:78:43:78:86 | Comment # $routeHandler $routedParameter=page_number | Missing result:routedParameter=page_number |
|
||||
| routing_test.py:81:43:81:120 | Comment # $routeHandler $routedParameter=foo $routedParameter=bar $routedParameter=baz | Missing result:routeHandler= |
|
||||
@@ -32,12 +26,5 @@
|
||||
| routing_test.py:84:38:84:94 | Comment # $routeHandler $routedParameter=foo $routedParameter=bar | Missing result:routedParameter=bar |
|
||||
| routing_test.py:84:38:84:94 | Comment # $routeHandler $routedParameter=foo $routedParameter=bar | Missing result:routedParameter=foo |
|
||||
| routing_test.py:87:37:87:51 | Comment # $routeHandler | Missing result:routeHandler= |
|
||||
| routing_test.py:91:38:91:62 | Comment # $routeSetup="articles/" | Missing result:routeSetup="articles/" |
|
||||
| routing_test.py:92:60:92:106 | Comment # $routeSetup="articles/page-<int:page_number>" | Missing result:routeSetup="articles/page-<int:page_number>" |
|
||||
| routing_test.py:93:74:93:114 | Comment # $routeSetup="<int:foo>/<str:bar>/<baz>" | Missing result:routeSetup="<int:foo>/<str:bar>/<baz>" |
|
||||
| routing_test.py:95:51:95:77 | Comment # $routeSetup="<foo>/<bar>" | Missing result:routeSetup="<foo>/<bar>" |
|
||||
| routing_test.py:98:60:98:97 | Comment # $routeSetup="not_valid/<not_valid!>" | Missing result:routeSetup="not_valid/<not_valid!>" |
|
||||
| testapp/urls.py:6:31:6:50 | Comment # $routeSetup="foo/" | Missing result:routeSetup="foo/" |
|
||||
| testapp/urls.py:10:43:10:67 | Comment # $routeSetup=r"^ba[rz]/" | Missing result:routeSetup=r"^ba[rz]/" |
|
||||
| testapp/views.py:3:33:3:47 | Comment # $routeHandler | Missing result:routeHandler= |
|
||||
| testapp/views.py:6:37:6:51 | Comment # $routeHandler | Missing result:routeHandler= |
|
||||
|
||||
@@ -4,3 +4,7 @@
|
||||
|
||||
from testproj import *
|
||||
from testapp import *
|
||||
|
||||
import os.path as pth
|
||||
|
||||
pth.join("foo", "bar")
|
||||
|
||||
@@ -46,17 +46,17 @@ def xxs_positional_arg(request, arg0, arg1, no_taint=None): # $routeHandler $ro
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
re_path(r"^url_match/(?P<foo>[^/]+)/(?P<bar>[^/]+)", url_match_xss), # $routeSetup=r"^url_match/(?P<foo>[^/]+)/(?P<bar>[^/]+)"
|
||||
re_path(r"^get_params", get_params_xss), # $routeSetup=r"^get_params"
|
||||
re_path(r"^post_params", post_params_xss), # $routeSetup=r"^post_params"
|
||||
re_path(r"^http_resp_write", http_resp_write), # $routeSetup=r"^http_resp_write"
|
||||
re_path(r"^class_view/(?P<untrusted>.+)", ClassView.as_view()), # $routeSetup=r"^class_view/(?P<untrusted>.+)"
|
||||
re_path(r"^url_match/(?P<foo>[^/]+)/(?P<bar>[^/]+)", url_match_xss), # $routeSetup="^url_match/(?P<foo>[^/]+)/(?P<bar>[^/]+)"
|
||||
re_path(r"^get_params", get_params_xss), # $routeSetup="^get_params"
|
||||
re_path(r"^post_params", post_params_xss), # $routeSetup="^post_params"
|
||||
re_path(r"^http_resp_write", http_resp_write), # $routeSetup="^http_resp_write"
|
||||
re_path(r"^class_view/(?P<untrusted>.+)", ClassView.as_view()), # $routeSetup="^class_view/(?P<untrusted>.+)"
|
||||
|
||||
# one pattern to support `articles/page-<n>` and ensuring that articles/ goes to page-1
|
||||
re_path(r"articles/^(?:page-(?P<page_number>\d+)/)?", show_articles), # $routeSetup=r"articles/^(?:page-(?P<page_number>\d+)/)?"
|
||||
re_path(r"articles/^(?:page-(?P<page_number>\d+)/)?", show_articles), # $routeSetup="articles/^(?:page-(?P<page_number>\d+)/)?"
|
||||
# passing as positional argument is not the recommended way of doing things, but it is certainly
|
||||
# possible
|
||||
re_path(r"^([^/]+)/(?:foo|bar)/([^/]+)", xxs_positional_arg, name='xxs_positional_arg'), # $routeSetup=r"^([^/]+)/(?:foo|bar)/([^/]+)"
|
||||
re_path(r"^([^/]+)/(?:foo|bar)/([^/]+)", xxs_positional_arg, name='xxs_positional_arg'), # $routeSetup="^([^/]+)/(?:foo|bar)/([^/]+)"
|
||||
]
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ def re_path_kwargs(request): # $routeHandler
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
re_path(view=re_path_kwargs, regex=r"^specifying-as-kwargs-is-not-a-problem") # $routeSetup=r"^specifying-as-kwargs-is-not-a-problem"
|
||||
re_path(view=re_path_kwargs, regex=r"^specifying-as-kwargs-is-not-a-problem") # $routeSetup="^specifying-as-kwargs-is-not-a-problem"
|
||||
]
|
||||
|
||||
################################################################################
|
||||
|
||||
@@ -7,5 +7,5 @@ urlpatterns = [
|
||||
# TODO: Doesn't include standard `$` to mark end of string, due to problems with
|
||||
# inline expectation tests (which thinks the `$` would mark the beginning of a new
|
||||
# line)
|
||||
re_path(r"^ba[rz]/", views.bar_baz), # $routeSetup=r"^ba[rz]/"
|
||||
re_path(r"^ba[rz]/", views.bar_baz), # $routeSetup="^ba[rz]/"
|
||||
]
|
||||
|
||||
@@ -17,6 +17,6 @@ from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path("app/", include("testapp.urls")),
|
||||
path("admin/", admin.site.urls), # $routeSetup="admin/"
|
||||
path("app/", include("testapp.urls")), # $routeSetup="app/"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user