Skip to content

Commit 362e7ae

Browse files
committed
Python: Add HttpRedirectSinks test for django
1 parent a3c6472 commit 362e7ae

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

python/ql/src/semmle/python/web/django/Redirect.qll

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ class DjangoRedirect extends HttpRedirectTaintSink {
1717
override string toString() { result = "django.redirect" }
1818

1919
DjangoRedirect() {
20-
exists(CallNode call |
21-
redirect().getACall() = call and
22-
this = call.getAnArg()
23-
)
20+
this = redirect().getACall().getAnArg()
2421
}
2522
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| test_1x.py:13:21:13:24 | django.redirect | externally controlled string |
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import python
2+
import semmle.python.web.HttpRedirect
3+
import semmle.python.security.strings.Untrusted
4+
5+
from HttpRedirectTaintSink sink, TaintKind kind
6+
where sink.sinks(kind)
7+
select sink, kind
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# see https://docs.djangoproject.com/en/1.11/_modules/django/shortcuts/#redirect
2+
3+
def render(request, template_name, context=None, content_type=None, status=None, using=None):
4+
pass
5+
6+
def redirect(to, *args, **kwargs):
7+
pass

0 commit comments

Comments
 (0)