File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
python/ql/src/semmle/python/frameworks Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -1872,7 +1872,23 @@ private module Django {
1872
1872
private class DjangoUrlsRePathCall extends DjangoRegexRouteSetup {
1873
1873
override CallNode node ;
1874
1874
1875
- DjangoUrlsRePathCall ( ) { node .getFunction ( ) = django:: urls:: re_path ( ) .asCfgNode ( ) }
1875
+ DjangoUrlsRePathCall ( ) {
1876
+ node .getFunction ( ) = django:: urls:: re_path ( ) .asCfgNode ( ) and
1877
+ // `django.conf.urls.url` (which we support directly with
1878
+ // `DjangoConfUrlsUrlCall`), is implemented in Django 2+ as backward compatibility
1879
+ // using `django.urls.re_path`. See
1880
+ // https://github.com/django/django/blob/stable/3.2.x/django/conf/urls/__init__.py#L22
1881
+ // Since we're still installing dependencies and analyzing their source code,
1882
+ // without explicitly filtering out this call, we would be double-counting such
1883
+ // route-setups :( One practical negative side effect of double-counting it, is
1884
+ // that since we can't figure out the URL in the library code calling `django.urls.re_path`
1885
+ // (because we only consider local flow), we will for all those cases mark ANY parameter
1886
+ // as being a routed-parameter, which can lead to FPs.
1887
+ not exists ( Module mod |
1888
+ mod .getName ( ) = "django.conf.urls.__init__" and
1889
+ node .getEnclosingModule ( ) = mod
1890
+ )
1891
+ }
1876
1892
1877
1893
override DataFlow:: Node getUrlPatternArg ( ) {
1878
1894
result .asCfgNode ( ) = [ node .getArg ( 0 ) , node .getArgByName ( "route" ) ]
You can’t perform that action at this time.
0 commit comments