File tree Expand file tree Collapse file tree 6 files changed +14
-19
lines changed
src/semmle/python/web/tornado
test/library-tests/web/tornado Expand file tree Collapse file tree 6 files changed +14
-19
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,16 @@ import Tornado
1313/**
1414 * Represents an argument to the `tornado.redirect` function.
1515 */
16- class TornadoRedirect extends HttpRedirectTaintSink {
17- override string toString ( ) { result = "tornado.redirect" }
16+ class TornadoHttpRequestHandlerRedirect extends HttpRedirectTaintSink {
17+ override string toString ( ) { result = "tornado.HttpRequestHandler. redirect" }
1818
19- TornadoRedirect ( ) {
19+ TornadoHttpRequestHandlerRedirect ( ) {
2020 exists ( CallNode call , ControlFlowNode node |
2121 node = call .getFunction ( ) .( AttrNode ) .getObject ( "redirect" ) and
2222 isTornadoRequestHandlerInstance ( node ) and
23- this = call .getAnArg ( )
23+ this = call .getArg ( 0 )
2424 )
2525 }
26+
27+ override predicate sinks ( TaintKind kind ) { kind instanceof StringKind }
2628}
Original file line number Diff line number Diff line change @@ -45,17 +45,3 @@ class TornadoHttpRequestHandlerWrite extends HttpResponseTaintSink {
4545
4646 override predicate sinks ( TaintKind kind ) { kind instanceof StringKind }
4747}
48-
49- class TornadoHttpRequestHandlerRedirect extends HttpResponseTaintSink {
50- override string toString ( ) { result = "tornado.HttpRequestHandler.redirect" }
51-
52- TornadoHttpRequestHandlerRedirect ( ) {
53- exists ( CallNode call , ControlFlowNode node |
54- node = call .getFunction ( ) .( AttrNode ) .getObject ( "redirect" ) and
55- isTornadoRequestHandlerInstance ( node ) and
56- this = call .getArg ( 0 )
57- )
58- }
59-
60- override predicate sinks ( TaintKind kind ) { kind instanceof StringKind }
61- }
Original file line number Diff line number Diff line change 1+ | test.py:20:23:20:25 | tornado.HttpRequestHandler.redirect | externally controlled string |
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 11| test.py:6:20:6:43 | tornado.HttpRequestHandler.write | externally controlled string |
22| test.py:12:20:12:23 | tornado.HttpRequestHandler.write | externally controlled string |
3- | test.py:20:23:20:25 | tornado.HttpRequestHandler.redirect | externally controlled string |
43| test.py:26:20:26:48 | tornado.HttpRequestHandler.write | externally controlled string |
File renamed without changes.
You can’t perform that action at this time.
0 commit comments