File tree Expand file tree Collapse file tree
test/library-tests/web/falcon Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ import semmle.python.web.tornado.Response
55import semmle.python.web.twisted.Response
66import semmle.python.web.bottle.Response
77import semmle.python.web.turbogears.Response
8+ import semmle.python.web.falcon.Response
Original file line number Diff line number Diff line change 1+ import python
2+
3+
4+ import semmle.python.security.TaintTracking
5+ import semmle.python.web.Http
6+ import semmle.python.web.falcon.General
7+ import semmle.python.security.strings.External
8+
9+
10+ /** https://falcon.readthedocs.io/en/stable/api/request_and_response.html */
11+ class FalconResponse extends TaintKind {
12+
13+ FalconResponse ( ) {
14+ this = "falcon.response"
15+ }
16+
17+ }
18+
19+ class FalconResponseParameter extends TaintSource {
20+
21+ FalconResponseParameter ( ) {
22+ exists ( FalconHandlerFunction f |
23+ f .getResponse ( ) = this .( ControlFlowNode ) .getNode ( )
24+ )
25+ }
26+
27+ override predicate isSourceOf ( TaintKind k ) {
28+ k instanceof FalconResponse
29+ }
30+
31+ }
32+
33+ class FalconResponseBodySink extends TaintSink {
34+
35+ FalconResponseBodySink ( ) {
36+ exists ( AttrNode attr |
37+ any ( FalconResponse f ) .taints ( attr .getObject ( "body" ) ) |
38+ attr .( DefinitionNode ) .getValue ( ) = this
39+ )
40+ }
41+
42+ override predicate sinks ( TaintKind kind ) {
43+ kind instanceof ExternalStringKind
44+ }
45+
46+ }
47+
48+
Original file line number Diff line number Diff line change 11| /hello | get | test.py:9:5:9:32 | Function on_get |
2- | /hello | post | test.py:12 :5:12 :33 | Function on_post |
2+ | /hello | post | test.py:19 :5:19 :33 | Function on_post |
Original file line number Diff line number Diff line change 1- fail
1+ | test.py:17 | Attribute() | externally controlled string |
Original file line number Diff line number Diff line change 1- fail
1+ | test.py:9 | req | falcon.request |
2+ | test.py:19 | req | falcon.request |
Original file line number Diff line number Diff line change 11| test.py:9 | req | falcon.request |
2+ | test.py:9 | resp | falcon.response |
23| test.py:10 | Attribute | file[externally controlled string] |
34| test.py:10 | Attribute() | externally controlled string |
45| test.py:10 | req | falcon.request |
56| test.py:11 | Attribute() | externally controlled string |
67| test.py:11 | Attribute() | json[externally controlled string] |
78| test.py:11 | raw_json | externally controlled string |
9+ | test.py:12 | resp | falcon.response |
810| test.py:13 | Dict | {externally controlled string} |
911| test.py:13 | Dict | {json[externally controlled string]} |
1012| test.py:15 | result | externally controlled string |
1113| test.py:15 | result | json[externally controlled string] |
14+ | test.py:17 | resp | falcon.response |
1215| test.py:17 | result | {externally controlled string} |
1316| test.py:17 | result | {json[externally controlled string]} |
1417| test.py:19 | req | falcon.request |
18+ | test.py:19 | resp | falcon.response |
You can’t perform that action at this time.
0 commit comments